## Links
-
-- [`develop` branch preview](https://docsifyjs.netlify.com/)
- [Documentation](https://docsify.js.org)
-- [CLI](https://github.com/docsifyjs/docsify-cli)
-- CDN: [UNPKG](https://unpkg.com/docsify/) | [jsDelivr](https://cdn.jsdelivr.net/npm/docsify/) | [cdnjs](https://cdnjs.com/libraries/docsify)
-- [Awesome docsify](https://github.com/docsifyjs/awesome-docsify)
-- [Community chat](https://gitter.im/docsifyjs/Lobby)
+- [CLI](https://github.com/QingWei-Li/docsify-cli)
## Features
- No statically built html files
-- Simple and lightweight (~21kB gzipped)
+- Simple and lightweight (~14kB gzipped)
- Smart full-text search plugin
- Multiple themes
- Useful plugin API
-- Compatible with IE11
-- Support SSR ([example](https://github.com/docsifyjs/docsify-ssr-demo))
-- Support embedded files
+- Compatible with IE10+
## Quick start
+Create a `index.html`.
-Look at [this tutorial](https://docsify.js.org/#/quickstart)
+```html
+
-[](https://codesandbox.io/s/307qqv236)
+
+
+
+
+
+
+
+
+
+
+
+```
+
+## Browser Support
+
+Modern browsers and Internet Explorer 10+.
## Showcase
+These open-source projects are using docsify to generate their sites. Pull requests welcome :blush:
-These projects are using docsify to generate their sites. Pull requests welcome :blush:
-
-Move to [awesome-docsify](https://github.com/docsifyjs/awesome-docsify#showcase)
+- [Snipaste](https://docs.snipaste.com/) - Snip & Paste
+- [puck](https://puck.zz173.com/) - A small & magical php framework.
+- [Samaritan](http://samaritan.stockdb.org) - An Algorithmic Trading Framework for Digital Currency.
+- [Vudash](http://vudash.github.io/vudash/) - Powerful, Flexible, Open Source dashboards for anything
+- [Trilogy](http://trilogy.js.org) - No-hassle SQLite with a Promise-based, document store style API.
+- [Mybatis-Plus](http://mp.baomidou.com/) - An enhanced toolkit of Mybatis to simplify development
## Similar projects
-
-| Project | Description |
-| ------------------------------------------------ | ---------------------------------------- |
-| [docute](https://github.com/egoist/docute) | 📜 Effortlessly documentation done right |
-| [docpress](https://github.com/docpress/docpress) | Documentation website generator |
+- [docute](https://github.com/egoist/docute) - 📜 Effortlessly documentation done right
+- [docpress](https://github.com/docpress/docpress) - Documentation website generator
## Contributing
@@ -72,40 +72,13 @@ Move to [awesome-docsify](https://github.com/docsifyjs/awesome-docsify#showcase)
- Push to the branch: `git push origin my-new-feature`
- Submit a pull request
+
## Development
```bash
-npm run bootstrap && npm run dev
+npm i && npm run dev
+open http://localhost:3000
```
-## Backers
-
-Thank you to all our backers! 🙏 [[Become a backer](https://opencollective.com/docsify#backers)]
-
-
-
-## Sponsors
-
-Support this project by becoming a sponsor. Your logo will show up here with a link to your website. [[Become a sponsor](https://opencollective.com/docsify#silver-sponsors)]
-
-
-
-
-
-
-
-
-
-
-
-
-## Contributors
-
-This project exists thanks to all the people who contribute. [[Contribute](CONTRIBUTING.md)].
-
-
## License
-
-[MIT](LICENSE)
-
-[](https://app.fossa.io/projects/git%2Bhttps%3A%2F%2Fgithub.com%2Fdocsifyjs%2Fdocsify?ref=badge_large)
+MIT
diff --git a/app.js b/app.js
new file mode 100644
index 0000000..beada16
--- /dev/null
+++ b/app.js
@@ -0,0 +1,12 @@
+var serveStatic = require('serve-static')
+var http = require('http')
+var fs = require('fs')
+
+http.createServer(function (req, res) {
+ serveStatic('.')(req, res, function () {
+ res.writeHead(404, { 'Content-Type': 'text/html' })
+ res.end(fs.readFileSync('dev.html'))
+ })
+}).listen(3000, '0.0.0.0')
+
+console.log(`\nListening at http://0.0.0.0:3000\n`)
diff --git a/build/build-css.js b/build/build-css.js
new file mode 100644
index 0000000..40672e0
--- /dev/null
+++ b/build/build-css.js
@@ -0,0 +1,47 @@
+var fs = require('fs')
+var cssnano = require('cssnano').process
+var resolve = require('path').resolve
+var postcss = require('postcss')
+var isProd = process.argv[process.argv.length - 1] !== '--dev'
+
+var processor = postcss([require('postcss-salad')({
+ features: {
+ precss: {
+ properties: {
+ preserve: true
+ }
+ }
+ }
+})])
+
+var saveMin = function (file, content) {
+ fs.writeFileSync(resolve(__dirname, '../lib/themes/', file), content)
+}
+var save = function (file, content) {
+ fs.writeFileSync(resolve(__dirname, '../themes/', file), content)
+}
+var load = function (file) {
+ return fs.readFileSync(resolve(__dirname, '../src/themes/', file)).toString()
+}
+var loadLib = function (file) {
+ return fs.readFileSync(resolve(__dirname, '../themes/', file)).toString()
+}
+
+var list = fs.readdirSync(resolve(__dirname, '../src/themes'))
+
+list.forEach(function (file) {
+ if (!/\.css$/.test(file)) return
+ processor.process(load(file), { from: resolve(__dirname, '../src/themes/', file) })
+ .then(function (result) {
+ save(file, result.css)
+ console.log('salad - ' + file)
+ isProd && cssnano(loadLib(file))
+ .then(function (result) {
+ saveMin(file, result.css)
+ console.log('cssnao - ' + file)
+ })
+ }).catch(function (err) {
+ console.log(err)
+ })
+})
+
diff --git a/build/build.js b/build/build.js
index 7b61224..a64089b 100644
--- a/build/build.js
+++ b/build/build.js
@@ -1,119 +1,62 @@
-const rollup = require('rollup')
-const buble = require('rollup-plugin-buble')
-const commonjs = require('rollup-plugin-commonjs')
-const nodeResolve = require('rollup-plugin-node-resolve')
-const uglify = require('rollup-plugin-uglify')
-const replace = require('rollup-plugin-replace')
-const isProd = process.env.NODE_ENV === 'production'
-const version = process.env.VERSION || require('../package.json').version
-const chokidar = require('chokidar')
-const path = require('path')
+var rollup = require('rollup')
+var buble = require('rollup-plugin-buble')
+var commonjs = require('rollup-plugin-commonjs')
+var nodeResolve = require('rollup-plugin-node-resolve')
+var uglify = require('rollup-plugin-uglify')
+var isProd = process.argv[process.argv.length - 1] !== '--dev'
-const build = function (opts) {
+var build = function (opts) {
rollup
.rollup({
- input: opts.input,
- plugins: (opts.plugins || []).concat([
- buble(),
- commonjs(),
- nodeResolve(),
- replace({
- __VERSION__: version,
- 'process.env.SSR': false
- })
- ])
+ entry: 'src/' + opts.entry,
+ plugins: [buble(), commonjs(), nodeResolve()].concat(opts.plugins || [])
})
.then(function (bundle) {
- var dest = 'lib/' + (opts.output || opts.input)
+ var dest = 'lib/' + (opts.output || opts.entry)
console.log(dest)
bundle.write({
format: 'iife',
- file: dest,
- strict: false
+ moduleName: opts.moduleName || 'D',
+ dest: dest
})
})
.catch(function (err) {
console.error(err)
})
}
-const buildCore = function () {
+
+build({
+ entry: 'core/index.js',
+ output: 'docsify.js'
+})
+
+var plugins = [
+ { name: 'search', entry: 'search/index.js', moduleName: 'Search' },
+ { name: 'ga', entry: 'ga.js', moduleName: 'GA' }
+ // { name: 'front-matter', entry: 'front-matter/index.js', moduleName: 'FrontMatter' }
+]
+
+plugins.forEach(item => {
build({
- input: 'src/core/index.js',
- output: 'docsify.js'
+ entry: 'plugins/' + item.entry,
+ output: 'plugins/' + item.name + '.js',
+ moduleName: 'D.' + item.moduleName
})
+})
- if (isProd) {
- build({
- input: 'src/core/index.js',
- output: 'docsify.min.js',
- plugins: [uglify()]
- })
- }
-}
-const buildAllPlugin = function () {
- var plugins = [
- {name: 'search', input: 'search/index.js'},
- {name: 'ga', input: 'ga.js'},
- {name: 'matomo', input: 'matomo.js'},
- {name: 'emoji', input: 'emoji.js'},
- {name: 'external-script', input: 'external-script.js'},
- {name: 'front-matter', input: 'front-matter/index.js'},
- {name: 'zoom-image', input: 'zoom-image.js'},
- {name: 'disqus', input: 'disqus.js'},
- {name: 'gitalk', input: 'gitalk.js'}
- ]
-
+if (isProd) {
+ build({
+ entry: 'core/index.js',
+ output: 'docsify.min.js',
+ plugins: [uglify()]
+ })
plugins.forEach(item => {
build({
- input: 'src/plugins/' + item.input,
- output: 'plugins/' + item.name + '.js'
+ entry: 'plugins/' + item.entry,
+ output: 'plugins/' + item.name + '.min.js',
+ moduleName: 'D.' + item.moduleName,
+ plugins: [uglify()]
})
})
-
- if (isProd) {
- plugins.forEach(item => {
- build({
- input: 'src/plugins/' + item.input,
- output: 'plugins/' + item.name + '.min.js',
- plugins: [uglify()]
- })
- })
- }
-}
-
-if (!isProd) {
- chokidar
- .watch(['src/core', 'src/plugins'], {
- atomic: true,
- awaitWriteFinish: {
- stabilityThreshold: 1000,
- pollInterval: 100
- }
- })
- .on('change', p => {
- console.log('[watch] ', p)
- const dirs = p.split(path.sep)
- if (dirs[1] === 'core') {
- buildCore()
- } else if (dirs[2]) {
- const name = path.basename(dirs[2], '.js')
- const input = `src/plugins/${name}${
- /\.js/.test(dirs[2]) ? '' : '/index'
- }.js`
-
- build({
- input,
- output: 'plugins/' + name + '.js'
- })
- }
- })
- .on('ready', () => {
- console.log('[start]')
- buildCore()
- buildAllPlugin()
- })
-} else {
- buildCore()
- buildAllPlugin()
}
diff --git a/build/cover.js b/build/cover.js
deleted file mode 100644
index fbd27f7..0000000
--- a/build/cover.js
+++ /dev/null
@@ -1,14 +0,0 @@
-var fs = require('fs')
-var read = fs.readFileSync
-var write = fs.writeFileSync
-var version = process.env.VERSION || require('../package.json').version
-
-var file = __dirname + '/../docs/_coverpage.md'
-var cover = read(file, 'utf8').toString()
-
-console.log('Replace version number in cover page...')
-cover = cover.replace(
- /(\S+)?<\/small>/g,
- '' + version + ''
-)
-write(file, cover)
diff --git a/build/mincss.js b/build/mincss.js
deleted file mode 100644
index f6c5ec2..0000000
--- a/build/mincss.js
+++ /dev/null
@@ -1,12 +0,0 @@
-const cssnano = require('cssnano').process
-const path = require('path')
-const fs = require('fs')
-
-files = fs.readdirSync(path.resolve('lib/themes'))
-
-files.forEach(file => {
- file = path.resolve('lib/themes', file)
- cssnano(fs.readFileSync(file)).then(result => {
- fs.writeFileSync(file, result.css)
- })
-})
diff --git a/build/release.sh b/build/release.sh
deleted file mode 100755
index a328322..0000000
--- a/build/release.sh
+++ /dev/null
@@ -1,50 +0,0 @@
-set -e
-
-if [[ -z $1 ]]; then
- echo "Enter new version: "
- read VERSION
-else
- VERSION=$1
-fi
-
-read -p "Releasing $VERSION $RELEASE_TAG - are you sure? (y/n) " -n 1 -r
-echo
-if [[ $REPLY =~ ^[Yy]$ ]]; then
- echo "Releasing $VERSION ..."
-
- npm run test
-
- # build
- VERSION=$VERSION npm run build
-
- # update packages
- cd packages/docsify-server-renderer
- npm version $VERSION
- if [[ -z $RELEASE_TAG ]]; then
- npm publish
- else
- npm publish --tag $RELEASE_TAG
- fi
- cd -
-
- # commit
- git add -A
- git commit -m "[build] $VERSION $RELEASE_TAG"
- npm --no-git-tag-version version $VERSION --message "[release] $VERSION $RELEASE_TAG"
-
- # changelog
- node_modules/.bin/conventional-changelog -p angular -i CHANGELOG.md -s
-
- git add .
- git commit -m "chore: add changelog $VERSION"
-
- # publish
- git tag v$VERSION
- git push origin refs/tags/v$VERSION
- git push
- if [[ -z $RELEASE_TAG ]]; then
- npm publish
- else
- npm publish --tag $RELEASE_TAG
- fi
-fi
diff --git a/build/ssr.js b/build/ssr.js
deleted file mode 100644
index 16b93ca..0000000
--- a/build/ssr.js
+++ /dev/null
@@ -1,34 +0,0 @@
-var rollup = require('rollup')
-var buble = require('rollup-plugin-buble')
-var async = require('rollup-plugin-async')
-var replace = require('rollup-plugin-replace')
-
-rollup
- .rollup({
- input: 'packages/docsify-server-renderer/index.js',
- plugins: [
- async(),
- replace({
- __VERSION__: process.env.VERSION || require('../package.json').version,
- 'process.env.SSR': true
- }),
- buble({
- transforms: {
- generator: false
- }
- })
- ],
- onwarn: function () {}
- })
- .then(function (bundle) {
- var dest = 'packages/docsify-server-renderer/build.js'
-
- console.log(dest)
- bundle.write({
- format: 'cjs',
- file: dest
- })
- })
- .catch(function (err) {
- console.error(err)
- })
diff --git a/dev.html b/dev.html
new file mode 100644
index 0000000..d928711
--- /dev/null
+++ b/dev.html
@@ -0,0 +1,34 @@
+
+
+
+
+ docsify
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/docs/README.md b/docs/README.md
index e625420..203b496 100644
--- a/docs/README.md
+++ b/docs/README.md
@@ -2,31 +2,26 @@
> A magical documentation site generator.
-## What it is
+## What is it
-docsify generates your documentation website on the fly. Unlike GitBook, it does not generate static html files. Instead, it smartly loads and parses your Markdown files and displays them as a website. To start using it, all you need to do is create an `index.html` and [deploy it on GitHub Pages](deploy.md).
+docsify generates your documentation website on the fly. Unlike GitBook, it does not generate static html files. Instead, it smartly loads and parses your Markdown files and displays them as website. All you need to do is create an `index.html` to start and [deploy it on GitHub Pages](/deploy).
-See the [Quick start](quickstart.md) guide for more details.
+See the [Quick start](/quickstart) for more details.
## Features
- No statically built html files
-- Simple and lightweight (~21kB gzipped)
+- Simple and lightweight (~14kB gzipped)
- Smart full-text search plugin
- Multiple themes
- Useful plugin API
-- Emoji support
-- Compatible with IE11
-- Support server-side rendering ([example](https://github.com/docsifyjs/docsify-ssr-demo))
+- Compatible with IE10+
## Examples
-Check out the [Showcase](https://github.com/docsifyjs/awesome-docsify#showcase) to see docsify in use.
+Check out the [Showcase](https://github.com/QingWei-Li/docsify/#showcase) to docsify in use.
## Donate
Please consider donating if you think docsify is helpful to you or that my work is valuable. I am happy if you can help me [buy a cup of coffee](https://github.com/QingWei-Li/donate). :heart:
-## Community
-
-Users and the development team are usually in the [Gitter chat room](https://gitter.im/docsifyjs/Lobby).
diff --git a/docs/_coverpage.md b/docs/_coverpage.md
index 1decbd6..050d427 100644
--- a/docs/_coverpage.md
+++ b/docs/_coverpage.md
@@ -1,12 +1,13 @@

-# docsify 4.9.4
+# docsify 3.0
> A magical documentation site generator.
-- Simple and lightweight (~21kB gzipped)
+- Simple and lightweight (~14kB gzipped)
- No statically built html files
- Multiple themes
-[GitHub](https://github.com/docsifyjs/docsify/)
-[Getting Started](#docsify)
+
+[GitHub](https://github.com/QingWei-Li/docsify/)
+[Get Started](#docsify)
diff --git a/docs/_media/example.html b/docs/_media/example.html
deleted file mode 100644
index d35ee16..0000000
--- a/docs/_media/example.html
+++ /dev/null
@@ -1 +0,0 @@
-
To infinity and Beyond!
\ No newline at end of file
diff --git a/docs/_media/example.js b/docs/_media/example.js
deleted file mode 100644
index 7b6f668..0000000
--- a/docs/_media/example.js
+++ /dev/null
@@ -1,16 +0,0 @@
-import fetch from 'fetch'
-
-const URL = 'https://example.com'
-const PORT = 8080
-
-/// [demo]
-const result = fetch(`${URL}:${PORT}`)
- .then(function(response) {
- return response.json();
- })
- .then(function(myJson) {
- console.log(JSON.stringify(myJson));
- });
-/// [demo]
-
-result.then(console.log).catch(console.error)
diff --git a/docs/_media/example.md b/docs/_media/example.md
deleted file mode 100644
index 6ee6494..0000000
--- a/docs/_media/example.md
+++ /dev/null
@@ -1 +0,0 @@
-> This is from the `example.md`
diff --git a/docs/_navbar.md b/docs/_navbar.md
deleted file mode 100644
index 47a2356..0000000
--- a/docs/_navbar.md
+++ /dev/null
@@ -1,6 +0,0 @@
-- Translations
- - [:uk: English](/)
- - [:cn: 中文](/zh-cn/)
- - [:de: Deutsch](/de-de/)
- - [:es: Spanish](/es/)
- - [:ru: Russian](/ru/)
diff --git a/docs/_sidebar.md b/docs/_sidebar.md
index 051514b..7e666dc 100644
--- a/docs/_sidebar.md
+++ b/docs/_sidebar.md
@@ -1,28 +1,20 @@
- Getting started
-
- - [Quick start](quickstart.md)
- - [Writing more pages](more-pages.md)
- - [Custom navbar](custom-navbar.md)
- - [Cover page](cover.md)
+ - [Quick start](/quickstart)
+ - [Writing more pages](/more-pages)
+ - [Custom navbar](/custom-navbar)
+ - [Cover page](/cover)
- Customization
-
- - [Configuration](configuration.md)
- - [Themes](themes.md)
- - [List of Plugins](plugins.md)
- - [Write a Plugin](write-a-plugin.md)
- - [Markdown configuration](markdown.md)
- - [Language highlighting](language-highlight.md)
+ - [Configuration](/configuration)
+ - [Themes](/themes)
+ - [Using plugins](/plugins)
+ - [Markdown configuration](/markdown)
+ - [Lanuage highlighting](/language-highlight)
- Guide
+ - [Deploy](/deploy)
+ - [Helpers](/helpers)
+ - [Vue compatibility](/vue)
+ - [CDN](/cdn)
- - [Deploy](deploy.md)
- - [Helpers](helpers.md)
- - [Vue compatibility](vue.md)
- - [CDN](cdn.md)
- - [Offline Mode(PWA)](pwa.md)
- - [Server-Side Rendering(SSR)](ssr.md)
- - [Embed Files](embed-files.md)
-
-- [Awesome docsify](awesome.md)
-- [Changelog](changelog.md)
+- [Changelog](/changelog)
\ No newline at end of file
diff --git a/docs/cdn.md b/docs/cdn.md
index eba77a8..1e0b2ec 100644
--- a/docs/cdn.md
+++ b/docs/cdn.md
@@ -2,8 +2,10 @@
Recommended: [unpkg](//unpkg.com), which will reflect the latest version as soon as it is published to npm. You can also browse the source of the npm package at [unpkg.com/docsify/](//unpkg.com/docsify/).
+
## Latest version
+
```html
@@ -12,10 +14,9 @@ Recommended: [unpkg](//unpkg.com), which will reflect the latest version as soon
```
-Alternatively, use [compressed files](#compressed-file).
-
## Specific version
+
```html
@@ -26,6 +27,7 @@ Alternatively, use [compressed files](#compressed-file).
## Compressed file
+
```html
@@ -34,17 +36,7 @@ Alternatively, use [compressed files](#compressed-file).
```
-```html
-
-
-
-
-
-```
-
## Other CDN
-- http://www.bootcdn.cn/docsify
-- https://cdn.jsdelivr.net/npm/docsify/
-- https://cdnjs.com/libraries/docsify
+[jsDelivr](http://www.jsdelivr.com/projects/docsify) is available.
diff --git a/docs/configuration.md b/docs/configuration.md
index ba48475..26e3f0d 100644
--- a/docs/configuration.md
+++ b/docs/configuration.md
@@ -1,17 +1,30 @@
# Configuration
-You can configure the `window.$docsify`.
+docsify supports two ways to configure. You can configure the `window.$docsify` or write configuration on the script tag via `data-*` attributes.
```html
+
+
+
+
```
+Both ways are compatible. However, the first way is recommended. It is clear and can be configured in a separate file.
+
+!> In `window.$docsfiy`, the options should be written by camelCase.
+
## el
- Type: `String`
@@ -22,7 +35,7 @@ The DOM element to be mounted on initialization. It can be a CSS selector string
```js
window.$docsify = {
el: '#app'
-};
+}
```
## repo
@@ -34,13 +47,14 @@ Configure the repository url or a string of `username/repo` can add the [GitHub
```js
window.$docsify = {
- repo: 'docsifyjs/docsify',
+ repo: 'QingWei-Li/docsify',
// or
- repo: 'https://github.com/docsifyjs/docsify/'
-};
+ repo: 'https://github.com/QingWei-Li/docsify/'
+}
```
-## maxLevel
+
+## max-level
- Type: `Number`
- Default: `6`
@@ -50,15 +64,15 @@ Maximum Table of content level.
```js
window.$docsify = {
maxLevel: 4
-};
+}
```
-## loadNavbar
+## load-navbar
- Type: `Boolean|String`
- Default: `false`
-Loads navbar from the Markdown file `_navbar.md` if **true**, or else from the path specified.
+Load navbar from Markdown file. If **true** it will be loaded from `_navbar.md`.
```js
window.$docsify = {
@@ -67,15 +81,16 @@ window.$docsify = {
// load from nav.md
loadNavbar: 'nav.md'
-};
+}
```
-## loadSidebar
+## load-sidebar
- Type: `Boolean|String`
- Default: `false`
-Loads sidebar from the Markdown file `_sidebar.md` if **true**, or else from the path specified.
+
+Load sidebar from Markdown file. If **true** it will be loaded from `_sidebar.md`.
```js
window.$docsify = {
@@ -84,40 +99,44 @@ window.$docsify = {
// load from summary.md
loadSidebar: 'summary.md'
-};
+}
```
-## subMaxLevel
+## sub-max-level
- Type: `Number`
- Default: `0`
-Add table of contents (TOC) in custom sidebar.
+Add TOC in custom sidebar.
```js
window.$docsify = {
subMaxLevel: 2
-};
+}
```
+
## auto2top
- Type: `Boolean`
- Default: `false`
+
Scrolls to the top of the screen when the route is changed.
```js
window.$docsify = {
auto2top: true
-};
+}
```
+
## homepage
- Type: `String`
- Default: `README.md`
+
`README.md` in your docs folder will be treated as homepage for your website, but sometimes you may need to serve another file as your homepage.
```js
@@ -126,12 +145,11 @@ window.$docsify = {
homepage: 'home.md',
// Or use the readme in your repo
- homepage:
- 'https://raw.githubusercontent.com/docsifyjs/docsify/master/README.md'
-};
+ homepage: 'https://raw.githubusercontent.com/QingWei-Li/docsify/master/README.md'
+}
```
-## basePath
+## base-path
- Type: `String`
@@ -145,101 +163,41 @@ window.$docsify = {
basePath: 'https://docsify.js.org/',
// Even can load files from other repo
- basePath:
- 'https://raw.githubusercontent.com/ryanmcdermott/clean-code-javascript/master/'
-};
+ basePath: 'https://raw.githubusercontent.com/ryanmcdermott/clean-code-javascript/master/'
+}
```
-## relativePath
-
-- Type: `Boolean`
-- Default: `false`
-
-If **true** links are relative to the current context.
-
-For example, the directory structure is as follows:
-
-```text
-.
-└── docs
- ├── README.md
- ├── guide.md
- └── zh-cn
- ├── README.md
- ├── guide.md
- └── config
- └── example.md
-```
-
-With relative path **enabled** and current URL `http://domain.com/zh-cn/README`, given links will resolve to:
-
-```text
-guide.md => http://domain.com/zh-cn/guide
-config/example.md => http://domain.com/zh-cn/config/example
-../README.md => http://domain.com/README
-/README.md => http://domain.com/README
-```
-
-```js
-window.$docsify = {
- // Relative path enabled
- relativePath: true,
-
- // Relative path disabled (default value)
- relativePath: false
-};
-```
## coverpage
-- Type: `Boolean|String|String[]|Object`
+- Type: `Boolean|String`
- Default: `false`
-Activate the [cover feature](cover.md). If true, it will load from `_coverpage.md`.
+Activate the [cover feature](/cover). If ture, it will load from `_coverpage.md`.
```js
window.$docsify = {
coverpage: true,
// Custom file name
- coverpage: 'cover.md',
-
- // mutiple covers
- coverpage: ['/', '/zh-cn/'],
-
- // mutiple covers and custom file name
- coverpage: {
- '/': 'cover.md',
- '/zh-cn/': 'cover.md'
- }
-};
-```
-
-## logo
-
-- Type: `String`
-
-Website logo as it appears in the sidebar, you can resize by CSS.
-
-```js
-window.$docsify = {
- logo: '/_media/icon.svg'
-};
+ coverpage: 'cover.md'
+}
```
## name
- Type: `String`
-Website name as it appears in the sidebar.
+
+Website name appears in the sidebar.
```js
window.$docsify = {
name: 'docsify'
-};
+}
```
-## nameLink
+## name-link
- Type: `String`
- Default: `window.location.pathname`
@@ -248,21 +206,16 @@ The name of the link.
```js
window.$docsify = {
- nameLink: '/',
-
- // For each route
- nameLink: {
- '/zh-cn/': '/zh-cn/',
- '/': '/'
- }
-};
+ nameLink: '/'
+}
```
## markdown
- Type: `Function`
-See [Markdown configuration](markdown.md).
+See [Markdown configuration](/markdown).
+
```js
window.$docsify = {
@@ -277,66 +230,65 @@ window.$docsify = {
},
// function
- markdown: function(marked, renderer) {
+ markdown: function (marked, renderer) {
// ...
- return marked;
+ return marked
}
-};
+}
```
-## themeColor
+## theme-color
- Type: `String`
-Customize the theme color. Use [CSS3 variables](https://developer.mozilla.org/en-US/docs/Web/CSS/Using_CSS_variables) feature and polyfill in old browser.
+Customize the theme color.
+Use [CSS3 variables](https://developer.mozilla.org/en-US/docs/Web/CSS/Using_CSS_variables) feature and polyfill in old browser.
```js
window.$docsify = {
themeColor: '#3F51B5'
-};
+}
```
## alias
- Type: `Object`
-Set the route alias. You can freely manage routing rules. Supports RegExp.
+
+Set the route alias. You can freely manage routing rules.
```js
window.$docsify = {
alias: {
- '/foo/(+*)': '/bar/$1', // supports regexp
'/zh-cn/changelog': '/changelog',
- '/changelog':
- 'https://raw.githubusercontent.com/docsifyjs/docsify/master/CHANGELOG',
- '/.*/_sidebar.md': '/_sidebar.md' // See #301
+ '/changelog': 'https://raw.githubusercontent.com/QingWei-Li/docsify/master/CHANGELOG'
}
-};
+}
```
-## autoHeader
+## auto-header
- type: `Boolean`
-If `loadSidebar` and `autoHeader` are both enabled, for each link in `_sidebar.md`, prepend a header to the page before converting it to html. Compare [#78](https://github.com/docsifyjs/docsify/issues/78).
+If `loadSidebar` and `autoHeader` are both enabled, for each link in _sidebar.md, prepend a header to the page before converting it to html. [#78](https://github.com/QingWei-Li/docsify/issues/78)
```js
window.$docsify = {
loadSidebar: true,
autoHeader: true
-};
+}
```
-## executeScript
+## execute-script
- type: `Boolean`
-Execute the script on the page. Only parse the first script tag([demo](themes)). If Vue is present, it is turned on by default.
+Execute the script on the page. Only parse the first script tag([demo](themes)). If Vue is present, it is turned on by default.
```js
window.$docsify = {
executeScript: true
-};
+}
```
```markdown
@@ -345,174 +297,6 @@ window.$docsify = {
+
```
-Note that if you are running an external script, e.g. an embedded jsfiddle demo, make sure to include the [external-script](plugins.md?id=external-script) plugin.
-
-## noEmoji
-
-- type: `Boolean`
-
-Disabled emoji parse.
-
-```js
-window.$docsify = {
- noEmoji: true
-};
-```
-
-## mergeNavbar
-
-- type: `Boolean`
-
-Navbar will be merged with the sidebar on smaller screens.
-
-```js
-window.$docsify = {
- mergeNavbar: true
-};
-```
-
-## formatUpdated
-
-- type: `String|Function`
-
-We can display the file update date through **{docsify-updated}** variable. And format it by `formatUpdated`.
-See https://github.com/lukeed/tinydate#patterns
-
-```js
-window.$docsify = {
- formatUpdated: '{MM}/{DD} {HH}:{mm}',
-
- formatUpdated: function(time) {
- // ...
-
- return time;
- }
-};
-```
-
-## externalLinkTarget
-
-- type: `String`
-- default: `_blank`
-
-Target to open external links. Default `'_blank'` (new window/tab)
-
-```js
-window.$docsify = {
- externalLinkTarget: '_self' // default: '_blank'
-};
-```
-
-## routerMode
-
-- type: `String`
-- default: `hash`
-
-```js
-window.$docsify = {
- routerMode: 'history' // default: 'hash'
-};
-```
-
-## noCompileLinks
-
-- type: `Array`
-
-Sometimes we do not want docsify to handle our links. See [#203](https://github.com/docsifyjs/docsify/issues/203)
-
-```js
-window.$docsify = {
- noCompileLinks: ['/foo', '/bar/.*']
-};
-```
-
-## onlyCover
-
-- type: `Boolean`
-
-Only coverpage is loaded when visiting the home page.
-
-```js
-window.$docsify = {
- onlyCover: false
-};
-```
-
-## requestHeaders
-
-- type: `Object`
-
-Set the request resource headers.
-
-```js
-window.$docsify = {
- requestHeaders: {
- 'x-token': 'xxx'
- }
-};
-```
-
-## ext
-
-- type: `String`
-
-Request file extension.
-
-```js
-window.$docsify = {
- ext: '.md'
-};
-```
-
-## fallbackLanguages
-
-- type: `Array`
-
-List of languages that will fallback to the default language when a page is request and didn't exists for the given local.
-
-Example:
-
-- try to fetch the page of `/de/overview`. If this page exists, it'll be displayed
-- then try to fetch the default page `/overview` (depending on the default language). If this page exists, it'll be displayed
-- then display 404 page.
-
-```js
-window.$docsify = {
- fallbackLanguages: ['fr', 'de']
-};
-```
-
-## notFoundPage
-
-- type: `Boolean` | `String` | `Object`
-
-Load the `_404.md` file:
-
-```js
-window.$docsify = {
- notFoundPage: true
-};
-```
-
-Load the customised path of the 404 page:
-
-```js
-window.$docsify = {
- notFoundPage: 'my404.md'
-};
-```
-
-Load the right 404 page according to the localisation:
-
-```js
-window.$docsify = {
- notFoundPage: {
- '/': '_404.md',
- '/de': 'de/_404.md'
- }
-};
-```
-
-> Note: The options with fallbackLanguages didn't work with the `notFoundPage` options.
diff --git a/docs/cover.md b/docs/cover.md
index 555f4ff..e633e8f 100644
--- a/docs/cover.md
+++ b/docs/cover.md
@@ -1,6 +1,6 @@
# Cover
-Activate the cover feature by setting `coverpage` to **true**, compare [coverpage configuration](configuration.md#coverpage).
+Activate the cover feature by setting `coverpage` to **true**. Details are available in the [coverpage configuration paragraph](configuration#coverpage).
## Basic usage
@@ -14,86 +14,44 @@ Set `coverpage` to **true**, and create a `_coverpage.md`:
coverpage: true
}
-
+
```
+
```markdown

-# docsify 3.5
+# docsify 3.0
> A magical documentation site generator.
-- Simple and lightweight (~21kB gzipped)
+- Simple and lightweight (~14kB gzipped)
- No statically built html files
- Multiple themes
-[GitHub](https://github.com/docsifyjs/docsify/)
+
+[GitHub](https://github.com/QingWei-Li/docsify/)
[Get Started](#docsify)
```
-!> A document site can have only one coverpage!
+!> A document site can have only one cover page.
## Custom background
-The background color is generated randomly by default. You can customize the background color or a background image:
+The background color is generated randomly by default. You can customize the background color or image:
```markdown
-# docsify 3.5
+# docsify
-[GitHub](https://github.com/docsifyjs/docsify/)
+[GitHub](https://github.com/QingWei-Li/docsify/)
[Get Started](#quick-start)
-

-
-

```
-
-## Coverpage as homepage
-
-Normally, the coverpage and the homepage appear at the same time. Of course, you can also separate the coverpage by [onlyCover option](configuration.md#onlycover).
-
-## Multiple covers
-
-If your docs site is in more than one language, it may be useful to set multiple covers.
-
-For example, your docs structure is like this
-
-```text
-.
-└── docs
- ├── README.md
- ├── guide.md
- ├── _coverpage.md
- └── zh-cn
- ├── README.md
- └── guide.md
- └── _coverpage.md
-```
-
-Now, you can set
-
-```js
-window.$docsify = {
- coverpage: ['/', '/zh-cn/']
-};
-```
-
-Or a special file name
-
-```js
-window.$docsify = {
- coverpage: {
- '/': 'cover.md',
- '/zh-cn/': 'cover.md'
- }
-};
-```
diff --git a/docs/custom-navbar.md b/docs/custom-navbar.md
index 324ad81..40be703 100644
--- a/docs/custom-navbar.md
+++ b/docs/custom-navbar.md
@@ -2,9 +2,7 @@
## HTML
-If you need custom navigation, you can create a HTML-based navigation bar.
-
-!> Note that documentation links begin with `#/`.
+If you need custom navigation, you can create a HTML-based navigation bar (but note that documentation links begin with `#/`).
```html
@@ -20,7 +18,7 @@ If you need custom navigation, you can create a HTML-based navigation bar.
## Markdown
-Alternatively, you can create a custom markdown-based navigation file by setting `loadNavbar` to **true** and creating `_navbar.md`, compare [loadNavbar configuration](configuration.md#loadnavbar).
+Alternatively, you can create a custom markdown-based navigation file by setting `loadNavbar` to **true** and creating `_navbar.md`. Details are available in the [load-navbar configuration paragraph](configuration#load-navbar).
```html
@@ -30,19 +28,20 @@ Alternatively, you can create a custom markdown-based navigation file by setting
loadNavbar: true
}
-
+
```
+
```markdown
-* [En](/)
-* [chinese](/zh-cn/)
+- [En](/)
+- [chinese](/zh-cn/)
```
!> You need to create a `.nojekyll` in `./docs` to prevent GitHub Pages from ignoring files that begin with an underscore.
-`_navbar.md` is loaded from each level directory. If the current directory doesn't have `_navbar.md`, it will fall back to the parent directory. If, for example, the current path is `/guide/quick-start`, the `_navbar.md` will be loaded from `/guide/_navbar.md`.
+`_navbar.md` is loaded from each level directory. If the current directory doesn't have `_navbar.md`, it will fall back to the parent directory. If, for example, the current path is `/guide/quick-start`, the `_navbar.md` will be loaded from `/guide/_navbar.md`.
## Nesting
@@ -51,46 +50,22 @@ You can create sub-lists by indenting items that are under a certain parent.
```markdown
-* Getting started
+- Getting started
+ - [Quick start](/quickstart)
+ - [Writing more pages](/more-pages)
+ - [Custom navbar](/custom-navbar)
+ - [Cover page](/cover)
- * [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)
+- Configuration
+ - [Configuration](/configuration)
+ - [Themes](/themes)
+ - [Using plugins](/plugins)
+ - [Markdown configuration](/markdown)
+ - [Lanuage highlight](/language-highlight)
```
renders as
-
+
-## Combining custom navbars with the emoji plugin
-If you use the [emoji plugin](plugins#emoji):
-
-```html
-
-
-
-
-
-```
-
-you could, for example, use flag emojis in your custom navbar Markdown file:
-
-```markdown
-
-
-* [:us:, :uk:](/)
-* [:cn:](/zh-cn/)
-```
diff --git a/docs/deploy.md b/docs/deploy.md
index a879f2e..ed25b02 100644
--- a/docs/deploy.md
+++ b/docs/deploy.md
@@ -1,62 +1,20 @@
# Deploy
-Similar to [GitBook](https://www.gitbook.com), you can deploy files to GitHub Pages, GitLab Pages or VPS.
+As as GitBook, you can deploy files to GitHub Pages or VPS.
## GitHub Pages
-There're three places to populate your docs for your Github repository:
+There're three places to populate your docs
- `docs/` folder
- master branch
- gh-pages branch
-It is recommended that you save your files to the `./docs` subfolder of the `master` branch of your repository. Then select `master branch /docs folder` as your Github Pages source in your repositories' settings page.
+You can save your files in `./docs` and setting `master branch /docs folder`.

!> You can also save files in the root directory and select `master branch`.
-You'll need to place a `.nojekyll` file in the deploy location (such as `/docs` or the gh-pages branch)
-
-## GitLab Pages
-
-If you are deploying your master branch, include `.gitlab-ci.yml` with the following script:
-
-?> The `.public` workaround is so `cp` doesn't also copy `public/` to itself in an infinite loop.
-
-```YAML
-pages:
- stage: deploy
- script:
- - mkdir .public
- - cp -r * .public
- - mv .public public
- artifacts:
- paths:
- - public
- only:
- - master
-```
-
-!> You can replace script with `- cp -r docs/. public`, if `./docs` is your Docsify subfolder.
-
-## Firebase Hosting
-
-!> You'll need to install the Firebase CLI using `npm i -g firebase-tools` after signing into the [Firebase Console](https://console.firebase.google.com) using a Google Account.
-
-Using Terminal determine and navigate to the directory for your Firebase Project - this could be `~/Projects/Docs` etc. From there, run `firebase init`, choosing `Hosting` from the menu (use **space** to select, **arrow keys** to change options and **enter** to confirm). Follow the setup instructions.
-
-You should have your `firebase.json` file looking similar to this (I changed the deployment directory from `public` to `site`):
-
-```json
-{
- "hosting": {
- "public": "site",
- "ignore": ["firebase.json", "**/.*", "**/node_modules/**"]
- }
-}
-```
-
-Once finished, build the starting template by running `docsify init ./site` (replacing site with the deployment directory you determined when running `firebase init` - public by default). Add/edit the documentation, then run `firebase deploy` from the base project directory.
## VPS
@@ -68,64 +26,8 @@ server {
server_name your.domain.com;
location / {
- alias /path/to/dir/of/docs/;
+ alias /path/to/dir/of/docs;
index index.html;
}
}
```
-
-## Netlify
-
-1. Login to your [Netlify](https://www.netlify.com/) account.
-2. In the [dashboard](https://app.netlify.com/) page, click **New site from Git**.
-3. Choose a repository where you store your docs, leave the **Build Command** area blank, fill in the Publish directory area with the directory of your `index.html`, for example it should be docs if you populated it at `docs/index.html`.
-
-### HTML5 router
-
-When using the HTML5 router, you need to set up redirect rules that redirect all requests to your `index.html`, it's pretty simple when you're using Netlify, populate a `\redirects` file in the docs directory and you're all set:
-
-```sh
-/* /index.html 200
-```
-
-## AWS Amplify
-
-1. Set the routerMode in the Docsify project `index.html` to *history* mode.
-
-```html
-
-```
-
-2. Login to your [AWS Console](https://aws.amazon.com).
-3. Go to the [AWS Amplify Dashboard](https://aws.amazon.com/amplify).
-4. Choose the **Deploy** route to setup your project.
-5. When prompted, keep the build settings empty if you're serving your docs within the root directory. If you're serving your docs from a different directory, customise your amplify.yml
-
-```yml
-version: 0.1
-frontend:
- phases:
- build:
- commands:
- - echo "Nothing to build"
- artifacts:
- baseDirectory: /docs
- files:
- - '**/*'
- cache:
- paths: []
-
-```
-
-6. Add the following Redirect rules in their displayed order.
-
-| Source address | Target address | Type |
-|----------------|----------------|---------------|
-| /<*>.md | /<*>.md | 200 (Rewrite) |
-| /<*> | /index.html | 200 (Rewrite) |
-
diff --git a/docs/embed-files.md b/docs/embed-files.md
deleted file mode 100644
index dab2efe..0000000
--- a/docs/embed-files.md
+++ /dev/null
@@ -1,81 +0,0 @@
-# Embed files
-
-With docsify 4.6 it is now possible to embed any type of file.
-You can embed these files as video, audio, iframes, or code blocks, and even Markdown files can even be embedded directly into the document.
-
-For example, here embedded a Markdown file. You only need to do this:
-
-```markdown
-[filename](_media/example.md ':include')
-```
-
-Then the content of `example.md` will be displayed directly here
-
-[filename](_media/example.md ':include')
-
-You can check the original content for [example.md](_media/example.md ':ignore').
-
-Normally, this will compiled into a link, but in docsify, if you add `:include` it will be embedded.
-
-## Embedded file type
-
-Currently, file extension are automatically recognized and embedded in different ways.
-
-This is a supported embedding type:
-
-* **iframe** `.html`, `.htm`
-* **markdown** `.markdown`, `.md`
-* **audio** `.mp3`
-* **video** `.mp4`, `.ogg`
-* **code** other file extension
-
-Of course, you can force the specified. For example, you want to Markdown file as code block embedded.
-
-```markdown
-[filename](_media/example.md ':include :type=code')
-```
-
-You will get it
-
-[filename](_media/example.md ':include :type=code')
-
-## Embedded code fragments
-Sometimes you don't want to embed a whole file. Maybe because you need just a few lines but you want to compile and test the file in CI.
-
-```markdown
-[filename](_media/example.js ':include :type=code :fragment=demo')
-```
-
-In your code file you need to surround the fragment between `/// [demo]` lines (before and after the fragment).
-Alternatively you can use `### [demo]`.
-
-Example:
-
-[filename](_media/example.js ':include :type=code :fragment=demo')
-
-
-## Tag attribute
-
-If you embed the file as `iframe`, `audio` and `video`, then you may need to set the attributes of these tags.
-
-```markdown
-[cinwell website](https://cinwell.com ':include :type=iframe width=100% height=400px')
-```
-
-[cinwell website](https://cinwell.com ':include :type=iframe width=100% height=400px')
-
-Did you see it? You only need to write directly. You can check [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe) for these attributes.
-
-## The code block highlight
-
-Embedding any type of source code file, you can specify the highlighted language or automatically identify.
-
-```markdown
-[](_media/example.html ':include :type=code text')
-```
-
-⬇️
-
-[](_media/example.html ':include :type=code text')
-
-?> How to set highlight? You can see [here](language-highlight.md).
diff --git a/docs/helpers.md b/docs/helpers.md
index b047d36..85a7035 100644
--- a/docs/helpers.md
+++ b/docs/helpers.md
@@ -4,142 +4,23 @@ docsify extends Markdown syntax to make your documents more readable.
## important content
-Important content like:
+Suitable for displaying important information.
```markdown
!> **Time** is money, my friend!
```
-is rendered as:
-
!> **Time** is money, my friend!
+
## General tips
-General tips like:
+General tips.
+
```markdown
-?> _TODO_ unit test
+?> *TODO* unit test
```
-are rendered as:
+?> *TODO* unit test
-?> _TODO_ unit test
-
-## Ignore to compile link
-
-Some time we will put some other relative path to the link, you have to need to tell docsify you don't need to compile this link. For example
-
-```md
-[link](/demo/)
-```
-
-It will be compiled to `link` and will be loaded `/demo/README.md`. Maybe you want to jump to `/demo/index.html`.
-
-Now you can do that
-
-```md
-[link](/demo/ ':ignore')
-```
-
-You will get `link`html. Do not worry, you can still set title for link.
-
-```md
-[link](/demo/ ':ignore title')
-
-link
-```
-
-## Set target attribute for link
-
-```md
-[link](/demo ':target=_blank')
-[link](/demo2 ':target=_self')
-```
-
-## Disable link
-
-```md
-[link](/demo ':disabled')
-```
-
-## Github Task Lists
-
-```md
-- [ ] foo
-- bar
-- [x] baz
-- [] bam <~ not working
- - [ ] bim
- - [ ] lim
-```
-
-- [ ] foo
-- bar
-- [x] baz
-- [] bam <~ not working
- - [ ] bim
- - [ ] lim
-
-## Image resizing
-
-```md
-
-
-
-
-
-
-```
-
-
-
-
-
-## Customise ID for headings
-
-```md
-### 你好,世界! :id=hello-world
-```
-
-## Markdown in html tag
-
-You need to insert a space between the html and markdown content.
-This is useful for rendering markdown content in the details element.
-
-```markdown
-
-Self-assessment (Click to expand)
-
-- Abc
-- Abc
-
-
-```
-
-
-Self-assessment (Click to expand)
-
-- Abc
-- Abc
-
-
-
-Or markdown content can be wrapped in html tag.
-
-```markdown
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
diff --git a/docs/language-highlight.md b/docs/language-highlight.md
index 793a39e..22a5700 100644
--- a/docs/language-highlight.md
+++ b/docs/language-highlight.md
@@ -1,11 +1,13 @@
# language highlight
-**docsify** uses [Prism](https://github.com/PrismJS/prism) to highlight code blocks in your pages. By default it only supports CSS, JavaScript and HTML. You can make **Prism** load additional languages:
+
+The code language highlight tool is [Prism](https://github.com/PrismJS/prism). Only supports CSS, JavaScipt and HTML by default. You can load its component to highlight the language you need.
+
```html
-
-
-
+
+
+
```
-?> Check the [component files](https://github.com/PrismJS/prism/tree/gh-pages/components) list for more options.
+?> See fully supported highlight component [files list](https://github.com/PrismJS/prism/tree/gh-pages/components).
diff --git a/docs/markdown.md b/docs/markdown.md
index c506e17..a45f188 100644
--- a/docs/markdown.md
+++ b/docs/markdown.md
@@ -1,6 +1,6 @@
# Markdown configuration
-**docsify** uses [marked](https://github.com/markedjs/marked) as its Markdown parser. You can customize how it renders your Markdown content to HTML by customizing `renderer`:
+The Markdown parser is [marked](https://github.com/chjj/marked). You can customize how docsify renders your Markdown content to HTML. Support customize `renderer`.
```js
window.$docsify = {
@@ -15,7 +15,7 @@ window.$docsify = {
}
```
-?> Configuration Options Reference [marked documentation](https://marked.js.org/#/USING_ADVANCED.md)
+?> Configuration Options Reference [marked documentation](https://github.com/chjj/marked#options-1)
Even you can completely customize the parsing rules.
@@ -28,29 +28,3 @@ window.$docsify = {
}
}
```
-
-## Supports mermaid
-
-```js
-// Import mermaid
-//
-//
-
-var num = 0;
-mermaid.initialize({ startOnLoad: false });
-
-window.$docsify = {
- markdown: {
- renderer: {
- code: function(code, lang) {
- if (lang === "mermaid") {
- return (
- '
"
- );
- }
- return this.origin.code.apply(this, arguments);
- }
- }
- }
-}
-```
diff --git a/docs/more-pages.md b/docs/more-pages.md
index 46e7df8..818041a 100644
--- a/docs/more-pages.md
+++ b/docs/more-pages.md
@@ -5,17 +5,17 @@ If you need more pages, you can simply create more markdown files in your docsif
For example, the directory structure is as follows:
```text
-.
-└── docs
- ├── README.md
- ├── guide.md
- └── zh-cn
- ├── README.md
- └── guide.md
+-| docs/
+ -| README.md
+ -| guide.md
+ -| zh-cn/
+ -| README.md
+ -| guide.md
```
Matching routes
+
```text
docs/README.md => http://domain.com
docs/guide.md => http://domain.com/guide
@@ -23,11 +23,11 @@ docs/zh-cn/README.md => http://domain.com/zh-cn/
docs/zh-cn/guide.md => http://domain.com/zh-cn/guide
```
-## Sidebar
+## Custom sidebar
-In order to have sidebar, then you can create your own `_sidebar.md` (see [this documentation's sidebar](https://github.com/docsifyjs/docsify/blob/master/docs/_sidebar.md) for an example):
+By default, the table of contents in the sidebar is automatically generated based on your markdown files. If you need a custom sidebar, then you can create your own `_sidebar.md` (see [this documentation's sidebar](https://github.com/QingWei-Li/docsify/blob/master/docs/_sidebar.md) for an example):
-First, you need to set `loadSidebar` to **true**. Details are available in the [configuration paragraph](configuration.md#loadsidebar).
+First, you need to set `loadSidebar` to **true**. Details are available in the [configuration paragraph](configuration#load-sidebar).
```html
@@ -37,7 +37,7 @@ First, you need to set `loadSidebar` to **true**. Details are available in the [
loadSidebar: true
}
-
+
```
Create the `_sidebar.md`:
@@ -45,48 +45,17 @@ Create the `_sidebar.md`:
```markdown
-* [Home](/)
-* [Guide](guide.md)
+- [Home](/)
+- [Guide](/guide)
```
-You need to create a `.nojekyll` in `./docs` to prevent GitHub Pages from ignoring files that begin with an underscore.
+!> You need to create a `.nojekyll` in `./docs` to prevent GitHub Pages from ignoring files that begin with an underscore.
-## Nested Sidebars
-
-You may want the sidebar to update with only navigation to reflect the current directory. This can be done by adding a `_sidebar.md` file to each folder.
-
-`_sidebar.md` is loaded from each level directory. If the current directory doesn't have `_sidebar.md`, it will fall back to the parent directory. If, for example, the current path is `/guide/quick-start`, the `_sidebar.md` will be loaded from `/guide/_sidebar.md`.
-
-You can specify `alias` to avoid unnecessary fallback.
-
-```html
-
-```
-
-!> You can create a `README.md` file in a subdirectory to use it as the landing page for the route.
-
-## Set Page Titles from Sidebar Selection
-
-A page's `title` tag is generated from the _selected_ sidebar item name. For better SEO, you can customize the title by specifying a string after the filename.
-
-```markdown
-
-* [Home](/)
-* [Guide](guide.md "The greatest guide in the world")
-```
+`_sidebar.md` is loaded from each level directory. If the current directory doesn't have `_sidebar.md`, it will fall back to the parent directory. If, for example, the current path is `/guide/quick-start`, the `_sidebar.md` will be loaded from `/guide/_sidebar.md`.
## Table of Contents
-Once you've created `_sidebar.md`, the sidebar content is automatically generated based on the headers in the markdown files.
-
-A custom sidebar can also automatically generate a table of contents by setting a `subMaxLevel`, compare [subMaxLevel configuration](configuration.md#submaxlevel).
+A custom sidebar can also automatically generate a table of contents by setting a `subMaxLevel`. Details are available in the [max-level configuration paragraph](configuration#sub-max-level).
```html
@@ -97,29 +66,5 @@ A custom sidebar can also automatically generate a table of contents by setting
subMaxLevel: 2
}
-
-```
-
-## Ignoring Subheaders
-
-When `subMaxLevel` is set, each header is automatically added to the table of contents by default. If you want to ignore a specific header, add `{docsify-ignore}` to it.
-
-```markdown
-# Getting Started
-
-## Header {docsify-ignore}
-
-This header won't appear in the sidebar table of contents.
-```
-
-To ignore all headers on a specific page, you can use `{docsify-ignore-all}` on the first header of the page.
-
-```markdown
-# Getting Started {docsify-ignore-all}
-
-## Header
-
-This header won't appear in the sidebar table of contents.
-```
-
-Both `{docsify-ignore}` and `{docsify-ignore-all}` will not be rendered on the page when used.
+
+```
\ No newline at end of file
diff --git a/docs/plugins.md b/docs/plugins.md
index 3706b89..8c2d4cf 100644
--- a/docs/plugins.md
+++ b/docs/plugins.md
@@ -1,9 +1,12 @@
-# List of Plugins
+# Using plugins
-## Full text search
+## List of Plugins
+
+### Full text search
By default, the hyperlink on the current page is recognized and the content is saved in `localStorage`. You can also specify the path to the files.
+
```html
-
-
+
+
```
-## Google Analytics
+
+### Google Analytics
Install the plugin and configure the track id.
@@ -61,137 +48,87 @@ Install the plugin and configure the track id.
ga: 'UA-XXXXX-Y'
}
-
-
+
+
```
Configure by `data-ga`.
-```html
-
-
-```
-
-## emoji
-
-The default is to support parsing emoji. For example `:100:` will be parsed to :100:. But it is not precise because there is no matching non-emoji string. If you need to correctly parse the emoji string, you need install this plugin.
```html
-
+
+
```
-## External Script
-If the script on the page is an external one (imports a js file via `src` attribute), you'll need this plugin to make it work.
+## Write a plugin
-```html
-
-```
+A plugin is simply a function that takes `hook` as arguments.
+The hook supports handling asynchronous tasks.
-## Zoom image
-
-Medium's image zoom. Based on [medium-zoom](https://github.com/francoischalifour/medium-zoom).
-
-```html
-
-```
-
-Exclude the special image
-
-```markdown
-
-```
-
-## Edit on github
-
-Add `Edit on github` button on every pages. Provided by [@njleonzhang](https://github.com/njleonzhang), check [document](https://github.com/njleonzhang/docsify-edit-on-github)
-
-## Demo code with instant preview and jsfiddle integration
-
-With this plugin, sample code can be rendered on the page instantly, so that the readers can see the preview immediately.
-When readers expand the demo box, the source code and description are shown there. if they click the button `Try in Jsfiddle`,
-`jsfiddle.net` will be open with the code of this sample, which allow readers to revise the code and try on their own.
-
-[Vue](https://njleonzhang.github.io/docsify-demo-box-vue/) and [React](https://njleonzhang.github.io/docsify-demo-box-react/) are both supported.
-
-## Copy to Clipboard
-
-Add a simple `Click to copy` button to all preformatted code blocks to effortlessly allow users to copy example code from your docs. Provided by [@jperasmus](https://github.com/jperasmus)
-
-```html
-
-```
-
-See [here](https://github.com/jperasmus/docsify-copy-code/blob/master/README.md) for more details.
-
-## Disqus
-
-Disqus comments. https://disqus.com/
-
-```html
-
-
-```
-
-## Gitalk
-
-[Gitalk](https://github.com/gitalk/gitalk) is a modern comment component based on Github Issue and Preact.
-
-```html
-
-
-
-
-
-```
-
-## Pagination
-
-Pagination for docsify. By [@imyelo](https://github.com/imyelo)
-
-```html
-
-
-```
-
-## codefund
-
-a [plugin](https://github.com/njleonzhang/docsify-plugin-codefund) to make it easy to join up [codefund](https://codefund.io/)
-
-> codefund is formerly known as "codesponsor"
-
-```
-
+#### Full configuration
+```js
window.$docsify = {
- plugins: [
- DocsifyCodefund.create('xxxx-xxx-xxx') // change to your codefund id
- ]
+ plugins: [
+ function (hook, vm) {
+ hook.init(function() {
+ // Called when the script starts running, only trigger once, no arguments,
+ })
+
+ hook.beforeEach(function(content) {
+ // Invoked each time before parsing the Markdown file.
+ // ...
+ return content
+ })
+
+ hook.afterEach(function(html, next) {
+ // Invoked each time after the Markdown file is parsed.
+ // beforeEach and afterEach support asynchronous。
+ // ...
+ // call `next(html)` when task is done.
+ next(html)
+ })
+
+ hook.doneEach(function() {
+ // Invoked each time after the data is fully loaded, no arguments,
+ // ...
+ })
+
+ hook.mounted(function() {
+ // Called after initial completion. Only trigger once, no arguments.
+ })
+
+ hook.ready(function() {
+ // Called after initial completion, no arguments.
+ })
+ }
+ ]
}
```
-## Tabs
+!> You can get internal methods through `window.Docsify`. Get the current instance through the second argument.
-A docsify.js plugin for displaying tabbed content from markdown.
+#### Example
-- [Documentation & Demos](https://jhildenbiddle.github.io/docsify-tabs)
+Add footer component in each pages.
-Provided by [@jhildenbiddle](https://github.com/jhildenbiddle/docsify-tabs).
+```js
+window.$docsify = {
+ plugins: [
+ function (hook) {
+ var footer = [
+ '',
+ ''
+ ].join('')
-## More plugins
-
-See [awesome-docsify](awesome?id=plugins)
+ hook.afterEach(function (html) {
+ return html + footer
+ })
+ }
+ ]
+}
+```
diff --git a/docs/quickstart.md b/docs/quickstart.md
index 08666d2..f0a25a4 100644
--- a/docs/quickstart.md
+++ b/docs/quickstart.md
@@ -8,7 +8,7 @@ npm i docsify-cli -g
## Initialize
-If you want to write the documentation in the `./docs` subdirectory, you can use the `init` command.
+If you want to write the documentation in the `./docs` directory, you can use the `init` command.
```bash
docsify init ./docs
@@ -16,27 +16,29 @@ docsify init ./docs
## Writing content
-After the `init` is complete, you can see the file list in the `./docs` subdirectory.
+After the init is complete, you can see the file list in the docs directory.
-* `index.html` as the entry file
-* `README.md` as the home page
-* `.nojekyll` prevents GitHub Pages from ignoring files that begin with an underscore
-You can easily update the documentation in `./docs/README.md`, of course you can add [more pages](more-pages.md).
+- `index.html` as the entry file
+- `README.md` as the home page
+- `.nojekyll` prevents GitHub Pages from ignoring files that begin with an underscore
+
+You can easily update the documentation in `docs/README.md`, of course you can add [more pages](more-pages).
## Preview your site
Run the local server with `docsify serve`. You can preview your site in your browser on `http://localhost:3000`.
+
```bash
docsify serve docs
```
-?> For more use cases of `docsify-cli`, head over to the [docsify-cli documentation](https://github.com/docsifyjs/docsify-cli).
+?> For more use cases of `docsify-cli`, head over to the [docsify-cli documentation](https://github.com/QingWei-Li/docsify-cli).
## Manual initialization
-If you don't like `npm` or have trouble installing the tool, you can manually create `index.html`:
+If you don't like npm or have trouble installing the tool, you can manually create `index.html`:
```html
@@ -44,20 +46,13 @@ If you don't like `npm` or have trouble installing the tool, you can manually cr
-
-
-
-
+
```
@@ -81,7 +76,7 @@ You should set the `data-app` attribute if you changed `el`:
```html
-
+
Please wait...
```
-
-Compare [el configuration](configuration.md#el).
diff --git a/docs/ssr.md b/docs/ssr.md
deleted file mode 100644
index e9c435f..0000000
--- a/docs/ssr.md
+++ /dev/null
@@ -1,124 +0,0 @@
-# Server-Side Rendering
-
-See https://docsify.now.sh
-
-Repo in https://github.com/docsifyjs/docsify-ssr-demo
-
-## Why SSR?
-- Better SEO
-- Feeling cool
-
-## Quick start
-
-Install `now` and `docsify-cli` in your project.
-
-```bash
-npm i now docsify-cli -D
-```
-
-Edit `package.json`. If the documentation in `./docs` subdirectory.
-
-```json
-{
- "name": "my-project",
- "scripts": {
- "start": "docsify start . -c ssr.config.js",
- "deploy": "now -p"
- },
- "files": [
- "docs"
- ],
- "docsify": {
- "config": {
- "basePath": "https://docsify.js.org/",
- "loadSidebar": true,
- "loadNavbar": true,
- "coverpage": true,
- "name": "docsify"
- }
- }
-}
-```
-
-!> The `basePath` just like webpack `publicPath`. We can use local or remote files.
-
-We can preview in the local to see if it works.
-
-```bash
-npm start
-
-# open http://localhost:4000
-```
-
-Publish it!
-
-```bash
-now -p
-```
-
-Now, You have a support for SSR the docs site.
-
-## Custom template
-
-You can provide a template for entire page's HTML. such as
-
-```html
-
-
-
-
- docsify
-
-
-
-
-
-
-
-
-
-
-
-
-
-```
-
-The template should contain these comments for rendered app content.
- - ``
- - ``
-
-## Configuration
-
-You can configure it in a special config file, or `package.json`.
-
-```js
-module.exports = {
- template: './ssr.html',
- maxAge: 60 * 60 * 1000, // lru-cache config
- config: {
- // docsify config
- }
-}
-```
-
-## Deploy for your VPS
-
-You can run `docsify start` directly on your Node server, or write your own server app with `docsify-server-renderer`.
-
-```js
-var Renderer = require('docsify-server-renderer')
-var readFileSync = require('fs').readFileSync
-
-// init
-var renderer = new Renderer({
- template: readFileSync('./docs/index.template.html', 'utf-8'),
- config: {
- name: 'docsify',
- repo: 'docsifyjs/docsify'
- }
-})
-
-renderer.renderToString(url)
- .then(html => {})
- .catch(err => {})
-```
diff --git a/docs/pwa.md b/docs/sw.js
similarity index 59%
rename from docs/pwa.md
rename to docs/sw.js
index e8d1c74..1fb26d6 100644
--- a/docs/pwa.md
+++ b/docs/sw.js
@@ -1,16 +1,3 @@
-# Offline Mode
-
-[Progressive Web Apps](https://developers.google.com/web/progressive-web-apps/) (PWA) are experiences that combine the best of the web with the best of apps. We can enhance our website with service workers to work **offline** or on low-quality networks.
-
-It is also very easy to use it.
-
-## Create serviceWorker
-
-Create a `sw.js` file in your documents root directory and copy the following code:
-
-*sw.js*
-
-```js
/* ===========================================================
* docsify sw.js
* ===========================================================
@@ -19,18 +6,18 @@ Create a `sw.js` file in your documents root directory and copy the following co
* Register service worker.
* ========================================================== */
-const RUNTIME = 'docsify'
+const RUNTIME = 'docsify';
const HOSTNAME_WHITELIST = [
self.location.hostname,
+ 'unpkg.com',
'fonts.gstatic.com',
- 'fonts.googleapis.com',
- 'unpkg.com'
+ 'fonts.googleapis.com'
]
// The Util Function to hack URLs of intercepted requests
const getFixedUrl = (req) => {
- var now = Date.now()
- var url = new URL(req.url)
+ var now = Date.now();
+ url = new URL(req.url)
// 1. fixed http URL
// Just keep syncing with location.protocol
@@ -43,9 +30,7 @@ const getFixedUrl = (req) => {
// max-age on mutable content is error-prone, with SW life of bugs can even extend.
// Until cache mode of Fetch API landed, we have to workaround cache-busting with query string.
// Cache-Control-Bug: https://bugs.chromium.org/p/chromium/issues/detail?id=453190
- if (url.hostname === self.location.hostname) {
- url.search += (url.search ? '&' : '?') + 'cache-bust=' + now
- }
+ url.search += (url.search ? '&' : '?') + 'cache-bust=' + now;
return url.href
}
@@ -55,15 +40,16 @@ const getFixedUrl = (req) => {
*
* waitUntil(): activating ====> activated
*/
-self.addEventListener('activate', event => {
- event.waitUntil(self.clients.claim())
-})
+self.addEventListener('activate', event => {
+ event.waitUntil(self.clients.claim());
+});
+
/**
* @Functional Fetch
* All network requests are being intercepted here.
*
- * void respondWith(Promise r)
+ * void respondWith(Promise r);
*/
self.addEventListener('fetch', event => {
// Skip some of cross-origin requests, like those for Google Analytics.
@@ -71,10 +57,10 @@ self.addEventListener('fetch', event => {
// Stale-while-revalidate
// similar to HTTP's stale-while-revalidate: https://www.mnot.net/blog/2007/12/12/stale
// Upgrade from Jake's to Surma's: https://gist.github.com/surma/eb441223daaedf880801ad80006389f1
- const cached = caches.match(event.request)
- const fixedUrl = getFixedUrl(event.request)
- const fetched = fetch(fixedUrl, { cache: 'no-store' })
- const fetchedCopy = fetched.then(resp => resp.clone())
+ const cached = caches.match(event.request);
+ const fixedUrl = getFixedUrl(event.request);
+ const fetched = fetch(fixedUrl, {cache: 'no-store'});
+ const fetchedCopy = fetched.then(resp => resp.clone());
// Call respondWith() with whatever we get first.
// If the fetch fails (e.g disconnected), wait for the cache.
@@ -83,33 +69,14 @@ self.addEventListener('fetch', event => {
event.respondWith(
Promise.race([fetched.catch(_ => cached), cached])
.then(resp => resp || fetched)
- .catch(_ => { /* eat any errors */ })
- )
+ .catch(_ => {/* eat any errors */})
+ );
// Update the cache with the version we fetched (only for ok status)
event.waitUntil(
Promise.all([fetchedCopy, caches.open(RUNTIME)])
.then(([response, cache]) => response.ok && cache.put(event.request, response))
- .catch(_ => { /* eat any errors */ })
- )
+ .catch(_ => {/* eat any errors */})
+ );
}
-})
-```
-
-## Register
-
-Now, register it in your `index.html`. It only works on some modern browsers, so we need to judge:
-
-*index.html*
-
-```html
-
-```
-
-## Enjoy it
-
-Release your website and start experiencing magical offline feature. :ghost: You can turn off Wi-Fi and refresh the current site to experience it.
+});
diff --git a/docs/themes.md b/docs/themes.md
index 1de9125..ed5ae40 100644
--- a/docs/themes.md
+++ b/docs/themes.md
@@ -2,43 +2,35 @@
There are currently three themes available. Copy [Vue](//vuejs.org) and [buble](//buble.surge.sh) website custom theme and [@liril-net](https://github.com/liril-net) contribution to the theme of the black style.
-```html
-
-
-
-
-```
-
-!> Compressed files are available in `/lib/themes/`.
```html
-
-
-
-
-
-
+
+
+
```
-If you have any ideas or would like to develop a new theme, you are welcome to submit a [pull request](https://github.com/docsifyjs/docsify/pulls).
+!> This compressed files in `/lib/themes/`.
+
+If you have any ideas or would like to develop new theme, welcome submit [PR](https://github.com/QingWei-Li/docsify/pulls).
#### Click to preview
+
+
@@ -54,7 +46,3 @@ If you have any ideas or would like to develop a new theme, you are welcome to s
});
};
-
-## Other themes
-
-- [docsify-themeable](https://jhildenbiddle.github.io/docsify-themeable/#/) A delightfully simple theme system for docsify.
diff --git a/docs/vue.md b/docs/vue.md
index a1b5683..b9714ee 100644
--- a/docs/vue.md
+++ b/docs/vue.md
@@ -1,25 +1,23 @@
# Compatible with Vue
-You can write Vue components directly in the Markdown file, and it will be parsed. You can use this feature to write vue demo and documentation together.
+You can write Vue components directly in the Markdown file, and it will be parsed.
+You can use this feature to write vue demo and documentation together.
## Basic usage
-Load the Vue in `./index.html`.
+Load the Vue in `index.html`.
```html
-
-
-
-
```
-Then you can immediately write Vue code at Markdown file. `new Vue({ el: '#main' })` script is executed by default to create instance.
+Then you can immediately write Vue code at Markdown file.
+`new Vue({ el: '#main' })` script is executed by default to create instance.
*README.md*
-````markdown
+```markdown
# Vue guide
`v-for` usage.
@@ -28,12 +26,12 @@ Then you can immediately write Vue code at Markdown file. `new Vue({ el: '#main'
{{ i }}
-```
+``
{{ i }}
-````
+```
You can manually initialize a Vue instance.
@@ -42,7 +40,7 @@ You can manually initialize a Vue instance.
```markdown
# Vue demo
-