Docsify
Docsify
Definition
- Docsify generates your documentation website from markdown files on the fly.
- It does not generate fully static static webpages: it uses online scripts (you can also check docsify-this).
Quick start
Install.
1
npm i docsify-cli -g
Initialize (documentation in the
./docs
subdirectory).1
docsify init ./docs
Writing content (see the file list in the
./docs
subdirectory).index.html
: entry file.README.md
: home page..nojekyll
: prevents GitHub Pages from ignoring files that begin with an underscore.
Preview your site (on
http://localhost:3000
).1
docsify serve docs
Index overview
1 | <!-- index.html --> |
- Review version: you can check it on both the script and head link for stylesheet, after the ‘@’ character.
Advanced
Several pages
Structure.
1
2
3
4
5
6
7.
└─ docs
├─ README.md
├─ guide.md
└─ es-es
├─ README.md
└─ guide.mdPaths.
1
2
3
4docs/README.md => http://domain.com
docs/guide.md => http://domain.com/#/guide
docs/es-es/README.md => http://domain.com/#/es-es/
docs/es-es/guide.md => http://domain.com/#/es-es/guide
Sidebar
Structure.
1
2
3
4
5└─docs/
├─ _sidebar.md
├─ index.md
├─ getting-started.md
└─ running-services.mdSidebar file content.
_sidebar.md 1
2
3
4<!-- docs/_sidebar.md -->
* [Home](/)
* [Guide](guide.md)Index requires sidebar configuration to true.
index.html 1
2
3
4
5
6
7
8<!-- index.html -->
<script>
window.$docsify = {
loadSidebar: true
}
</script>
<script src="//cdn.jsdelivr.net/npm/docsify/lib/docsify.min.js"></script>Nested sidebars.
update after navigation to reflect the current directory by adding a
_sidebar.md
file to each folder. If the current directory doesn’t have _sidebar.md, it will fall back to the parent directory.update the index file.
index.html 1
2
3
4
5
6
7
8<script>
window.$docsify = {
loadSidebar: true,
alias: {
'/.*/_sidebar.md': '/_sidebar.md'
}
}
</script>Set page titles from sidebar selection to improve SEO.
_sidebar.md 1
2
3<!-- docs/_sidebar.md -->
* [Home](/)
* [Guide](guide.md "The greatest guide in the world")
Table of contents
Autogeneted by sidebar with
subMaxLevel
configuration.index.html 1
2
3
4
5
6
7
8
9<!-- index.html -->
<script>
window.$docsify = {
loadSidebar: true,
subMaxLevel: 2
}
</script>
<script src="//cdn.jsdelivr.net/npm/docsify/lib/docsify.min.js"></script>Ignoring specific subheaders: add
<!-- {docsify-ignore} -->
to it.1
2
3
4# Getting Started
## Header <!-- {docsify-ignore} -->
This header won't appear in the sidebar table of contents.Ignore all headers:
<!-- {docsify-ignore-all} -->
on the first header of the page.1
2
3
4# Getting Started <!-- {docsify-ignore-all} -->
## Header
This header won't appear in the sidebar table of contents.
Custom navbar
HTML only: doc links begin with
#
.index.html 1
2
3
4
5
6
7
8
9<!-- index.html -->
<body>
<nav>
<a href="#/">EN</a>
<a href="#/es-es/">ES></a>
</nav>
<div id="app"></div>
</body>Markdown alternative: you can create a custom markdown-based navigation file by setting
loadNavbar
to true and creating_navbar.md
index.html 1
2
3
4
5
6
7
8<!-- index.html -->
<script>
window.$docsify = {
loadNavbar: true
}
</script>
<script src="//cdn.jsdelivr.net/npm/docsify/lib/docsify.min.js"></script>_navbar.md 1
2
3
4<!-- _navbar.md -->
* [En](/)
* [Es](/es-es/)Nesting.
_navbar.md 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15<!-- _navbar.md -->
* Getting started
* [Quick start](quickstart.md)
* [Writing more pages](more-pages.md)
* [Custom navbar](custom-navbar.md)
* [Cover page](cover.md)
* Configuration
* [Configuration](configuration.md)
* [Themes](themes.md)
* [Using plugins](plugins.md)
* [Markdown configuration](markdown.md)
* [Language highlight](language-highlight.md)
Cover page
Basics.
index.html 1
2
3
4
5
6
7
8<!-- index.html -->
<script>
window.$docsify = {
coverpage: true
}
</script>
<script src="//cdn.jsdelivr.net/npm/docsify/lib/docsify.min.js"></script>_coverpage.md 1
2
3
4
5
6
7
8
9
10
11
12
13
14<!-- _coverpage.md -->

# docsify <small>3.5</small>
> A magical documentation site generator.
- Simple and lightweight
- No statically built html files
- Multiple themes
[GitHub](https://github.com/docsifyjs/docsify/)
[Get Started](#docsify)Custom background.
_coverpage.md 1
2
3
4
5
6
7
8
9
10
11
12
13
14<!-- _coverpage.md -->
# docsify <small>3.5</small>
[GitHub](https://github.com/docsifyjs/docsify/)
[Get Started](#quick-start)
<!-- background image -->

<!-- background color -->
Multiple coverpages by level.
1
2
3
4
5
6
7
8
9.
└─docs
├─ README.md
├─ guide.md
├─ _coverpage.md
└─ es-es
├─ README.md
└─ guide.md
└─ _coverpage.mdgeneral.
index.html 1
2
3window.$docsify = {
coverpage: ['/', '/es-es/']
};special filename.
index.html 1
2
3
4
5
6window.$docsify = {
coverpage: {
'/': 'cover.md',
'/es-es/': 'cover.md'
}
};
Themes
See Themeable.
1 | <link rel="stylesheet" href="//cdn.jsdelivr.net/npm/docsify/themes/vue.css" /> |
Plugins
Search
Using localstorage
1 | <script> |
Emoji
1 | <!-- index.html --> |
1 | <!-- _navbar.md --> |
Copy to clipboard
1 | <script src="//cdn.jsdelivr.net/npm/docsify-copy-code/dist/docsify-copy-code.min.js"></script> |