Compare commits

..
3 Commits
Author SHA1 Message Date
qingwei.li 6eccca1000 chore: add changelog 4.5.7 2017-12-29 16:46:06 +08:00
qingwei.li 5a4d5d02d0 [build] 4.5.7 2017-12-29 16:46:04 +08:00
qingwei.li f29e658037 docs: add maxAge for ssr 2017-12-29 16:45:32 +08:00
141 changed files with 6360 additions and 9276 deletions
+2 -4
View File
@@ -1,5 +1,3 @@
.git
.git/
packages/docsify-server-renderer/build.js
node_modules
build
server.js
node_modules
+9 -14
View File
@@ -1,20 +1,15 @@
{
"extends": "xo-space/browser",
"rules": {
"semi": [2, "never"],
"no-return-assign": "off",
"no-unused-expressions": "off",
"no-new-func": "off",
"no-multi-assign": "off",
"no-mixed-operators": "off",
"max-params": "off",
"no-script-url": "off",
"camelcase": "off",
"no-warning-comments": "off"
"extends": [
"vue"
],
"parserOptions": {
"ecmaVersion": 8
},
"env": {
"browser": true
},
"globals": {
"Docsify": true,
"$docsify": true,
"process": true
"$docsify": true
}
}
-2
View File
@@ -1,2 +0,0 @@
<!-- Love docsify? Please consider supporting our collective:
👉 https://opencollective.com/docsify/donate -->
+1 -1
View File
@@ -2,4 +2,4 @@ Please makes sure these boxes are checked before submitting your PR, thank you!
* [ ] Make sure you are merging your commits to `master` branch.
* [ ] Add some descriptions and refer relative issues for you PR.
* [ ] DO NOT include files inside `lib` directory.
* [ ] DO NOT include files inside lib directory.
-1
View File
@@ -3,4 +3,3 @@
/themes/
node_modules
/lib/
.idea
+164 -226
View File
@@ -1,637 +1,575 @@
<a name="4.7.0"></a>
# [4.7.0](https://github.com/QingWei-Li/docsify/compare/v4.6.9...v4.7.0) (2018-06-29)
### Bug Fixes
* alldow addition content in sidebar, fix [#518](https://github.com/QingWei-Li/docsify/issues/518), fix 539 ([#543](https://github.com/QingWei-Li/docsify/issues/543)) ([04b36b0](https://github.com/QingWei-Li/docsify/commit/04b36b0))
* async install config, fixed [#425](https://github.com/QingWei-Li/docsify/issues/425) ([e4e011c](https://github.com/QingWei-Li/docsify/commit/e4e011c))
* loading embed files synchronously, fixed [#525](https://github.com/QingWei-Li/docsify/issues/525), fixed [#527](https://github.com/QingWei-Li/docsify/issues/527) ([#544](https://github.com/QingWei-Li/docsify/issues/544)) ([feea7f9](https://github.com/QingWei-Li/docsify/commit/feea7f9))
* path include chinese character cause hilight bug ([#556](https://github.com/QingWei-Li/docsify/issues/556)) ([a5f333a](https://github.com/QingWei-Li/docsify/commit/a5f333a))
### Features
* add logo option, [#264](https://github.com/QingWei-Li/docsify/issues/264) ([#541](https://github.com/QingWei-Li/docsify/issues/541)) ([ee72dd0](https://github.com/QingWei-Li/docsify/commit/ee72dd0))
* add unpkg field, close [#531](https://github.com/QingWei-Li/docsify/issues/531) ([#558](https://github.com/QingWei-Li/docsify/issues/558)) ([5c0de0a](https://github.com/QingWei-Li/docsify/commit/5c0de0a))
* support image resizing, resolve [#508](https://github.com/QingWei-Li/docsify/issues/508) ([#545](https://github.com/QingWei-Li/docsify/issues/545)) ([3a7ad62](https://github.com/QingWei-Li/docsify/commit/3a7ad62))
<a name="4.6.10"></a>
## [4.6.10](https://github.com/QingWei-Li/docsify/compare/v4.6.9...v4.6.10) (2018-03-25)
### Bug Fixes
* async install config, fixed [#425](https://github.com/QingWei-Li/docsify/issues/425) ([e4e011c](https://github.com/QingWei-Li/docsify/commit/e4e011c))
<a name="4.6.9"></a>
## [4.6.9](https://github.com/QingWei-Li/docsify/compare/v4.6.8...v4.6.9) (2018-03-10)
### Bug Fixes
* upgrade medium-zoom, fixed [#417](https://github.com/QingWei-Li/docsify/issues/417) ([6a3d69a](https://github.com/QingWei-Li/docsify/commit/6a3d69a))
<a name="4.6.8"></a>
## [4.6.8](https://github.com/QingWei-Li/docsify/compare/v4.6.7...v4.6.8) (2018-03-06)
### Bug Fixes
* resolve path of image and embed files, fixed [#412](https://github.com/QingWei-Li/docsify/issues/412) ([bfd0d18](https://github.com/QingWei-Li/docsify/commit/bfd0d18))
<a name="4.6.7"></a>
## [4.6.7](https://github.com/QingWei-Li/docsify/compare/v4.6.6...v4.6.7) (2018-03-03)
### Bug Fixes
* layout css, fixed [#409](https://github.com/QingWei-Li/docsify/issues/409) ([aeb692e](https://github.com/QingWei-Li/docsify/commit/aeb692e))
<a name="4.6.6"></a>
## [4.6.6](https://github.com/QingWei-Li/docsify/compare/v4.6.5...v4.6.6) (2018-03-03)
<a name="4.6.5"></a>
## [4.6.5](https://github.com/QingWei-Li/docsify/compare/v4.6.4...v4.6.5) (2018-03-03)
### Bug Fixes
* **navbar:** Now Navbar isn't append to DOM when loadNavbar is falsy ([#407](https://github.com/QingWei-Li/docsify/issues/407)) ([0933445](https://github.com/QingWei-Li/docsify/commit/0933445))
### Features
* **config:** Add 404 page options. ([#406](https://github.com/QingWei-Li/docsify/issues/406)) ([9b3b445](https://github.com/QingWei-Li/docsify/commit/9b3b445))
<a name="4.6.4"></a>
## [4.6.4](https://github.com/QingWei-Li/docsify/compare/v4.6.3...v4.6.4) (2018-03-01)
### Bug Fixes
* **render:** Disable markdown parsing when the file is an HTML ([#403](https://github.com/QingWei-Li/docsify/issues/403)) ([278a75e](https://github.com/QingWei-Li/docsify/commit/278a75e))
### Features
* **fetch:** Add fallback languages configuration. ([#402](https://github.com/QingWei-Li/docsify/issues/402)) ([ecc0e04](https://github.com/QingWei-Li/docsify/commit/ecc0e04))
<a name="4.6.3"></a>
## [4.6.3](https://github.com/QingWei-Li/docsify/compare/v4.6.2...v4.6.3) (2018-02-15)
### Bug Fixes
* **hook:** beforeEach don\'t work, fixed [#393](https://github.com/QingWei-Li/docsify/issues/393) ([6a09059](https://github.com/QingWei-Li/docsify/commit/6a09059))
<a name="4.6.2"></a>
## [4.6.2](https://github.com/QingWei-Li/docsify/compare/v4.6.1...v4.6.2) (2018-02-14)
### Bug Fixes
* **embed:** broken in IE, fixed [#389](https://github.com/QingWei-Li/docsify/issues/389), fixed [#391](https://github.com/QingWei-Li/docsify/issues/391) ([45a7464](https://github.com/QingWei-Li/docsify/commit/45a7464))
* **embed:** init value ([890a7bf](https://github.com/QingWei-Li/docsify/commit/890a7bf))
<a name="4.6.1"></a>
## [4.6.1](https://github.com/QingWei-Li/docsify/compare/v4.6.0...v4.6.1) (2018-02-12)
### Bug Fixes
* **embed** compatible ssr ([dc0c3ce](https://github.com/QingWei-Li/docsify/commit/dc0c3ce))
* **embed** async fetch embed files, fixed [#387](https://github.com/QingWei-Li/docsify/issues/387)
<a name="4.6.0"></a>
# [4.6.0](https://github.com/QingWei-Li/docsify/compare/v4.5.9...v4.6.0) (2018-02-11)
### Bug Fixes
* **search:** custom clear button, fixed [#271](https://github.com/QingWei-Li/docsify/issues/271) ([864aa18](https://github.com/QingWei-Li/docsify/commit/864aa18))
* **search:** escape special characters for search, fixed [#369](https://github.com/QingWei-Li/docsify/issues/369) ([9755439](https://github.com/QingWei-Li/docsify/commit/9755439))
* build config ([342438f](https://github.com/QingWei-Li/docsify/commit/342438f))
* button style for coverpage, fixed [#362](https://github.com/QingWei-Li/docsify/issues/362) ([85428ef](https://github.com/QingWei-Li/docsify/commit/85428ef))
* dropdown scroll style, fixed [#346](https://github.com/QingWei-Li/docsify/issues/346) ([c4d83f2](https://github.com/QingWei-Li/docsify/commit/c4d83f2))
* highlight homepage link, fixed [#304](https://github.com/QingWei-Li/docsify/issues/304) ([f960c19](https://github.com/QingWei-Li/docsify/commit/f960c19))
* homepage link ([e097f88](https://github.com/QingWei-Li/docsify/commit/e097f88))
* onlyCover ([033be4f](https://github.com/QingWei-Li/docsify/commit/033be4f))
* ssr compatible embedd ([ebc10c4](https://github.com/QingWei-Li/docsify/commit/ebc10c4))
* ssr coverpage, fixed [#273](https://github.com/QingWei-Li/docsify/issues/273) ([9e824a4](https://github.com/QingWei-Li/docsify/commit/9e824a4))
### Features
* click sidebar menu add collapse and expand, close [#294](https://github.com/QingWei-Li/docsify/issues/294) ([5e161a1](https://github.com/QingWei-Li/docsify/commit/5e161a1))
* **compiler:** support embedded file as code block, close [#134](https://github.com/QingWei-Li/docsify/issues/134) ([761ccc2](https://github.com/QingWei-Li/docsify/commit/761ccc2))
* **compiler:** support embedded markdown, html, video, etc files, close [#383](https://github.com/QingWei-Li/docsify/issues/383), close [#333](https://github.com/QingWei-Li/docsify/issues/333) ([524f52f](https://github.com/QingWei-Li/docsify/commit/524f52f))
* **cover:** add onlyCover option, close [#382](https://github.com/QingWei-Li/docsify/issues/382) ([b265fdd](https://github.com/QingWei-Li/docsify/commit/b265fdd))
* **fetch:** add requestHeaders option, fixed [#336](https://github.com/QingWei-Li/docsify/issues/336) ([54ab4c9](https://github.com/QingWei-Li/docsify/commit/54ab4c9))
* **render:** add ext option for custom file extenstion, close [#340](https://github.com/QingWei-Li/docsify/issues/340) ([248aa72](https://github.com/QingWei-Li/docsify/commit/248aa72))
* **render:** mutilple coverpage, close [#315](https://github.com/QingWei-Li/docsify/issues/315) ([f68ddf5](https://github.com/QingWei-Li/docsify/commit/f68ddf5))
<a name="4.5.9"></a>
## [4.5.9](https://github.com/QingWei-Li/docsify/compare/v4.5.8...v4.5.9) (2018-02-07)
### Bug Fixes
* upgrade marked ([4157173](https://github.com/QingWei-Li/docsify/commit/4157173))
<a name="4.5.8"></a>
## [4.5.8](https://github.com/QingWei-Li/docsify/compare/v4.5.6...v4.5.8) (2018-02-07)
### Bug Fixes
* cover style, fixed [#381](https://github.com/QingWei-Li/docsify/issues/381) ([368754e](https://github.com/QingWei-Li/docsify/commit/368754e))
* updated deps ([#337](https://github.com/QingWei-Li/docsify/issues/337)) ([a12d393](https://github.com/QingWei-Li/docsify/commit/a12d393))
<a name="4.5.7"></a>
## [4.5.7](https://github.com/QingWei-Li/docsify/compare/v4.5.6...v4.5.7) (2017-12-29)
### Features
* add navigation plugin, closed [#180](https://github.com/QingWei-Li/docsify/issues/180) ([f78be4c](https://github.com/QingWei-Li/docsify/commit/f78be4c))
<a name="4.5.6"></a>
<a name="4.5.6"></a>
## [4.5.6](https://github.com/QingWei-Li/docsify/compare/v4.5.3...v4.5.6) (2017-12-14)
### Bug Fixes
* **style:** increase the tap targets of menu button, fixed [#325](https://github.com/QingWei-Li/docsify/issues/325) ([888f217](https://github.com/QingWei-Li/docsify/commit/888f217))
<a name="4.5.5"></a>
<a name="4.5.5"></a>
## [4.5.5](https://github.com/QingWei-Li/docsify/compare/v4.5.4...v4.5.5) (2017-11-30)
### Bug Fixes
* disqus plugin issue ([#318](https://github.com/QingWei-Li/docsify/issues/318)) ([041b33e](https://github.com/QingWei-Li/docsify/commit/041b33e)), closes [#317](https://github.com/QingWei-Li/docsify/issues/317)
<a name="4.5.4"></a>
<a name="4.5.4"></a>
## [4.5.4](https://github.com/QingWei-Li/docsify/compare/v4.5.2...v4.5.4) (2017-11-29)
### Bug Fixes
* **compiler:** task lists style, fixed [#215](https://github.com/QingWei-Li/docsify/issues/215) ([e43ded4](https://github.com/QingWei-Li/docsify/commit/e43ded4))
### Features
* add gitalk plugin ([#306](https://github.com/QingWei-Li/docsify/issues/306)) ([9208e64](https://github.com/QingWei-Li/docsify/commit/9208e64))
<a name="4.5.3"></a>
## [4.5.3](https://github.com/QingWei-Li/docsify/compare/v4.5.2...v4.5.3) (2017-11-11)
### Features
* add gitalk plugin ([#306](https://github.com/QingWei-Li/docsify/issues/306)) ([9208e64](https://github.com/QingWei-Li/docsify/commit/9208e64))
<a name="4.5.2"></a>
<a name="4.5.2"></a>
## [4.5.2](https://github.com/QingWei-Li/docsify/compare/v4.5.1...v4.5.2) (2017-11-09)
### Features
* github task lists, close [#215](https://github.com/QingWei-Li/docsify/issues/215) ([#305](https://github.com/QingWei-Li/docsify/issues/305)) ([d486eef](https://github.com/QingWei-Li/docsify/commit/d486eef))
<a name="4.5.1"></a>
<a name="4.5.1"></a>
## [4.5.1](https://github.com/QingWei-Li/docsify/compare/v4.5.0...v4.5.1) (2017-11-07)
### Features
* fetch files with the query params, fixed [#303](https://github.com/QingWei-Li/docsify/issues/303) ([2a2ed96](https://github.com/QingWei-Li/docsify/commit/2a2ed96))
<a name="4.5.0"></a>
<a name="4.5.0"></a>
# [4.5.0](https://github.com/QingWei-Li/docsify/compare/v4.4.1...v4.5.0) (2017-11-04)
### Features
* add disqus plugin, closed [#123](https://github.com/QingWei-Li/docsify/issues/123) ([fd7d4e0](https://github.com/QingWei-Li/docsify/commit/fd7d4e0))
<a name="4.4.1"></a>
<a name="4.4.1"></a>
## [4.4.1](https://github.com/QingWei-Li/docsify/compare/v4.4.0...v4.4.1) (2017-10-31)
### Bug Fixes
* {docsify-ignore-all} and {docsify-ignore} bug ([#299](https://github.com/QingWei-Li/docsify/issues/299)) ([cc98f56](https://github.com/QingWei-Li/docsify/commit/cc98f56))
* zoom image plugin issue, fixed [#187](https://github.com/QingWei-Li/docsify/issues/187) ([#300](https://github.com/QingWei-Li/docsify/issues/300)) ([fa772cf](https://github.com/QingWei-Li/docsify/commit/fa772cf))
<a name="4.4.0"></a>
<a name="4.4.0"></a>
# [4.4.0](https://github.com/QingWei-Li/docsify/compare/v4.3.15...v4.4.0) (2017-10-30)
### Bug Fixes
* sidebar style issue on firefox, fixed [#184](https://github.com/QingWei-Li/docsify/issues/184) ([#297](https://github.com/QingWei-Li/docsify/issues/297)) ([36bfc9d](https://github.com/QingWei-Li/docsify/commit/36bfc9d))
### Features
* add helper for disabled link, fixed [#295](https://github.com/QingWei-Li/docsify/issues/295) ([#296](https://github.com/QingWei-Li/docsify/issues/296)) ([4ad96f3](https://github.com/QingWei-Li/docsify/commit/4ad96f3))
<a name="4.3.15"></a>
<a name="4.3.15"></a>
## [4.3.15](https://github.com/QingWei-Li/docsify/compare/v4.3.14...v4.3.15) (2017-10-20)
### Bug Fixes
* scroll active sidebar ([a2b8eae](https://github.com/QingWei-Li/docsify/commit/a2b8eae))
<a name="4.3.14"></a>
<a name="4.3.14"></a>
## [4.3.14](https://github.com/QingWei-Li/docsify/compare/v4.3.13...v4.3.14) (2017-10-20)
### Bug Fixes
* codesponsor style ([ab68268](https://github.com/QingWei-Li/docsify/commit/ab68268))
<a name="4.3.13"></a>
<a name="4.3.13"></a>
## [4.3.13](https://github.com/QingWei-Li/docsify/compare/v4.3.12...v4.3.13) (2017-10-17)
### Bug Fixes
* duplicate results in search fixed [#257](https://github.com/QingWei-Li/docsify/issues/257) ([#284](https://github.com/QingWei-Li/docsify/issues/284)) ([3476f6f](https://github.com/QingWei-Li/docsify/commit/3476f6f))
* duplicate results in search fixed [#257](https://github.com/QingWei-Li/docsify/issues/257) ([#284](https://github.com/QingWei-Li/docsify/issues/284)) ([3476f6f](https://github.com/QingWei-Li/docsify/commit/3476f6f))
### Features
* make whole search result clickable ([#285](https://github.com/QingWei-Li/docsify/issues/285)) ([1b91227](https://github.com/QingWei-Li/docsify/commit/1b91227))
<a name="4.3.12"></a>
<a name="4.3.12"></a>
## [4.3.12](https://github.com/QingWei-Li/docsify/compare/v4.3.11...v4.3.12) (2017-10-15)
### Bug Fixes
* incorrect active link ([#281](https://github.com/QingWei-Li/docsify/issues/281)) ([a3ab379](https://github.com/QingWei-Li/docsify/commit/a3ab379))
<a name="4.3.11"></a>
<a name="4.3.11"></a>
## [4.3.11](https://github.com/QingWei-Li/docsify/compare/v4.3.10...v4.3.11) (2017-10-15)
### Bug Fixes
* broken links to same page heading, fix [#278](https://github.com/QingWei-Li/docsify/issues/278), fix [#279](https://github.com/QingWei-Li/docsify/issues/279) ([91d6337](https://github.com/QingWei-Li/docsify/commit/91d6337))
<a name="4.3.10"></a>
<a name="4.3.10"></a>
## [4.3.10](https://github.com/QingWei-Li/docsify/compare/v4.3.9...v4.3.10) (2017-10-12)
### Bug Fixes
* link render issue after page refreshing ([#276](https://github.com/QingWei-Li/docsify/issues/276)) ([abd885e](https://github.com/QingWei-Li/docsify/commit/abd885e))
<a name="4.3.9"></a>
<a name="4.3.9"></a>
## [4.3.9](https://github.com/QingWei-Li/docsify/compare/v4.3.8...v4.3.9) (2017-10-11)
### Bug Fixes
* scroll issue in IE ([#275](https://github.com/QingWei-Li/docsify/issues/275)) ([3e94cb6](https://github.com/QingWei-Li/docsify/commit/3e94cb6))
<a name="4.3.8"></a>
<a name="4.3.8"></a>
## [4.3.8](https://github.com/QingWei-Li/docsify/compare/v4.3.7...v4.3.8) (2017-10-07)
### Bug Fixes
* **slugify:** GitHub compatible heading links, fixed [#272](https://github.com/QingWei-Li/docsify/issues/272) ([9b4e666](https://github.com/QingWei-Li/docsify/commit/9b4e666))
<a name="4.3.7"></a>
<a name="4.3.7"></a>
## [4.3.7](https://github.com/QingWei-Li/docsify/compare/v4.3.6...v4.3.7) (2017-10-02)
### Bug Fixes
* **slugify:** GitHub compatible heading links, fixed [#267](https://github.com/QingWei-Li/docsify/issues/267) ([c195d2d](https://github.com/QingWei-Li/docsify/commit/c195d2d))
<a name="4.3.6"></a>
<a name="4.3.6"></a>
## [4.3.6](https://github.com/QingWei-Li/docsify/compare/v4.3.5...v4.3.6) (2017-09-21)
### Bug Fixes
* style for codesponsor plugin ([08afec7](https://github.com/QingWei-Li/docsify/commit/08afec7))
<a name="4.3.5"></a>
<a name="4.3.5"></a>
## [4.3.5](https://github.com/QingWei-Li/docsify/compare/v4.3.4...v4.3.5) (2017-09-20)
### Bug Fixes
* missed symbol ([#254](https://github.com/QingWei-Li/docsify/issues/254)) ([6c702d3](https://github.com/QingWei-Li/docsify/commit/6c702d3))
### Features
* **plugin:** add codesponsor plugin ([46ac4c3](https://github.com/QingWei-Li/docsify/commit/46ac4c3))
<a name="4.3.4"></a>
<a name="4.3.4"></a>
## [4.3.4](https://github.com/QingWei-Li/docsify/compare/v4.3.3...v4.3.4) (2017-09-07)
### Bug Fixes
* scroll position issue, fixed [#234](https://github.com/QingWei-Li/docsify/issues/234) ([388ed3d](https://github.com/QingWei-Li/docsify/commit/388ed3d))
<a name="4.3.3"></a>
<a name="4.3.3"></a>
## [4.3.3](https://github.com/QingWei-Li/docsify/compare/v4.3.2...v4.3.3) (2017-09-06)
### Bug Fixes
* **buble.css:** tweaks code block style, fixed [#249](https://github.com/QingWei-Li/docsify/issues/249) ([9d43051](https://github.com/QingWei-Li/docsify/commit/9d43051))
### Features
* add doc for react and vue demo box plugin ([#247](https://github.com/QingWei-Li/docsify/issues/247)) ([f0aca19](https://github.com/QingWei-Li/docsify/commit/f0aca19))
<a name="4.3.2"></a>
<a name="4.3.2"></a>
## [4.3.2](https://github.com/QingWei-Li/docsify/compare/v4.3.1...v4.3.2) (2017-09-01)
### Bug Fixes
* sidebar highlight ([f82f419](https://github.com/QingWei-Li/docsify/commit/f82f419))
### Features
* add Edit on github plugin (thanks [@njleonzhang](https://github.com/njleonzhang)) ([a0e1ea8](https://github.com/QingWei-Li/docsify/commit/a0e1ea8))
<a name="4.3.1"></a>
<a name="4.3.1"></a>
## [4.3.1](https://github.com/QingWei-Li/docsify/compare/v4.2.9...v4.3.1) (2017-08-30)
### Features
* **markdown:** supports mermaid [#137](https://github.com/QingWei-Li/docsify/issues/137) ([f4800e0](https://github.com/QingWei-Li/docsify/commit/f4800e0))
<a name="4.3.0"></a>
# [4.3.0](https://github.com/QingWei-Li/docsify/compare/v4.2.9...v4.3.0) (2017-08-17)
### Features
* **markdown:** supports mermaid [#137](https://github.com/QingWei-Li/docsify/issues/137) ([f4800e0](https://github.com/QingWei-Li/docsify/commit/f4800e0))
<a name="4.2.9"></a>
<a name="4.2.9"></a>
## [4.2.9](https://github.com/QingWei-Li/docsify/compare/v4.2.8...v4.2.9) (2017-08-15)
### Bug Fixes
* ensure document ready before init Docsify [#233](https://github.com/QingWei-Li/docsify/issues/233)
<a name="4.2.8"></a>
## [4.2.8](https://github.com/QingWei-Li/docsify/compare/v4.2.7...v4.2.8) (2017-08-10)
### Features
* **compiler:** support for setting target attribute for link, fixed [#230](https://github.com/QingWei-Li/docsify/issues/230) ([7f270f9](https://github.com/QingWei-Li/docsify/commit/7f270f9))
<a name="4.2.7"></a>
<a name="4.2.7"></a>
## [4.2.7](https://github.com/QingWei-Li/docsify/compare/v4.2.4...v4.2.7) (2017-08-05)
### Bug Fixes
* **release:** release shell ([628e211](https://github.com/QingWei-Li/docsify/commit/628e211))
* **style:** nowrap => pre-wrap, fixed [#228](https://github.com/QingWei-Li/docsify/issues/228) ([a88252c](https://github.com/QingWei-Li/docsify/commit/a88252c))
<a name="4.2.6"></a>
<a name="4.2.6"></a>
## [4.2.6](https://github.com/QingWei-Li/docsify/compare/v4.2.4...v4.2.6) (2017-07-27)
### Bug Fixes
* **css:** hide the nav when the content has not yet been loaded ([1fa1619](https://github.com/QingWei-Li/docsify/commit/1fa1619))
* **release:** release shell ([628e211](https://github.com/QingWei-Li/docsify/commit/628e211))
<a name="4.2.4"></a>
<a name="4.2.4"></a>
## [4.2.4](https://github.com/QingWei-Li/docsify/compare/v4.2.2...v4.2.4) (2017-07-26)
### Bug Fixes
* **render:** Remove getRootNode to be compatible with the lower version of Chrome, fixed [#225](https://github.com/QingWei-Li/docsify/issues/225) ([b8dd346](https://github.com/QingWei-Li/docsify/commit/b8dd346))
<a name="4.2.3"></a>
## [4.2.3](https://github.com/QingWei-Li/docsify/compare/v4.2.2...v4.2.3) (2017-07-26)
### Features
* **search:** Supports the max depth of the search headline, fixed [#223](https://github.com/QingWei-Li/docsify/issues/223), resolve [#129](https://github.com/QingWei-Li/docsify/issues/129) ([b7b589b](https://github.com/QingWei-Li/docsify/commit/b7b589b))
<a name="4.2.2"></a>
<a name="4.2.2"></a>
## [4.2.2](https://github.com/QingWei-Li/docsify/compare/v4.2.1...v4.2.2) (2017-07-24)
### Bug Fixes
* style rerender due to setting themeColor ([17ff3d1](https://github.com/QingWei-Li/docsify/commit/17ff3d1))
<a name="4.2.1"></a>
<a name="4.2.1"></a>
## [4.2.1](https://github.com/QingWei-Li/docsify/compare/v4.2.0...v4.2.1) (2017-07-19)
* give the navbar some line-height (#216)
* Remove unnecessary moduleName option from rollup config for plugins (#209)
- give the navbar some line-height (#216)
- Remove unnecessary moduleName option from rollup config for plugins (#209)
<a name="4.2.0"></a>
# [4.2.0](https://github.com/QingWei-Li/docsify/compare/v4.1.14...v4.2.0) (2017-07-10)
### Bug Fixes
* not found page ([9af8559](https://github.com/QingWei-Li/docsify/commit/9af8559))
### Features
* alias option supports regexp, resolve [#183](https://github.com/QingWei-Li/docsify/issues/183) ([c4aa22c](https://github.com/QingWei-Li/docsify/commit/c4aa22c))
* ignore to compiled link, fixed [#203](https://github.com/QingWei-Li/docsify/issues/203) ([#204](https://github.com/QingWei-Li/docsify/issues/204)) ([2e00f4c](https://github.com/QingWei-Li/docsify/commit/2e00f4c))
<a name="4.1.14"></a>
<a name="4.1.14"></a>
## [4.1.14](https://github.com/QingWei-Li/docsify/compare/v4.1.13...v4.1.14) (2017-06-24)
### Bug Fixes
* get file path, fixed jrappen/sublime-distractionless/commit/81bfadd391428823191cc03eca956a2312e04d13#commitcomment-22427070 ([e8117e5](https://github.com/QingWei-Li/docsify/commit/e8117e5)), closes [jrappen/sublime-distractionless/commit/81bfadd391428823191cc03eca956a2312e04d13#commitcomment-22427070](https://github.com/jrappen/sublime-distractionless/commit/81bfadd391428823191cc03eca956a2312e04d13/issues/commitcomment-22427070)
### Features
* add context attribute, fixed [#191](https://github.com/QingWei-Li/docsify/issues/191) ([ce0e9ac](https://github.com/QingWei-Li/docsify/commit/ce0e9ac))
<a name="4.1.13"></a>
<a name="4.1.13"></a>
## [4.1.13](https://github.com/QingWei-Li/docsify/compare/v4.1.12...v4.1.13) (2017-06-11)
<a name="4.1.12"></a>
<a name="4.1.12"></a>
## [4.1.12](https://github.com/QingWei-Li/docsify/compare/v4.1.11...v4.1.12) (2017-06-03)
### Bug Fixes
* **render:** subtitle in side bar shows undefined, fixed [#182](https://github.com/QingWei-Li/docsify/issues/182) ([d087d57](https://github.com/QingWei-Li/docsify/commit/d087d57))
<a name="4.1.11"></a>
<a name="4.1.11"></a>
## [4.1.11](https://github.com/QingWei-Li/docsify/compare/v4.1.10...v4.1.11) (2017-06-02)
### Bug Fixes
* **compiler:** force reset toc when rendering sidebar fixed [#181](https://github.com/QingWei-Li/docsify/issues/181) ([ccf4c7c](https://github.com/QingWei-Li/docsify/commit/ccf4c7c))
* **render:** autoHeader does not work ([1304d2e](https://github.com/QingWei-Li/docsify/commit/1304d2e))
<a name="4.1.10"></a>
<a name="4.1.10"></a>
## [4.1.10](https://github.com/QingWei-Li/docsify/compare/v4.1.9...v4.1.10) (2017-06-02)
### Bug Fixes
* **hash:** hash routing crashes when url has querystring ([6d48ce1](https://github.com/QingWei-Li/docsify/commit/6d48ce1))
<a name="4.1.9"></a>
<a name="4.1.9"></a>
## [4.1.9](https://github.com/QingWei-Li/docsify/compare/v4.1.8...v4.1.9) (2017-05-31)
### Bug Fixes
* can't render toc on first load ([d9b487e](https://github.com/QingWei-Li/docsify/commit/d9b487e))
* **lifecycle:** continue to handle data ([955d3d5](https://github.com/QingWei-Li/docsify/commit/955d3d5))
* **render:** broken name link, fixed [#167](https://github.com/QingWei-Li/docsify/issues/167) ([91b66a5](https://github.com/QingWei-Li/docsify/commit/91b66a5))
<a name="4.1.8"></a>
<a name="4.1.8"></a>
## [4.1.8](https://github.com/QingWei-Li/docsify/compare/v4.1.7...v4.1.8) (2017-05-31)
### Bug Fixes
* auto replace version ([22b50f0](https://github.com/QingWei-Li/docsify/commit/22b50f0))
* update edit button demo ([ec887c1](https://github.com/QingWei-Li/docsify/commit/ec887c1))
### Features
* add edit button demo ([a64cee1](https://github.com/QingWei-Li/docsify/commit/a64cee1))
* add edit button demo, close [#162](https://github.com/QingWei-Li/docsify/issues/162) ([036fdac](https://github.com/QingWei-Li/docsify/commit/036fdac))
<a name="4.1.7"></a>
<a name="4.1.7"></a>
## [4.1.7](https://github.com/QingWei-Li/docsify/compare/v4.1.6...v4.1.7) (2017-05-30)
### Bug Fixes
* **ssr:** clean files ([0014895](https://github.com/QingWei-Li/docsify/commit/0014895))
<a name="4.1.6"></a>
<a name="4.1.6"></a>
## [4.1.6](https://github.com/QingWei-Li/docsify/compare/v4.1.5...v4.1.6) (2017-05-30)
### Bug Fixes
* **ssr:** add debug ([6b9e092](https://github.com/QingWei-Li/docsify/commit/6b9e092))
<a name="4.1.5"></a>
<a name="4.1.5"></a>
## [4.1.5](https://github.com/QingWei-Li/docsify/compare/v4.1.4...v4.1.5) (2017-05-30)
### Bug Fixes
* **ssr:** missing package ([6db8c9e](https://github.com/QingWei-Li/docsify/commit/6db8c9e))
* **ssr:** missing package ([6db8c9e](https://github.com/QingWei-Li/docsify/commit/6db8c9e))
<a name="4.1.4"></a>
## [4.1.4](https://github.com/QingWei-Li/docsify/compare/v4.1.3...v4.1.4) (2017-05-30)
### Bug Fixes
* **ssr:** file path ([79a83bc](https://github.com/QingWei-Li/docsify/commit/79a83bc))
<a name="4.1.3"></a>
<a name="4.1.3"></a>
## [4.1.3](https://github.com/QingWei-Li/docsify/compare/v4.1.2...v4.1.3) (2017-05-30)
### Bug Fixes
* update babel config ([9825db4](https://github.com/QingWei-Li/docsify/commit/9825db4))
<a name="4.1.2"></a>
<a name="4.1.2"></a>
## [4.1.2](https://github.com/QingWei-Li/docsify/compare/v4.1.1...v4.1.2) (2017-05-30)
### Bug Fixes
* update babel config ([80dba19](https://github.com/QingWei-Li/docsify/commit/80dba19))
<a name="4.1.1"></a>
<a name="4.1.1"></a>
## [4.1.1](https://github.com/QingWei-Li/docsify/compare/v4.1.0...v4.1.1) (2017-05-30)
### Bug Fixes
* build for ssr package ([4cb20a5](https://github.com/QingWei-Li/docsify/commit/4cb20a5))
* remove history mode ([0e74e6c](https://github.com/QingWei-Li/docsify/commit/0e74e6c))
<a name="4.1.0"></a>
<a name="4.1.0"></a>
# [4.1.0](https://github.com/QingWei-Li/docsify/compare/v4.0.2...v4.1.0) (2017-05-30)
<a name="4.0.2"></a>
<a name="4.0.2"></a>
## [4.0.2](https://github.com/QingWei-Li/docsify/compare/v4.0.1...v4.0.2) (2017-05-30)
### Bug Fixes
* basePath for history mode ([fc1cd3f](https://github.com/QingWei-Li/docsify/commit/fc1cd3f))
<a name="4.0.1"></a>
<a name="4.0.1"></a>
## [4.0.1](https://github.com/QingWei-Li/docsify/compare/v4.0.0...v4.0.1) (2017-05-29)
### Bug Fixes
* **ssr:** remove context ([4626157](https://github.com/QingWei-Li/docsify/commit/4626157))
* lint ([b764b6e](https://github.com/QingWei-Li/docsify/commit/b764b6e))
<a name="4.0.0"></a>
<a name="4.0.0"></a>
# [4.0.0](https://github.com/QingWei-Li/docsify/compare/v3.7.3...v4.0.0) (2017-05-29)
### Bug Fixes
* **render:** init event in ssr ([eba1c98](https://github.com/QingWei-Li/docsify/commit/eba1c98))
* lint ([1f4514d](https://github.com/QingWei-Li/docsify/commit/1f4514d))
### Features
* finish ssr ([3444884](https://github.com/QingWei-Li/docsify/commit/3444884))
* init ocsify-server-renderer ([6dea685](https://github.com/QingWei-Li/docsify/commit/6dea685))
* support history mode ([f095eb8](https://github.com/QingWei-Li/docsify/commit/f095eb8))
-67
View File
@@ -1,67 +0,0 @@
# Contribute
## Introduction
First, thank you for considering contributing to docsify! It's people like you that make the open source community such a great community! 😊
We welcome any type of contribution, not only code. You can help with
- **QA**: file bug reports, the more details you can give the better (e.g. screenshots with the console open)
- **Marketing**: writing blog posts, howto's, printing stickers, ...
- **Community**: presenting the project at meetups, organizing a dedicated meetup for the local community, ...
- **Code**: take a look at the [open issues](issues). Even if you can't write code, commenting on them, showing that you care about a given issue matters. It helps us triage them.
- **Money**: we welcome financial contributions in full transparency on our [open collective](https://opencollective.com/docsify).
## Your First Contribution
Working on your first Pull Request? You can learn how from this *free* series, [How to Contribute to an Open Source Project on GitHub](https://egghead.io/series/how-to-contribute-to-an-open-source-project-on-github).
## Submitting code
Any code change should be submitted as a pull request. The description should explain what the code does and give steps to execute it. The pull request should also contain tests.
## Code review process
The bigger the pull request, the longer it will take to review and merge. Try to break down large pull requests in smaller chunks that are easier to review and merge.
It is also always helpful to have some context for your pull request. What was the purpose? Why does it matter to you?
## Financial contributions
We also welcome financial contributions in full transparency on our [open collective](https://opencollective.com/docsify).
Anyone can file an expense. If the expense makes sense for the development of the community, it will be "merged" in the ledger of our open collective by the core contributors and the person who filed the expense will be reimbursed.
## Questions
If you have any questions, create an [issue](issue) (protip: do a quick search first to see if someone else didn't ask the same question before!).
You can also reach us at hello@docsify.opencollective.com.
## Credits
### Contributors
Thank you to all the people who have already contributed to docsify!
<a href="graphs/contributors"><img src="https://opencollective.com/docsify/contributors.svg?width=890" /></a>
### Backers
Thank you to all our backers! [[Become a backer](https://opencollective.com/docsify#backer)]
<a href="https://opencollective.com/docsify#backers" target="_blank"><img src="https://opencollective.com/docsify/backers.svg?width=890"></a>
### Sponsors
Thank you to all our sponsors! (please ask your company to also support this open source project by [becoming a sponsor](https://opencollective.com/docsify#sponsor))
<a href="https://opencollective.com/docsify/sponsor/0/website" target="_blank"><img src="https://opencollective.com/docsify/sponsor/0/avatar.svg"></a>
<a href="https://opencollective.com/docsify/sponsor/1/website" target="_blank"><img src="https://opencollective.com/docsify/sponsor/1/avatar.svg"></a>
<a href="https://opencollective.com/docsify/sponsor/2/website" target="_blank"><img src="https://opencollective.com/docsify/sponsor/2/avatar.svg"></a>
<a href="https://opencollective.com/docsify/sponsor/3/website" target="_blank"><img src="https://opencollective.com/docsify/sponsor/3/avatar.svg"></a>
<a href="https://opencollective.com/docsify/sponsor/4/website" target="_blank"><img src="https://opencollective.com/docsify/sponsor/4/avatar.svg"></a>
<a href="https://opencollective.com/docsify/sponsor/5/website" target="_blank"><img src="https://opencollective.com/docsify/sponsor/5/avatar.svg"></a>
<a href="https://opencollective.com/docsify/sponsor/6/website" target="_blank"><img src="https://opencollective.com/docsify/sponsor/6/avatar.svg"></a>
<a href="https://opencollective.com/docsify/sponsor/7/website" target="_blank"><img src="https://opencollective.com/docsify/sponsor/7/avatar.svg"></a>
<a href="https://opencollective.com/docsify/sponsor/8/website" target="_blank"><img src="https://opencollective.com/docsify/sponsor/8/avatar.svg"></a>
<a href="https://opencollective.com/docsify/sponsor/9/website" target="_blank"><img src="https://opencollective.com/docsify/sponsor/9/avatar.svg"></a>
<!-- This `CONTRIBUTING.md` is based on @nayafia's template https://github.com/nayafia/contributing-template -->
+1 -1
View File
@@ -1,6 +1,6 @@
MIT License
Copyright (c) 2016 - present cinwell.li
Copyright (c) 2016 - 2017 cinwell.li
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
+71 -58
View File
@@ -9,98 +9,111 @@
</p>
<p align="center">
<a href="#backers"><img alt="Backers on Open Collective" src="https://opencollective.com/docsify/backers/badge.svg?style=flat-square"></a>
<a href="#sponsors"><img alt="Sponsors on Open Collective" src="https://opencollective.com/docsify/sponsors/badge.svg?style=flat-square"></a>
<a href="https://travis-ci.org/QingWei-Li/docsify"><img alt="Travis Status" src="https://img.shields.io/travis/QingWei-Li/docsify/master.svg?style=flat-square"></a>
<a href="https://www.npmjs.com/package/docsify"><img alt="npm" src="https://img.shields.io/npm/v/docsify.svg?style=flat-square"></a>
<a href="https://github.com/QingWei-Li/donate"><img alt="donate" src="https://img.shields.io/badge/%24-donate-ff69b4.svg?style=flat-square"></a>
</p>
<p align="center">Glod Sponsor via <a href="https://opencollective.com/docsify">Open Collective</a></p>
<p align="center">
<a href="https://opencollective.com/docsify/tiers/gold-sponsor/website">
<img src="https://opencollective.com/docsify/tiers/gold-sponsor.svg?avatarHeight=36">
</a>
</p>
## Links
* [Documentation](https://docsify.js.org)
* [CLI](https://github.com/QingWei-Li/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/QingWei-Li/awesome-docsify)
- [Documentation](https://docsify.js.org)
- [CLI](https://github.com/QingWei-Li/docsify-cli)
- CDN: [UNPKG](https://unpkg.com/docsify/) | [jsDelivr](https://cdn.jsdelivr.net/npm/docsify/) | [cdnjs](https://cdnjs.com/libraries/docsify)
## Features
* No statically built html files
* Simple and lightweight (~19kB gzipped)
* Smart full-text search plugin
* Multiple themes
* Useful plugin API
* Compatible with IE10+
* Support SSR ([example](https://github.com/QingWei-Li/docsify-ssr-demo))
* Support embedded files
- No statically built html files
- Simple and lightweight (~18kB gzipped)
- Smart full-text search plugin
- Multiple themes
- Useful plugin API
- Compatible with IE10+
- Support SSR ([example](https://github.com/QingWei-Li/docsify-ssr-demo))
## Quick start
Look at [this tutorial](https://docsify.js.org/#/quickstart) or [online demo](https://jsfiddle.net/7ztb8qsr/1/).
Create an `index.html`.
```html
<!-- index.html -->
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,initial-scale=1">
<meta charset="UTF-8">
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/docsify/lib/themes/vue.css">
</head>
<body>
<div id="app"></div>
<script src="//cdn.jsdelivr.net/npm/docsify/lib/docsify.min.js"></script>
</body>
</html>
```
## Browser Support
Modern browsers and Internet Explorer 10+.
## Showcase
These projects are using docsify to generate their sites. Pull requests welcome :blush:
Move to [awesome-docsify](https://github.com/QingWei-Li/awesome-docsify)
| Project | Description |
|---|---|
| [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 |
| [JS MythBusters](https://mythbusters.js.org) | An optimization handbook from a high level point of view. |
| [hire-me](https://fvcproductions.github.io/hire-me) | A path to getting an awesome tech gig. |
| [vue-amap](https://elemefe.github.io/vue-amap/) | A Map Component Library Base on Vue 2.x and Gaode Map. |
| [samlify](https://samlify.js.org) | Node.js SAML2 library |
| [palettify](https://dobromir-hristov.github.io/palettify/) | A color palette effects assistant |
| [commitlint](https://marionebl.github.io/commitlint/) | Lint commit messages |
| [vue-data-tables](https://github.com/njleonzhang/vue-data-tables/) | A simple and customizable data table, based on vue2 and element-ui. |
| [Noty](http://ned.im/noty/) | A Dependency-free notification library |
| [xTeko](https://docs.xteko.com/) | Addins framework for Pin 3.0 |
| [vue2-datatable-component](https://github.com/OneWayTech/vue2-datatable) | The best Datatable for Vue.js 2.x which never sucks |
| [Solidarity](https://infinitered.github.io/solidarity/) | Environment enforcer for your projects across machines. |
| [rnback](https://rnback.com/) | Backend service for react-native applications. |
| [IT-films](https://greybax.github.com/IT-films/) | A curated list of awesome movies, documentaries and TV series about hackers, geeks and IT in common, sorted by IMDB rating. |
| [zooming](http://desmonding.me/zooming/docs) | Image zoom that makes sense. |
| [vue-sticker](https://kamilocean.github.io/vue-sticker/#/) | Vue component, that helps to make sticky effects |
| [Ts.ED](https://romakita.github.io/ts-express-decorators/#/) | A TypeScript Framework on top of Express |
| [Ts.LogDebug](https://romakita.github.io/ts-log-debug/#/) | A multi channel logger written in TypeScript |
| [vue-orgchart](https://spiritree.github.io/vue-orgchart) | Vue.js wrapper for OrgChart.js |
## Similar projects
| Project | Description |
| ------------------------------------------------ | ---------------------------------------- |
| [docute](https://github.com/egoist/docute) | 📜 Effortlessly documentation done right |
| [docpress](https://github.com/docpress/docpress) | Documentation website generator |
| Project | Description |
|---|---|
| [docute](https://github.com/egoist/docute) | 📜 Effortlessly documentation done right |
| [docpress](https://github.com/docpress/docpress) | Documentation website generator |
## Contributing
* Fork it!
* Create your feature branch: `git checkout -b my-new-feature`
* Commit your changes: `git commit -am 'Add some feature'`
* Push to the branch: `git push origin my-new-feature`
* Submit a pull request
- Fork it!
- Create your feature branch: `git checkout -b my-new-feature`
- Commit your changes: `git commit -am 'Add some feature'`
- Push to the branch: `git push origin my-new-feature`
- Submit a pull request
## Development
```bash
npm run bootstrap && npm run dev
open http://localhost:3000
```
## Backers
Thank you to all our backers! 🙏 [[Become a backer](https://opencollective.com/docsify#backers)]
<a href="https://opencollective.com/docsify#backers" target="_blank"><img src="https://opencollective.com/docsify/backers.svg?width=890"></a>
## 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)]
<a href="https://opencollective.com/docsify/silver-sponsors/0/website" target="_blank"><img src="https://opencollective.com/docsify/silver-sponsors/0/avatar.svg"></a>
<a href="https://opencollective.com/docsify/silver-sponsors/1/website" target="_blank"><img src="https://opencollective.com/docsify/silver-sponsors/1/avatar.svg"></a>
<a href="https://opencollective.com/docsify/silver-sponsors/2/website" target="_blank"><img src="https://opencollective.com/docsify/silver-sponsors/2/avatar.svg"></a>
<a href="https://opencollective.com/docsify/silver-sponsors/3/website" target="_blank"><img src="https://opencollective.com/docsify/silver-sponsors/3/avatar.svg"></a>
<a href="https://opencollective.com/docsify/silver-sponsors/4/website" target="_blank"><img src="https://opencollective.com/docsify/silver-sponsors/4/avatar.svg"></a>
<a href="https://opencollective.com/docsify/silver-sponsors/5/website" target="_blank"><img src="https://opencollective.com/docsify/silver-sponsors/5/avatar.svg"></a>
<a href="https://opencollective.com/docsify/silver-sponsors/6/website" target="_blank"><img src="https://opencollective.com/docsify/silver-sponsors/6/avatar.svg"></a>
<a href="https://opencollective.com/docsify/silver-sponsors/7/website" target="_blank"><img src="https://opencollective.com/docsify/silver-sponsors/7/avatar.svg"></a>
<a href="https://opencollective.com/docsify/silver-sponsors/8/website" target="_blank"><img src="https://opencollective.com/docsify/silver-sponsors/8/avatar.svg"></a>
<a href="https://opencollective.com/docsify/silver-sponsors/9/website" target="_blank"><img src="https://opencollective.com/docsify/silver-sponsors/9/avatar.svg"></a>
## Contributors
This project exists thanks to all the people who contribute. [[Contribute](CONTRIBUTING.md)].
<a href="https://github.com/QingWei-Li/docsify/graphs/contributors"><img src="https://opencollective.com/docsify/contributors.svg?width=890" /></a>
## License
MIT
[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bhttps%3A%2F%2Fgithub.com%2FQingWei-Li%2Fdocsify.svg?type=large)](https://app.fossa.io/projects/git%2Bhttps%3A%2F%2Fgithub.com%2FQingWei-Li%2Fdocsify?ref=badge_large)
+53
View File
@@ -0,0 +1,53 @@
var serveStatic = require('serve-static')
var http = require('http')
var fs = require('fs')
var Renderer = require('./packages/docsify-server-renderer/build.js')
var renderer = new Renderer({
template: `
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>docsify</title>
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<link rel="stylesheet" href="/themes/vue.css" title="vue">
</head>
<body>
<!--inject-app-->
<!--inject-config-->
<script src="/lib/docsify.js"></script>
</body>
</html>`,
config: {
name: 'docsify',
repo: 'qingwei-li/docsify',
basePath: 'https://docsify.js.org/',
loadNavbar: true,
loadSidebar: true,
subMaxLevel: 3,
auto2top: true,
alias: {
'/de-de/changelog': '/changelog',
'/zh-cn/changelog': '/changelog',
'/changelog':
'https://raw.githubusercontent.com/QingWei-Li/docsify/master/CHANGELOG'
}
},
path: './'
})
http
.createServer(function (req, res) {
serveStatic('.')(req, res, function () {
// TEST SSR
// renderer.renderToString(req.url)
// .then(html => res.end(html))
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`)
+50
View File
@@ -0,0 +1,50 @@
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)
})
})
+3 -4
View File
@@ -5,12 +5,11 @@ var replace = require('rollup-plugin-replace')
rollup
.rollup({
input: 'packages/docsify-server-renderer/index.js',
entry: 'packages/docsify-server-renderer/index.js',
plugins: [
async(),
replace({
__VERSION__: process.env.VERSION || require('../package.json').version,
'process.env.SSR': true
__VERSION__: process.env.VERSION || require('../package.json').version
}),
buble({
transforms: {
@@ -26,7 +25,7 @@ rollup
console.log(dest)
bundle.write({
format: 'cjs',
file: dest
dest: dest
})
})
.catch(function (err) {
+47 -90
View File
@@ -1,118 +1,75 @@
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 string = require('rollup-plugin-string')
var uglify = require('rollup-plugin-uglify')
var replace = require('rollup-plugin-replace')
var isProd = process.argv[process.argv.length - 1] !== '--dev'
var version = process.env.VERSION || require('../package.json').version
const build = function(opts) {
var build = function (opts) {
rollup
.rollup({
input: opts.input,
entry: 'src/' + opts.entry,
plugins: (opts.plugins || []).concat([
string({ include: '**/*.css' }),
buble(),
commonjs(),
nodeResolve(),
replace({
__VERSION__: version,
'process.env.SSR': false
__VERSION__: version
})
])
})
.then(function(bundle) {
var dest = 'lib/' + (opts.output || opts.input)
.then(function (bundle) {
var dest = 'lib/' + (opts.output || opts.entry)
console.log(dest)
bundle.write({
format: 'iife',
file: dest,
strict: false
dest: dest
})
})
.catch(function(err) {
.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' },
{ name: 'ga', entry: 'ga.js' },
{ name: 'emoji', entry: 'emoji.js' },
{ name: 'external-script', entry: 'external-script.js' },
{ name: 'front-matter', entry: 'front-matter/index.js' },
{ name: 'zoom-image', entry: 'zoom-image.js' },
{ name: 'disqus', entry: 'disqus.js' },
{ name: 'gitalk', entry: 'gitalk.js' }
]
plugins.forEach(item => {
build({
input: 'src/core/index.js',
output: 'docsify.js'
entry: 'plugins/' + item.entry,
output: 'plugins/' + item.name + '.js'
})
})
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: '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',
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()
}
-12
View File
@@ -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)
})
})
+4 -8
View File
@@ -1,6 +1,5 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>docsify</title>
@@ -15,7 +14,6 @@
}
</style>
</head>
<body>
<div id="app"></div>
<script>
@@ -24,7 +22,6 @@
'.*?/changelog': 'https://raw.githubusercontent.com/QingWei-Li/docsify/master/CHANGELOG',
'/.*/_navbar.md': '/_navbar.md'
},
notFoundPage: '_404.html',
auto2top: true,
basePath: '/docs/',
executeScript: true,
@@ -36,14 +33,14 @@
mergeNavbar: true,
formatUpdated: '{MM}/{DD} {HH}:{mm}',
plugins: [
function (hook, vm) {
function(hook, vm) {
hook.beforeEach(function (html) {
var url = 'https://github.com/QingWei-Li/docsify/blob/master/' + vm.route.file
var editHtml = '[:memo: Edit Document](' + url + ')\n'
return editHtml
+ html
+ '\n\n----\n\n'
+ '\n----\n'
+ 'Last modified {docsify-updated} '
+ editHtml
})
@@ -53,5 +50,4 @@
</script>
<script src="/lib/docsify.js"></script>
</body>
</html>
</html>
+1 -2
View File
@@ -11,13 +11,12 @@ See the [Quick start](quickstart.md) for more details.
## Features
* No statically built html files
* Simple and lightweight (~19kB gzipped)
* Simple and lightweight (~18kB gzipped)
* Smart full-text search plugin
* Multiple themes
* Useful plugin API
* Emoji support
* Compatible with IE10+
- Support SSR ([example](https://github.com/QingWei-Li/docsify-ssr-demo))
## Examples
+5 -4
View File
@@ -1,12 +1,13 @@
![logo](_media/icon.svg)
# docsify <small>4.7.0</small>
# docsify <small>4.5.7</small>
> A magical documentation site generator.
* Simple and lightweight (~19kB gzipped)
* No statically built html files
* Multiple themes
- Simple and lightweight (~18kB gzipped)
- No statically built html files
- Multiple themes
[GitHub](https://github.com/QingWei-Li/docsify/)
[Get Started](#docsify)
-1
View File
@@ -1 +0,0 @@
<h1>To infinity and Beyond!</h1>
-1
View File
@@ -1 +0,0 @@
> This is from the `example.md`
-2
View File
@@ -2,5 +2,3 @@
- [:cn: 中文](/zh-cn/)
- [:de: Deutsch](/de-de/)
- [:uk: English](/)
- [:es: Spanish](https://docsify-es.js.org)
- [:ru: Russian](https://docsify-ru.js.org)
+20 -25
View File
@@ -1,28 +1,23 @@
* Getting started
- Getting started
- [Quick start](quickstart.md)
- [Writing more pages](more-pages.md)
- [Custom navbar](custom-navbar.md)
- [Cover page](cover.md)
* [Quick start](quickstart.md)
* [Writing more pages](more-pages.md)
* [Custom navbar](custom-navbar.md)
* [Cover page](cover.md)
- 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)
* Customization
- Guide
- [Deploy](deploy.md)
- [Helpers](helpers.md)
- [Vue compatibility](vue.md)
- [CDN](cdn.md)
- [Offline Mode(PWA)](pwa.md)
- [Server-client renderer(SSR)](ssr.md)
* [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)
* Guide
* [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 <sup style="color:red">(new)<sup>](embed-files.md)
* [Awesome docsify](awesome.md)
* [Changelog](changelog.md)
- [Changelog](changelog.md)
+1 -1
View File
@@ -12,7 +12,7 @@ Recommended: [unpkg](//unpkg.com), which will reflect the latest version as soon
<script src="//unpkg.com/docsify/lib/docsify.js"></script>
```
Alternatively, use [compressed files](#compressed-file).
Alternatively, use [compressed files](#compressed-files).
## Specific version
+68 -163
View File
@@ -1,8 +1,9 @@
# Configuration
You can configure the `window.$docsify`.
**docsify** supports two different ways of configuration. You can configure the `window.$docsify` or write configuration on the script tag via `data-*` attributes.
```html
<!-- by $docsify -->
<script>
window.$docsify = {
repo: 'QingWei-Li/docsify',
@@ -10,8 +11,20 @@ You can configure the `window.$docsify`.
coverpage: true
}
</script>
<!-- or data-* -->
<script
src="//unpkg.com/docsify"
data-repo="QingWei-Li/docsify"
data-max-level="3"
data-coverpage>
</script>
```
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
@@ -37,10 +50,10 @@ window.$docsify = {
repo: 'QingWei-Li/docsify',
// or
repo: 'https://github.com/QingWei-Li/docsify/'
};
}
```
## maxLevel
## max-level
- Type: `Number`
- Default: `6`
@@ -50,10 +63,10 @@ Maximum Table of content level.
```js
window.$docsify = {
maxLevel: 4
};
}
```
## loadNavbar
## load-navbar
- Type: `Boolean|String`
- Default: `false`
@@ -67,10 +80,10 @@ window.$docsify = {
// load from nav.md
loadNavbar: 'nav.md'
};
}
```
## loadSidebar
## load-sidebar
- Type: `Boolean|String`
- Default: `false`
@@ -84,10 +97,10 @@ window.$docsify = {
// load from summary.md
loadSidebar: 'summary.md'
};
}
```
## subMaxLevel
## sub-max-level
- Type: `Number`
- Default: `0`
@@ -97,7 +110,7 @@ Add table of contents (TOC) in custom sidebar.
```js
window.$docsify = {
subMaxLevel: 2
};
}
```
## auto2top
@@ -110,7 +123,7 @@ Scrolls to the top of the screen when the route is changed.
```js
window.$docsify = {
auto2top: true
};
}
```
## homepage
@@ -126,12 +139,11 @@ window.$docsify = {
homepage: 'home.md',
// Or use the readme in your repo
homepage:
'https://raw.githubusercontent.com/QingWei-Li/docsify/master/README.md'
};
homepage: 'https://raw.githubusercontent.com/QingWei-Li/docsify/master/README.md'
}
```
## basePath
## base-path
- Type: `String`
@@ -145,14 +157,13 @@ 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/'
}
```
## 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`.
@@ -162,29 +173,8 @@ 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
@@ -196,10 +186,10 @@ Website name as it appears in the sidebar.
```js
window.$docsify = {
name: 'docsify'
};
}
```
## nameLink
## name-link
- Type: `String`
- Default: `window.location.pathname`
@@ -215,7 +205,7 @@ window.$docsify = {
'/zh-cn/': '/zh-cn/',
'/': '/'
}
};
}
```
## markdown
@@ -237,14 +227,14 @@ window.$docsify = {
},
// function
markdown: function(marked, renderer) {
markdown: function (marked, renderer) {
// ...
return marked;
return marked
}
};
}
```
## themeColor
## theme-color
- Type: `String`
@@ -253,7 +243,7 @@ Customize the theme color. Use [CSS3 variables](https://developer.mozilla.org/en
```js
window.$docsify = {
themeColor: '#3F51B5'
};
}
```
## alias
@@ -267,14 +257,13 @@ window.$docsify = {
alias: {
'/foo/(+*)': '/bar/$1', // supports regexp
'/zh-cn/changelog': '/changelog',
'/changelog':
'https://raw.githubusercontent.com/QingWei-Li/docsify/master/CHANGELOG',
'/changelog': 'https://raw.githubusercontent.com/QingWei-Li/docsify/master/CHANGELOG',
'/.*/_sidebar.md': '/_sidebar.md' // See #301
}
};
}
```
## autoHeader
## auto-header
- type: `Boolean`
@@ -284,19 +273,19 @@ If `loadSidebar` and `autoHeader` are both enabled, for each link in `_sidebar.m
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
@@ -309,7 +298,7 @@ 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
## no-emoji
- type: `Boolean`
@@ -318,10 +307,10 @@ Disabled emoji parse.
```js
window.$docsify = {
noEmoji: true
};
}
```
## mergeNavbar
## merge-navbar
- type: `Boolean`
@@ -330,149 +319,65 @@ Navbar will be merged with the sidebar on smaller screens.
```js
window.$docsify = {
mergeNavbar: true
};
}
```
## formatUpdated
## format-updated
- type: `String|Function`
We can display the file update date through **{docsify-updated<span>}</span>** variable. And format it by `formatUpdated`.
See https://github.com/lukeed/tinydate#patterns
```js
window.$docsify = {
formatUpdated: '{MM}/{DD} {HH}:{mm}',
formatUpdated: function(time) {
formatUpdated: function (time) {
// ...
return time;
return time
}
};
}
```
## externalLinkTarget
## external-link-target
- type: `String`
- default: `_blank`
- default: `_self`
Target to open external links. Default `'_blank'` (new window/tab)
```js
window.$docsify = {
externalLinkTarget: '_self' // default: '_blank'
};
}
```
## routerMode
## router-mode
- type: `String`
- default: `hash`
- default: `history`
```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/QingWei-Li/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
};
noCompileLinks: [
'/foo',
'/bar/.*'
]
}
```
## 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<string>`
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.
+3 -46
View File
@@ -26,9 +26,9 @@ Set `coverpage` to **true**, and create a `_coverpage.md`:
> A magical documentation site generator.
* Simple and lightweight (~19kB gzipped)
* No statically built html files
* Multiple themes
- Simple and lightweight (~18kB gzipped)
- No statically built html files
- Multiple themes
[GitHub](https://github.com/QingWei-Li/docsify/)
[Get Started](#docsify)
@@ -49,51 +49,8 @@ The background color is generated randomly by default. You can customize the bac
[Get Started](#quick-start)
<!-- background image -->
![](_media/bg.png)
<!-- background color -->
![color](#f0f0f0)
```
## 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'
}
};
```
+18 -19
View File
@@ -20,7 +20,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`, compare [load-navbar configuration](configuration.md#load-navbar).
```html
<!-- index.html -->
@@ -36,13 +36,13 @@ Alternatively, you can create a custom markdown-based navigation file by setting
```markdown
<!-- _navbar.md -->
* [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,24 +51,23 @@ You can create sub-lists by indenting items that are under a certain parent.
```markdown
<!-- _navbar.md -->
* Getting started
- Getting started
- [Quick start](quickstart.md)
- [Writing more pages](more-pages.md)
- [Custom navbar](custom-navbar.md)
- [Cover page](cover.md)
* [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.md)
- [Themes](themes.md)
- [Using plugins](plugins.md)
- [Markdown configuration](markdown.md)
- [Language highlight](language-highlight.md)
```
renders as
![Nesting navbar](_images/nested-navbar.png 'Nesting navbar')
![Nesting navbar](_images/nested-navbar.png "Nesting navbar")
## Combining custom navbars with the emoji plugin
@@ -91,6 +90,6 @@ you could, for example, use flag emojis in your custom navbar Markdown file:
```markdown
<!-- _navbar.md -->
* [:us:, :uk:](/)
* [:cn:](/zh-cn/)
- [:us:, :uk:](/)
- [:cn:](/zh-cn/)
```
+1 -2
View File
@@ -11,13 +11,12 @@ Siehe [Schnellstart](de-de/quickstart.md) für weitere Informationen.
## Features
* keine generierten, statischen HTML Dateien
* einfach und klein (~19kB gzipped)
* einfach und klein (~18kB gzipped)
* smarte Erweiterung mit Volltextsuche
* mehrere Themes
* praktische API für Erweiterungen
* Unterstützung für Emoji
* Kompatibel mit IE10+
- Support SSR ([example](https://github.com/QingWei-Li/docsify-ssr-demo))
## Beispiele
+20 -25
View File
@@ -1,28 +1,23 @@
* Loslegen
- Loslegen
- [Schnellstart](de-de/quickstart.md)
- [Schreiben weiterer Seiten](de-de/more-pages.md)
- [Navigationsleiste anpassen](de-de/custom-navbar.md)
- [Titelseite](de-de/cover.md)
* [Schnellstart](de-de/quickstart.md)
* [Schreiben weiterer Seiten](de-de/more-pages.md)
* [Navigationsleiste anpassen](de-de/custom-navbar.md)
* [Titelseite](de-de/cover.md)
- Anpassen
- [Einstellungen](de-de/configuration.md)
- [Themen](de-de/themes.md)
- [Liste der Erweiterungen](de-de/plugins.md)
- [Schreiben eigener Erweiterungen](de-de/write-a-plugin.md)
- [Markdown-Einstellungen](de-de/markdown.md)
- [Hervorheben von Sprachen](de-de/language-highlight.md)
* Anpassen
- Guide
- [Inbetriebnahme](de-de/deploy.md)
- [Helfer](de-de/helpers.md)
- [Vue Kompatibilität](de-de/vue.md)
- [CDN](de-de/cdn.md)
- [Offline Modus (PWA)](de-de/pwa.md)
- [Server-client renderer (SSR)](de-de/ssr.md)
* [Einstellungen](de-de/configuration.md)
* [Themen](de-de/themes.md)
* [Liste der Erweiterungen](de-de/plugins.md)
* [Schreiben eigener Erweiterungen](de-de/write-a-plugin.md)
* [Markdown-Einstellungen](de-de/markdown.md)
* [Hervorheben von Sprachen](de-de/language-highlight.md)
* Guide
* [Inbetriebnahme](de-de/deploy.md)
* [Helfer](de-de/helpers.md)
* [Vue Kompatibilität](de-de/vue.md)
* [CDN](de-de/cdn.md)
* [Offline Modus (PWA)](de-de/pwa.md)
* [Server-Side Rendering (SSR)](de-de/ssr.md)
* [Embed Files <sup style="color:red">(new)<sup>](de-de/embed-files.md)
* [Awesome docsify](de-de/awesome.md)
* [Changelog](de-de/changelog.md)
- [Changelog](de-de/changelog.md)
+64 -168
View File
@@ -1,8 +1,9 @@
# Einstellungen
You can configure the `window.$docsify`.
**docsify** unterstützt zwei verschiedene Arten, um die Einstellungen anzupassen. Du kannst das `window.$docsify` anpassen, oder die Einstellungen über das script tag im `data-*` Attribut vornehmen.
```html
<!-- über $docsify -->
<script>
window.$docsify = {
repo: 'QingWei-Li/docsify',
@@ -10,8 +11,20 @@ You can configure the `window.$docsify`.
coverpage: true
}
</script>
<!-- oder data-* -->
<script
src="//unpkg.com/docsify"
data-repo="QingWei-Li/docsify"
data-max-level="3"
data-coverpage>
</script>
```
Beide Arten sind miteinander kompatibel, wobei die erste jedoch empfohlen wird. Sie ist deutlicher und kann in einer separaten Datei geführt werden.
!> Innerhalb des `window.$docsfiy` sollten die Optionen mit camelCase geschrieben werden.
## el
- Typ: `String`
@@ -22,7 +35,7 @@ Das DOM Element kann bei der Initialisierung gesetzt werden. Es kann ein CSS sel
```js
window.$docsify = {
el: '#app'
};
}
```
## repo
@@ -37,10 +50,10 @@ window.$docsify = {
repo: 'QingWei-Li/docsify',
// oder
repo: 'https://github.com/QingWei-Li/docsify/'
};
}
```
## maxLevel
## max-level
- Typ: `Number`
- Standard: `6`
@@ -50,10 +63,10 @@ Maximale Anzahl der Inhaltsübersichtebenen.
```js
window.$docsify = {
maxLevel: 4
};
}
```
## loadNavbar
## load-navbar
- Typ: `Boolean|String`
- Standard: `false`
@@ -67,10 +80,10 @@ window.$docsify = {
// lade von nav.md
loadNavbar: 'nav.md'
};
}
```
## loadSidebar
## load-sidebar
- Typ: `Boolean|String`
- Standard: `false`
@@ -84,10 +97,10 @@ window.$docsify = {
// lade von summary.md
loadSidebar: 'summary.md'
};
}
```
## subMaxLevel
## sub-max-level
- Typ: `Number`
- Standard: `0`
@@ -97,7 +110,7 @@ Wähle die maximale Anzahl der Unterpunkte pro Datei in der Inhaltsübersicht.
```js
window.$docsify = {
subMaxLevel: 2
};
}
```
## auto2top
@@ -110,7 +123,7 @@ Scrolle zum Anfang der Seite, wenn die Route gewechselt wird.
```js
window.$docsify = {
auto2top: true
};
}
```
## homepage
@@ -126,12 +139,11 @@ window.$docsify = {
homepage: 'home.md',
// Oder verwende das README in deinem repo
homepage:
'https://raw.githubusercontent.com/QingWei-Li/docsify/master/README.md'
};
homepage: 'https://raw.githubusercontent.com/QingWei-Li/docsify/master/README.md'
}
```
## basePath
## base-path
- Typ: `String`
@@ -145,9 +157,8 @@ window.$docsify = {
basePath: 'https://docsify.js.org/',
// Oder lade Dateien von einem anderen repo
basePath:
'https://raw.githubusercontent.com/ryanmcdermott/clean-code-javascript/master/'
};
basePath: 'https://raw.githubusercontent.com/ryanmcdermott/clean-code-javascript/master/'
}
```
## coverpage
@@ -162,29 +173,8 @@ window.$docsify = {
coverpage: true,
// Anderer Dateiname
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
@@ -196,10 +186,10 @@ Webseitenname, wie er in der Inhaltsübersicht in der Seitenleiste angezeigt wir
```js
window.$docsify = {
name: 'docsify'
};
}
```
## nameLink
## name-link
- Typ: `String`
- Standard: `window.location.pathname`
@@ -215,7 +205,7 @@ window.$docsify = {
'/zh-cn/': '/zh-cn/',
'/': '/'
}
};
}
```
## markdown
@@ -237,14 +227,14 @@ window.$docsify = {
},
// Funktion
markdown: function(marked, renderer) {
markdown: function (marked, renderer) {
// ...
return marked;
return marked
}
};
}
```
## themeColor
## theme-color
- Typ: `String`
@@ -253,7 +243,7 @@ Passe die Farbe der Themen an. Verwende [CSS3 Variablen](https://developer.mozil
```js
window.$docsify = {
themeColor: '#3F51B5'
};
}
```
## alias
@@ -267,14 +257,13 @@ window.$docsify = {
alias: {
'/foo/(+*)': '/bar/$1', // supports regexp
'/zh-cn/changelog': '/changelog',
'/changelog':
'https://raw.githubusercontent.com/QingWei-Li/docsify/master/CHANGELOG',
'/changelog': 'https://raw.githubusercontent.com/QingWei-Li/docsify/master/CHANGELOG',
'/.*/_sidebar.md': '/_sidebar.md' // See #301
}
};
}
```
## autoHeader
## auto-header
- Typ: `Boolean`
@@ -284,19 +273,19 @@ Sollten `loadSidebar` und `autoHeader` beide aktiviert sein, setze einen Header
window.$docsify = {
loadSidebar: true,
autoHeader: true
};
}
```
## executeScript
## execute-script
- Typ: `Boolean`
Führe das Skript auf der Seite aus. Analysiere nur das erste script tag ([demo](de-de/themes.md)). Sollte Vue verwendet sein, wird es in der Standardeinstellung ausgeführt.
Führe das Skript auf der Seite aus. Analysiere nur das erste script tag ([demo](de-de/themes.md)). Sollte Vue verwendet sein, wird es in der Standardeinstellung ausgeführt.
```js
window.$docsify = {
executeScript: true
};
}
```
```markdown
@@ -309,158 +298,65 @@ window.$docsify = {
?> Nehme zur Kenntnis, dass, solltest du ein externes Skript ausführen, z.B. ein eingebettete jsfiddle demo, du sicher gehen solltest, das [external-script](de-de/plugins.md?id=external-script) plugin zu verwenden.
## noEmoji
- type: `Boolean`
## no-emoji
Verhindere die Umwandlung in Emojis:
```js
window.$docsify = {
noEmoji: true
};
}
```
## mergeNavbar
- type: `Boolean`
## merge-navbar
Navbar will be merged with the sidebar on smaller screens.
```js
window.$docsify = {
mergeNavbar: true
};
}
```
## formatUpdated
- type: `String|Function`
## format-updated
We can display the file update date through **{docsify-updated<span>}</span>** variable. And format it by `formatUpdated`.
See https://github.com/lukeed/tinydate#patterns
```js
window.$docsify = {
formatUpdated: '{MM}/{DD} {HH}:{mm}',
formatUpdated: function(time) {
formatUpdated: function (time) {
// ...
return time;
return time
}
};
}
```
## externalLinkTarget
## external-link-target
- type: `String`
- default: `_blank`
Currently it defaults to \_blank, would be nice if configurable:
Currently it defaults to _blank, would be nice if configurable:
```js
window.$docsify = {
externalLinkTarget: '_self' // default: '_blank'
};
}
```
## routerMode
- type: `String`
- default: `history`
```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/QingWei-Li/docsify/issues/203)
```js
window.$docsify = {
noCompileLinks: ['/foo', '/bar/.*']
};
```
## requestHeaders
- type: `Object`
Set the request resource headers.
```js
window.$docsify = {
requestHeaders: {
'x-token': 'xxx'
}
};
noCompileLinks: [
'/foo',
'/bar/.*'
]
}
```
## ext
- type: `String`
Request file extension.
```js
window.$docsify = {
ext: '.md'
};
```
## fallbackLanguages
- type: `Array<string>`
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.
+3 -46
View File
@@ -26,9 +26,9 @@ Setze `coverpage` auf **true**, und erstelle `_coverpage.md`:
> Ein magischer Generator für Dokumentationsseiten.
* Einfach und wenig Speicherbedarf (~19kB gzipped)
* Keine statischen HTML Dateien
* Mehrere Themes
- Einfach und wenig Speicherbedarf (~18kB gzipped)
- Keine statischen HTML Dateien
- Mehrere Themes
[GitHub](https://github.com/QingWei-Li/docsify/)
[Schnellstart](#docsify)
@@ -49,51 +49,8 @@ Die Hintergrundfarbe wird in der Standardeinstellung zufällig generiert. Du kan
[Schnellstart](#quick-start)
<!-- Hintegrundbild -->
![](_media/bg.png)
<!-- Hintegrundfarbe -->
![color](#f0f0f0)
```
## Coverpage as homepage
Normal, the coverpage and the homepage appear at the same time. Of course, you can also separate the coverpage by [onlyCover option](de-de/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'
}
};
```
+18 -19
View File
@@ -20,7 +20,7 @@ Solltest du eine Navigationsleiste benötigen, so kannst du eine HTML-basierte e
## Markdown
Oder du kannst deine Navigationsleiste mit einer Datei basierend auf Markdown erstellen, indem du `loadNavbar` auf **true** setzt und eine Datei namens `_navbar.md` erstellst, vergleiche [loadNavbar Einstellungen](configuration.md#loadnavbar).
Oder du kannst deine Navigationsleiste mit einer Datei basierend auf Markdown erstellen, indem du `loadNavbar` auf **true** setzt und eine Datei namens `_navbar.md` erstellst, vergleiche [load-navbar Einstellungen](configuration.md#load-navbar).
```html
<!-- index.html -->
@@ -36,13 +36,13 @@ Oder du kannst deine Navigationsleiste mit einer Datei basierend auf Markdown er
```markdown
<!-- _navbar.md -->
* [En](/)
* [Deutsch](/de-de/)
- [En](/)
- [Deutsch](/de-de/)
```
!> Solltest du Github Pages verwenden, musst du zusätzlich eine Datei namens `.nojekyll` in `./docs` erstellen, um zu verhindern, dass Github Dateien ignoriert, die mit einem Unterstrich anfangen.
`_navbar.md` wird in jedem Verzeichnislevel geladen. Sollte das aktuelle Verzeichnis keine Datei namens `_navbar.md` haben, so sucht **docsify** in den übergeordneten Ordnern. Wenn du z.B. im Moment im Verzeichnis `/guide/quick-start` bist, so wird `_navbar.md` von der Datei `/guide/_navbar.md` geladen.
`_navbar.md` wird in jedem Verzeichnislevel geladen. Sollte das aktuelle Verzeichnis keine Datei namens `_navbar.md` haben, so sucht **docsify** in den übergeordneten Ordnern. Wenn du z.B. im Moment im Verzeichnis `/guide/quick-start` bist, so wird `_navbar.md` von der Datei `/guide/_navbar.md` geladen.
## Aufbauen von Strukturen
@@ -51,24 +51,23 @@ Du kannst untergeordnete Listen erstellen, indem du untergeordnete Punkte einem
```markdown
<!-- _navbar.md -->
* Getting started
- Getting started
- [Quick start](de-de/quickstart.md)
- [Writing more pages](de-de/more-pages.md)
- [Custom navbar](de-de/custom-navbar.md)
- [Cover page](de-de/cover.md)
* [Quick start](de-de/quickstart.md)
* [Writing more pages](de-de/more-pages.md)
* [Custom navbar](de-de/custom-navbar.md)
* [Cover page](de-de/cover.md)
* Configuration
* [Configuration](de-de/configuration.md)
* [Themes](de-de/themes.md)
* [Using plugins](de-de/plugins.md)
* [Markdown configuration](de-de/markdown.md)
* [Language highlight](de-de/language-highlight.md)
- Configuration
- [Configuration](de-de/configuration.md)
- [Themes](de-de/themes.md)
- [Using plugins](de-de/plugins.md)
- [Markdown configuration](de-de/markdown.md)
- [Language highlight](de-de/language-highlight.md)
```
wird also wie folgt aussehen
![Nesting navbar](../_images/nested-navbar.png 'Nesting navbar')
![Nesting navbar](_images/nested-navbar.png "Nesting navbar")
## Angepasste Navigationsleisten in Verbindung mit dem emoji Erweiterung
@@ -91,6 +90,6 @@ so kannst du z.B. auch die Flaggenemojis in der Markdown Datei für deine angepa
```markdown
<!-- _navbar.md -->
* [:us:, :uk:](/)
* [:de:](/de-de/)
- [:us:, :uk:](/)
- [:de:](/de-de/)
```
+7 -19
View File
@@ -6,23 +6,24 @@
Du kannst folgende drei Orte verwenden, um die Dokumentation für dein Github repository zu verwalten:
- `docs/` Ordner
- master branch
- gh-pages branch
* `docs/` Ordner
* master branch
* gh-pages branch
Es wird empfohlen, deine Dateien im `./docs` Unterordner im `master` branch deines repository zu speichern. Wechsle dann zu den Einstellungen deines repository und wähle `master branch /docs folder` als deine Github Pages Quelle.
![github pages](../_images/deploy-github-pages.png)
![github pages](_images/deploy-github-pages.png)
!> Du kannst die Dateien auch im Hauptverzeichnis speichern und dann `master branch` in den Einstellungen auswählen.
## 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
``` YAML
pages:
stage: deploy
script:
@@ -38,6 +39,7 @@ pages:
!> You can replace script with `- cp -r docs/. public`, if `./docs` is your Docsify subfolder.
## VPS
Verwende folgende nginx config.
@@ -53,17 +55,3 @@ server {
}
}
```
## 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
```
-66
View File
@@ -1,66 +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')
## 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).
+21 -29
View File
@@ -19,12 +19,12 @@ wird wie folgt gerendert:
Generelle Tipps wie:
```markdown
?> _TODO_ unit test
?> *TODO* unit test
```
wird wie folgt gerendert:
?> _TODO_ unit test
?> *TODO* unit test
## Ignore to compile link
@@ -34,18 +34,18 @@ Some time we will put some other relative path to the link, you have to need to
[link](/demo/)
```
It will be compiled to `<a href="/#/demo/">link</a>` 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')
[link](/demo/ ":ignore")
```
You will get `<a href="/demo/">link</a>`html. Do not worry, you can still set title for link.
```md
[link](/demo/ ':ignore title')
[link](/demo/ ":ignore title")
<a href="/demo/" title="title">link</a>
```
@@ -53,34 +53,26 @@ You will get `<a href="/demo/">link</a>`html. Do not worry, you can still set ti
## Set target attribute for link
```md
[link](/demo ':target=_blank')
[link](/demo2 ':target=_self')
[link](/demo ":target=_blank")
[link](/demo2 ":target=_self")
```
## Github Task Lists
```md
- [ ] foo
- bar
- [x] baz
- [] bam <~ not working
- [ ] bim
- [ ] lim
* [ ] foo
* bar
* [x] baz
* [] bam
* [ ] bim
* [ ] lim
```
- [ ] foo
- bar
- [x] baz
- [] bam <~ not working
- [ ] bim
- [ ] lim
## Image resizing
```md
![logo](https://docsify.js.org/_media/icon.svg ':size=50x100')
![logo](https://docsify.js.org/_media/icon.svg ':size=100')
```
![logo](https://docsify.js.org/_media/icon.svg ':size=50x100')
![logo](https://docsify.js.org/_media/icon.svg ':size=100')
* [ ] foo
* bar
* [x] baz
* [] bam
* [ ] bim
* [ ] lim
+2 -2
View File
@@ -1,6 +1,6 @@
# Markdown Einstellungen
**docsify** verwendet [marked](https://github.com/markedjs/marked), um Markdown umzuwandeln. Du kannst einstellen, wie es deine Markdown Seiten in HTML umwandelt, indem du `renderer` konfigurierst:
**docsify** verwendet [marked](https://github.com/chjj/marked), um Markdown umzuwandeln. Du kannst einstellen, wie es deine Markdown Seiten in HTML umwandelt, indem du `renderer` konfigurierst:
```js
window.$docsify = {
@@ -15,7 +15,7 @@ window.$docsify = {
}
```
?> Für mögliche Einstellungen, siehe [marked Dokumentation](https://github.com/markedjs/marked#options-1)
?> Für mögliche Einstellungen, siehe [marked Dokumentation](https://github.com/chjj/marked#options-1)
Du kannst die Regeln auch beliebig anpassen.
+5 -20
View File
@@ -27,7 +27,7 @@ docs/de-de/guide.md => http://domain.com/de-de/guide
Als Standardeinstellung wird das Inhaltsverzeichnis in der Seitenleiste automatisch basierend auf vorhandenen Markdown Dateien generiert. Wenn du das seitliche Inhaltsverzeichnis anpassen willst, kannst du eine Datei namens `_sidebar.md` erstellen (vergleiche [das seitliche Inhaltsverzeichnis für diese Dokumentation](https://github.com/QingWei-Li/docsify/blob/master/docs/de-de/_sidebar.md) als Beispiel):
Als Erstes musst du `loadSidebar` auf **true** setzen, vergleiche [Einstellungen für das seitliche Inhaltsverzeichnis](configuration.md#loadsidebar).
Als Erstes musst du `loadSidebar` auf **true** setzen, vergleiche [Einstellungen für das seitliche Inhaltsverzeichnis](configuration.md#load-sidebar).
```html
<!-- index.html -->
@@ -45,30 +45,17 @@ Als Zweites erstellst du eine Datei namens `_sidebar.md`:
```markdown
<!-- docs/_sidebar.md -->
* [Home](/)
* [Guide](de-de/guide.md)
- [Home](/)
- [Guide](de-de/guide.md)
```
!> Solltest du Github Pages verwenden, musst du zusätzlich eine Datei namens `.nojekyll` in `./docs` erstellen, um zu verhindern, dass Github Dateien ignoriert, die mit einem Unterstrich anfangen.
`_sidebar.md` wird in jedem Verzeichnislevel geladen. Sollte das aktuelle Verzeichnis keine Datei namens `_sidebar.md` haben, so sucht **docsify** in den übergeordneten Ordnern. Wenn du z.B. im Moment im Verzeichnis `/guide/quick-start` bist, so wird `_sidebar.md` von der Datei `/guide/_sidebar.md` geladen.
You can specify `alias` to avoid unnecessary fallback.
```html
<script>
window.$docsify = {
loadSidebar: true,
alias: {
'/.*/_sidebar.md': '/_sidebar.md'
}
}
</script>
```
`_sidebar.md` wird in jedem Verzeichnislevel geladen. Sollte das aktuelle Verzeichnis keine Datei namens `_sidebar.md` haben, so sucht **docsify** in den übergeordneten Ordnern. Wenn du z.B. im Moment im Verzeichnis `/guide/quick-start` bist, so wird `_sidebar.md` von der Datei `/guide/_sidebar.md` geladen.
## Inhaltsverzeichnis
Eine angepasste Seitenleist kann auch automatisch ein Inhaltsverzeichnis generieren, indem ein `subMaxLevel` gesetzt wird, vergleiche [subMaxLevel Einstellungen](configuration.md#submaxlevel).
Eine angepasste Seitenleist kann auch automatisch ein Inhaltsverzeichnis generieren, indem ein `subMaxLevel` gesetzt wird, vergleiche [sub-max-level Einstellungen](configuration.md#sub-max-level).
```html
<!-- index.html -->
@@ -90,7 +77,6 @@ When `subMaxLevel` is set, each header is automatically added to the table of co
# Getting Started
## Header {docsify-ignore}
This header won't appear in the sidebar table of contents.
```
@@ -100,7 +86,6 @@ To ignore all headers on a specific page, you can use `{docsify-ignore-all}` on
# Getting Started {docsify-ignore-all}
## Header
This header won't appear in the sidebar table of contents.
```
+23 -3
View File
@@ -4,6 +4,7 @@
Als Standardeinstellung werden Hyperlinks auf der aktuellen Seite erkannt und der Inhalt in `localStorage` gespeichert. Du kannst den Pfad zu den Dateien auch anpassen:
```html
<script>
window.$docsify = {
@@ -66,6 +67,12 @@ Konfiguration über `data-ga`:
<script src="//unpkg.com/docsify/lib/plugins/ga.min.js"></script>
```
## front matter
```html
<script src="//unpkg.com/docsify/lib/plugins/front-matter.min.js"></script>
```
## emoji
Als Standardeinstellung werden emojis umgewandelt. Als Beispiel wird `:100:` umgewandelt in :100:. Aber das ist nicht genau, das es keine passende Nicht-emoji Zeichenfolge gibt. Solltest du emojis richtig umwandeln wollen, musst du diese Erweiterung verwenden.
@@ -104,6 +111,7 @@ When readers expand the demo box, the source code and description are shown ther
[Vue](https://njleonzhang.github.io/docsify-demo-box-vue/) and [React](https://njleonzhang.github.io/docsify-demo-box-react/) are both supported.
## 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)
@@ -113,11 +121,22 @@ Add `Edit on github` button on every pages. Provided by [@njleonzhang](https://g
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
<script src="//unpkg.com/docsify-copy-code"></script>
<link rel="stylesheet" href="//unpkg.com/docsify-copy-code/styles.css">
<script src="//unpkg.com/docsify-copy-code/index.js"></script>
```
```javascript
window.$docsify = {
plugins: [
window.DocsifyCopyCodePlugin.init()
]
}
```
See [here](https://github.com/jperasmus/docsify-copy-code/blob/master/README.md) for more details.
## Disqus
Disqus comments. https://disqus.com/
@@ -131,9 +150,10 @@ Disqus comments. https://disqus.com/
<script src="//unpkg.com/docsify/lib/plugins/disqus.min.js"></script>
```
## Gitalk
[Gitalk](https://github.com/gitalk/gitalk) is a modern comment component based on Github Issue and Preact.
[Gitalk](https://github.com/gitalk/gitalk) is a modern comment component based on Github Issue and Preact.
```html
<link rel="stylesheet" href="//unpkg.com/gitalk/dist/gitalk.css">
@@ -153,7 +173,7 @@ Disqus comments. https://disqus.com/
</script>
```
## Pagination
## Navigation
Pagination for docsify. By [@imyelo](https://github.com/imyelo)
+1 -6
View File
@@ -51,13 +51,8 @@ Wenn du `npm` nicht verwenden möchtest, oder Probleme bei der Installation des
</head>
<body>
<div id="app"></div>
<script>
window.$docsify = {
//...
}
</script>
<script src="//unpkg.com/docsify/lib/docsify.min.js"></script>
</body>
<script src="//unpkg.com/docsify/lib/docsify.min.js"></script>
</html>
```
+1 -1
View File
@@ -1,4 +1,4 @@
# Server-Side Rendering
# Server client renderer
See https://docsify.now.sh
-6
View File
@@ -54,9 +54,3 @@ Solltest du weitere Themes erstellen, kannst du sie gerne der Allgemeinheit mit
});
};
</script>
## Other themes
- [docsify-themeable](https://jhildenbiddle.github.io/docsify-themeable/#/) A delightfully simple theme system for docsify.
+5 -38
View File
@@ -6,16 +6,16 @@ Similar to [GitBook](https://www.gitbook.com), you can deploy files to GitHub Pa
There're three places to populate your docs for your Github repository:
- `docs/` folder
- master branch
- gh-pages branch
* `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.
![github pages](_images/deploy-github-pages.png)
!> 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
!> You'll need to place a `.nojekyll` file in the deploy location (such as `/docs` or the gh-pages branch
## GitLab Pages
@@ -23,7 +23,7 @@ If you are deploying your master branch, include `.gitlab-ci.yml` with the follo
?> The `.public` workaround is so `cp` doesn't also copy `public/` to itself in an infinite loop.
```YAML
``` YAML
pages:
stage: deploy
script:
@@ -39,25 +39,6 @@ pages:
!> 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
Try following nginx config.
@@ -73,17 +54,3 @@ server {
}
}
```
## 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
```
-66
View File
@@ -1,66 +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')
## 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).
+21 -29
View File
@@ -19,12 +19,12 @@ is rendered as:
General tips like:
```markdown
?> _TODO_ unit test
?> *TODO* unit test
```
are rendered as:
?> _TODO_ unit test
?> *TODO* unit test
## Ignore to compile link
@@ -34,18 +34,18 @@ Some time we will put some other relative path to the link, you have to need to
[link](/demo/)
```
It will be compiled to `<a href="/#/demo/">link</a>` 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')
[link](/demo/ ":ignore")
```
You will get `<a href="/demo/">link</a>`html. Do not worry, you can still set title for link.
```md
[link](/demo/ ':ignore title')
[link](/demo/ ":ignore title")
<a href="/demo/" title="title">link</a>
```
@@ -53,40 +53,32 @@ You will get `<a href="/demo/">link</a>`html. Do not worry, you can still set ti
## Set target attribute for link
```md
[link](/demo ':target=_blank')
[link](/demo2 ':target=_self')
[link](/demo ":target=_blank")
[link](/demo2 ":target=_self")
```
## Disable link
```md
[link](/demo ':disabled')
[link](/demo ":disabled")
```
## Github Task Lists
```md
- [ ] foo
- bar
- [x] baz
- [] bam <~ not working
- [ ] bim
- [ ] lim
* [ ] foo
* bar
* [x] baz
* [] bam
* [ ] bim
* [ ] lim
```
- [ ] foo
- bar
- [x] baz
- [] bam <~ not working
- [ ] bim
- [ ] lim
* [ ] foo
* bar
* [x] baz
* [] bam
* [ ] bim
* [ ] lim
## Image resizing
```md
![logo](https://docsify.js.org/_media/icon.svg ':size=50x100')
![logo](https://docsify.js.org/_media/icon.svg ':size=100')
```
![logo](https://docsify.js.org/_media/icon.svg ':size=50x100')
![logo](https://docsify.js.org/_media/icon.svg ':size=100')
+6 -12
View File
@@ -1,11 +1,9 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>docsify</title>
<link rel="icon" href="_media/favicon.ico">
<meta name="google-site-verification" content="6t0LoIeFksrjF4c9sqUEsVXiQNxLp2hgoqo0KryT-sE" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta name="keywords" content="doc,docs,documentation,gitbook,creator,generator,github,jekyll,github-pages">
<meta name="description" content="A magical documentation generator.">
@@ -14,21 +12,18 @@
<link rel="stylesheet" href="//unpkg.com/docsify/lib/themes/dark.css" title="dark" disabled>
<link rel="stylesheet" href="//unpkg.com/docsify/lib/themes/buble.css" title="buble" disabled>
<link rel="stylesheet" href="//unpkg.com/docsify/lib/themes/pure.css" title="pure" disabled>
<script src="//unpkg.com/docsify-plugin-codefund@1.0.3/index.js"></script>
<style>
nav.app-nav li ul {
min-width: 100px;
}
</style>
</head>
<body>
<div id="app">Loading ...</div>
<script>
window.$docsify = {
alias: {
'.*?/awesome': 'https://raw.githubusercontent.com/QingWei-Li/awesome-docsify/master/README.md',
'.*?/changelog': 'https://raw.githubusercontent.com/QingWei-Li/docsify/master/CHANGELOG.md',
'.*?/changelog': 'https://raw.githubusercontent.com/QingWei-Li/docsify/master/CHANGELOG',
'/.*/_navbar.md': '/_navbar.md'
},
auto2top: true,
@@ -56,18 +51,18 @@
},
formatUpdated: '{MM}/{DD} {HH}:{mm}',
plugins: [
function (hook, vm) {
function(hook, vm) {
hook.beforeEach(function (html) {
var url = 'https://github.com/QingWei-Li/docsify/blob/master/docs/' + vm.route.file
var editHtml = '[:memo: Edit Document](' + url + ')\n'
return editHtml
+ html
+ '\n\n----\n\n'
+ '<a href="https://docsify.js.org" target="_blank" style="color: inherit; font-weight: normal; text-decoration: none;">Powered by docsify</a>'
+ '\n----\n'
+ 'Last modified {docsify-updated} '
+ editHtml
})
},
DocsifyCodefund.create('fae1f9a4-870c-4c25-b8e0-c80464f7a95c')
}
]
}
</script>
@@ -78,5 +73,4 @@
<script src="//unpkg.com/prismjs/components/prism-markdown.min.js"></script>
<script src="//unpkg.com/prismjs/components/prism-nginx.min.js"></script>
</body>
</html>
+8 -25
View File
@@ -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/QingWei-Li/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.md#load-sidebar).
```html
<!-- index.html -->
@@ -45,32 +45,17 @@ Create the `_sidebar.md`:
```markdown
<!-- docs/_sidebar.md -->
* [Home](/)
* [Guide](guide.md)
- [Home](/)
- [Guide](guide.md)
```
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.
`_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
<script>
window.$docsify = {
loadSidebar: true,
alias: {
'/.*/_sidebar.md': '/_sidebar.md'
}
}
</script>
```
`_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`, compare [sub-max-level configuration](configuration.md#sub-max-level).
```html
<!-- index.html -->
@@ -92,7 +77,6 @@ When `subMaxLevel` is set, each header is automatically added to the table of co
# Getting Started
## Header {docsify-ignore}
This header won't appear in the sidebar table of contents.
```
@@ -102,7 +86,6 @@ To ignore all headers on a specific page, you can use `{docsify-ignore-all}` on
# Getting Started {docsify-ignore-all}
## Header
This header won't appear in the sidebar table of contents.
```
+22 -18
View File
@@ -4,6 +4,7 @@
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
<script>
window.$docsify = {
@@ -66,6 +67,12 @@ Configure by `data-ga`.
<script src="//unpkg.com/docsify/lib/plugins/ga.min.js"></script>
```
## front matter
```html
<script src="//unpkg.com/docsify/lib/plugins/front-matter.min.js"></script>
```
## 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.
@@ -96,6 +103,7 @@ Exclude the special image
![](image.png ':no-zoom')
```
## 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)
@@ -108,16 +116,27 @@ When readers expand the demo box, the source code and description are shown ther
[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
<script src="//unpkg.com/docsify-copy-code"></script>
<link rel="stylesheet" href="//unpkg.com/docsify-copy-code/styles.css">
<script src="//unpkg.com/docsify-copy-code/index.js"></script>
```
```javascript
window.$docsify = {
plugins: [
window.DocsifyCopyCodePlugin.init()
]
}
```
See [here](https://github.com/jperasmus/docsify-copy-code/blob/master/README.md) for more details.
## Disqus
Disqus comments. https://disqus.com/
@@ -133,7 +152,7 @@ Disqus comments. https://disqus.com/
## Gitalk
[Gitalk](https://github.com/gitalk/gitalk) is a modern comment component based on Github Issue and Preact.
[Gitalk](https://github.com/gitalk/gitalk) is a modern comment component based on Github Issue and Preact.
```html
<link rel="stylesheet" href="//unpkg.com/gitalk/dist/gitalk.css">
@@ -153,7 +172,7 @@ Disqus comments. https://disqus.com/
</script>
```
## Pagination
## Navigation
Pagination for docsify. By [@imyelo](https://github.com/imyelo)
@@ -162,18 +181,3 @@ Pagination for docsify. By [@imyelo](https://github.com/imyelo)
<script src="//unpkg.com/docsify-pagination/dist/docsify-pagination.min.js"></script>
```
## codefund
a [plugin](https://github.com/njleonzhang/docsify-plugin-codefund) to make it easy to join up [codefund](https://codesponsor.io/)
> codefund is formerly known as "codesponsor"
```
<script src="//unpkg.com/docsify/lib/docsify.min.js"></script>
window.$docsify = {
plugins: [
DocsifyCodefund.create('xxxx-xxx-xxx') // change to your codefund id
]
}
```
+1 -6
View File
@@ -51,13 +51,8 @@ If you don't like `npm` or have trouble installing the tool, you can manually cr
</head>
<body>
<div id="app"></div>
<script>
window.$docsify = {
//...
}
</script>
<script src="//unpkg.com/docsify/lib/docsify.min.js"></script>
</body>
<script src="//unpkg.com/docsify/lib/docsify.min.js"></script>
</html>
```
+7 -7
View File
@@ -1,4 +1,4 @@
# Server-Side Rendering
# Server client renderer
See https://docsify.now.sh
@@ -30,7 +30,7 @@ Edit `package.json`. If the documentation in `./docs` subdirectory.
],
"docsify": {
"config": {
"basePath": "https://docsify.js.org/",
"basePath": 'https://docsify.js.org/',
"loadSidebar": true,
"loadNavbar": true,
"coverpage": true,
@@ -74,12 +74,12 @@ You can provide a template for entire page's HTML. such as
<body>
<!--inject-app-->
<!--inject-config-->
<script src="//unpkg.com/docsify/lib/docsify.js"></script>
<script src="//unpkg.com/docsify/lib/plugins/search.js"></script>
<script src="//unpkg.com/prismjs/components/prism-bash.min.js"></script>
<script src="//unpkg.com/prismjs/components/prism-markdown.min.js"></script>
<script src="//unpkg.com/prismjs/components/prism-nginx.min.js"></script>
</body>
<script src="//unpkg.com/docsify/lib/docsify.js"></script>
<script src="//unpkg.com/docsify/lib/plugins/search.js"></script>
<script src="//unpkg.com/prismjs/components/prism-bash.min.js"></script>
<script src="//unpkg.com/prismjs/components/prism-markdown.min.js"></script>
<script src="//unpkg.com/prismjs/components/prism-nginx.min.js"></script>
</html>
```
-4
View File
@@ -54,7 +54,3 @@ If you have any ideas or would like to develop a new theme, you are welcome to s
});
};
</script>
## Other themes
- [docsify-themeable](https://jhildenbiddle.github.io/docsify-themeable/#/) A delightfully simple theme system for docsify.
+8 -9
View File
@@ -11,15 +11,14 @@ docsify 是一个动态生成文档网站的工具。不同于 GitBook、Hexo
查看[快速开始](zh-cn/quickstart.md)了解详情。
## 特性
* 无需构建,写完文档直接发布
* 容易使用并且轻量 (~19kB gzipped)
* 智能的全文搜索
* 提供多套主题
* 丰富的 API
* 支持 Emoji
* 兼容 IE10+
* 支持 SSR ([example](https://github.com/QingWei-Li/docsify-ssr-demo))
- 无需构建,写完文档直接发布
- 容易使用并且轻量 (~18kB gzipped)
- 智能的全文搜索
- 提供多套主题
- 丰富的 API
- 支持 Emoji
- 兼容 IE10+
- 支持 SSR ([example](https://github.com/QingWei-Li/docsify-ssr-demo))
## 例子
+20 -25
View File
@@ -1,28 +1,23 @@
* 入门
- 入门
- [快速开始](zh-cn/quickstart.md)
- [多页文档](zh-cn/more-pages.md)
- [定制导航栏](zh-cn/custom-navbar.md)
- [封面](zh-cn/cover.md)
* [快速开始](zh-cn/quickstart.md)
* [多页文档](zh-cn/more-pages.md)
* [定制导航栏](zh-cn/custom-navbar.md)
* [封面](zh-cn/cover.md)
- 定制化
- [配置项](zh-cn/configuration.md)
- [主题](zh-cn/themes.md)
- [插件列表](zh-cn/plugins.md)
- [开发插件](zh-cn/write-a-plugin.md)
- [Markdown 配置](zh-cn/markdown.md)
- [代码高亮](zh-cn/language-highlight.md)
* 定制化
- 指南
- [部署](zh-cn/deploy.md)
- [文档助手](zh-cn/helpers.md)
- [兼容 Vue](zh-cn/vue.md)
- [CDN](zh-cn/cdn.md)
- [离线模式(PWA)](zh-cn/pwa.md)
- [服务端渲染 (SSR)](zh-cn/ssr.md)
* [配置项](zh-cn/configuration.md)
* [主题](zh-cn/themes.md)
* [插件列表](zh-cn/plugins.md)
* [开发插件](zh-cn/write-a-plugin.md)
* [Markdown 配置](zh-cn/markdown.md)
* [代码高亮](zh-cn/language-highlight.md)
* 指南
* [部署](zh-cn/deploy.md)
* [文档助手](zh-cn/helpers.md)
* [兼容 Vue](zh-cn/vue.md)
* [CDN](zh-cn/cdn.md)
* [离线模式(PWA)](zh-cn/pwa.md)
* [服务端渲染 (SSR)](zh-cn/ssr.md)
* [文件嵌入<sup style="color:red">(new)<sup>](zh-cn/embed-files.md)
* [Awesome docsify](zh-cn/awesome.md)
* [Changelog](zh-cn/changelog.md)
- [Changelog](zh-cn/changelog.md)
+75 -167
View File
@@ -1,8 +1,9 @@
# 配置项
你可以配置在 `window.$docsify` 里。
docsify 有两种配置参数的方式。一种是配置在 `window.$docsify`,另一种是给 `script` 标签添加 `data-*` 属性
```html
<!-- 方法 1 -->
<script>
window.$docsify = {
repo: 'QingWei-Li/docsify',
@@ -10,8 +11,21 @@
coverpage: true
}
</script>
<!-- 方法 2 -->
<script
src="//unpkg.com/docsify"
data-repo="QingWei-Li/docsify"
data-max-level="3"
data-coverpage>
</script>
```
两种方式可以共存,推荐第一种做法——直接配置 `window.$docsify` 对象——这会让你的配置更加清晰,同时也可以方便的将配置单独写到另一个文件里。
!> 通过 `window.$docsify` 配置属性,需要将属性改成驼峰命名法。通过 `data-*` 属性配置,保持短横线的命名规则。
## el
- 类型:`String`
@@ -22,7 +36,7 @@ docsify 初始化的挂载元素,可以是一个 CSS 选择器,默认为 `#a
```js
window.$docsify = {
el: '#app'
};
}
```
## repo
@@ -37,23 +51,25 @@ window.$docsify = {
repo: 'QingWei-Li/docsify',
// or
repo: 'https://github.com/QingWei-Li/docsify/'
};
}
```
## maxLevel
## max-level
- 类型:`Number`
- 默认值: `6`
默认情况下会抓取文档中所有标题渲染成目录,可配置最大支持渲染的标题层级。
```js
window.$docsify = {
maxLevel: 4
};
}
```
## loadNavbar
## load-navbar
- 类型:`Boolean|String`
- 默认值: `false`
@@ -67,10 +83,10 @@ window.$docsify = {
// 加载 nav.md
loadNavbar: 'nav.md'
};
}
```
## loadSidebar
## load-sidebar
- 类型:`Boolean|String`
- 默认值: `false`
@@ -84,22 +100,24 @@ window.$docsify = {
// 加载 summary.md
loadSidebar: 'summary.md'
};
}
```
## subMaxLevel
## sub-max-level
- 类型:`Number`
- 默认值: `0`
自定义侧边栏后默认不会再生成目录,你也可以通过设置生成目录的最大层级开启这个功能。
```js
window.$docsify = {
subMaxLevel: 2
};
}
```
## auto2top
- 类型:`Boolean`
@@ -110,9 +128,10 @@ window.$docsify = {
```js
window.$docsify = {
auto2top: true
};
}
```
## homepage
- 类型:`String`
@@ -126,12 +145,11 @@ window.$docsify = {
homepage: 'home.md',
// 文档和仓库根目录下的 README.md 内容一致
homepage:
'https://raw.githubusercontent.com/QingWei-Li/docsify/master/README.md'
};
homepage: 'https://raw.githubusercontent.com/QingWei-Li/docsify/master/README.md'
}
```
## basePath
## base-path
- 类型:`String`
@@ -145,11 +163,11 @@ window.$docsify = {
basePath: 'https://docsify.js.org/',
// 甚至直接渲染其他仓库 readme
basePath:
'https://raw.githubusercontent.com/ryanmcdermott/clean-code-javascript/master/'
};
basePath: 'https://raw.githubusercontent.com/ryanmcdermott/clean-code-javascript/master/'
}
```
## coverpage
- 类型:`Boolean|String`
@@ -162,44 +180,24 @@ window.$docsify = {
coverpage: true,
// 自定义文件名
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
- 类型:`String`
文档标题,会显示在侧边栏顶部。
```js
window.$docsify = {
name: 'docsify'
};
}
```
## nameLink
## name-link
- 类型:`String`
- 默认值:`window.location.pathname`
@@ -215,7 +213,7 @@ window.$docsify = {
'/zh-cn/': '/zh-cn/',
'/': '/'
}
};
}
```
## markdown
@@ -237,14 +235,14 @@ window.$docsify = {
},
// function
markdown: function(marked, renderer) {
markdown: function (marked, renderer) {
// ...
return marked;
return marked
}
};
}
```
## themeColor
## theme-color
- 类型:`String`
@@ -253,7 +251,7 @@ window.$docsify = {
```js
window.$docsify = {
themeColor: '#3F51B5'
};
}
```
## alias
@@ -262,19 +260,19 @@ window.$docsify = {
定义路由别名,可以更自由的定义路由规则。 支持正则。
```js
window.$docsify = {
alias: {
'/foo/(+*)': '/bar/$1', // supports regexp
'/zh-cn/changelog': '/changelog',
'/changelog':
'https://raw.githubusercontent.com/QingWei-Li/docsify/master/CHANGELOG',
'/changelog': 'https://raw.githubusercontent.com/QingWei-Li/docsify/master/CHANGELOG',
'/.*/_sidebar.md': '/_sidebar.md' // See #301
}
};
}
```
## autoHeader
## auto-header
- 类型:`Boolean`
@@ -284,10 +282,10 @@ window.$docsify = {
window.$docsify = {
loadSidebar: true,
autoHeader: true
};
}
```
## executeScript
## execute-script
- 类型:`Boolean`
@@ -296,7 +294,7 @@ window.$docsify = {
```js
window.$docsify = {
executeScript: true
};
}
```
```markdown
@@ -305,161 +303,71 @@ window.$docsify = {
<script>
console.log(2333)
</script>
```
注意如果执行的是一个外链脚本,比如 jsfiddle 的内嵌 demo,请确保引入 [external-script](plugins.md?id=外链脚本-external-script) 插件。
## noEmoji
- type: `Boolean`
## no-emoji
禁用 emoji 解析。
```js
window.$docsify = {
noEmoji: true
};
}
```
## mergeNavbar
- type: `Boolean`
## merge-navbar
小屏设备下合并导航栏到侧边栏。
```js
window.$docsify = {
mergeNavbar: true
};
}
```
## formatUpdated
- type: `String|Function`
我们可以显示文档更新日期通过 **{docsify-updated<span>}</span>** 变量. 并且格式化日期通过 `formatUpdated`。参考 https://github.com/lukeed/tinydate#patterns
## format-updated
我们可以显示文档更新日期通过 **{docsify-updated<span>}</span>** 变量. 并且格式化日期通过 `formatUpdated`
参考 https://github.com/lukeed/tinydate#patterns
```js
window.$docsify = {
formatUpdated: '{MM}/{DD} {HH}:{mm}',
formatUpdated: function(time) {
formatUpdated: function (time) {
// ...
return time;
return time
}
};
}
```
## externalLinkTarget
## external-link-target
- type: `String`
- default: `_blank`
当前默认为 \_blank, 配置一下就可以:
当前默认为 _blank, 配置一下就可以:
```js
window.$docsify = {
externalLinkTarget: '_self' // default: '_blank'
};
}
```
## routerMode
- type: `String`
- default: `history`
```js
window.$docsify = {
routerMode: 'history' // default: 'hash'
};
```
## noCompileLinks
- 类型: `Array`
有时我们不希望 docsify 处理我们的链接。 参考 [#203](https://github.com/QingWei-Li/docsify/issues/203)
```js
window.$docsify = {
noCompileLinks: ['/foo', '/bar/.*']
};
```
## requestHeaders
- type: `Object`
设置请求资源的请求头。
```js
window.$docsify = {
requestHeaders: {
'x-token': 'xxx'
}
};
noCompileLinks: [
'/foo',
'/bar/.*'
]
}
```
## ext
- type: `String`
资源的文件扩展名。
```js
window.$docsify = {
ext: '.md'
};
```
## fallbackLanguages
- type: `Array<string>`
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.
+9 -50
View File
@@ -6,7 +6,7 @@
封面的生成同样是从 markdown 文件渲染来的。开启渲染封面功能后在文档根目录创建 `_coverpage.md` 文件。渲染效果如本文档。
_index.html_
*index.html*
```html
<script>
@@ -17,7 +17,7 @@ _index.html_
<script src="//unpkg.com/docsify"></script>
```
_\_coverpage.md_
*_coverpage.md*
```markdown
![logo](_media/icon.svg)
@@ -26,21 +26,24 @@ _\_coverpage.md_
> A magical documentation site generator.
* Simple and lightweight (~12kb gzipped)
* Multiple themes
* Not build static html files
- Simple and lightweight (~12kb gzipped)
- Multiple themes
- Not build static html files
[GitHub](https://github.com/QingWei-Li/docsify/)
[Get Started](#quick-start)
```
!> 一份文档只会在根目录下加载封面,其他页面或者二级目录下都不会加载。
## 自定义背景
目前的背景是随机生成的渐变色,我们自定义背景色或者背景图。在文档末尾用添加图片的 Markdown 语法设置背景。
_\_coverpage.md_
*_coverpage.md*
```markdown
# docsify
@@ -49,51 +52,7 @@ _\_coverpage.md_
[Get Started](#quick-start)
<!-- 背景图片 -->
![](_media/bg.png)
<!-- 背景色 -->
![color](#f0f0f0)
```
## 封面作为首页
通常封面和首页是同时出现的,当然你也是当封面独立出来通过设置[onlyCover 选项](zh-cn/configuration.md#onlycover)。
## 多个封面
如果你的文档网站是多语言的,或许你需要设置多个封面。
例如你的文档目录结构如下
```text
.
└── docs
├── README.md
├── guide.md
├── _coverpage.md
└── zh-cn
├── README.md
└── guide.md
└── _coverpage.md
```
那么你可以这么配置
```js
window.$docsify = {
coverpage: ['/', '/zh-cn/']
};
```
或者具体指名文件名
```js
window.$docsify = {
coverpage: {
'/': 'cover.md',
'/zh-cn/': 'cover.md'
}
};
```
+22 -19
View File
@@ -2,7 +2,7 @@
我们可以直接在 HTML 里定义导航栏,要注意链接要以 `#/` 开头。
_index.html_
*index.html*
```html
<body>
@@ -14,11 +14,13 @@ _index.html_
</body>
```
## 配置文件
那我们可以通过 Markdown 文件来配置导航。首先配置 `loadNavbar`,默认加载的文件为 `_navbar.md`。具体配置规则见[配置项#loadNavbar](configuration.md#loadnavbar)。
那我们可以通过 Markdown 文件来配置导航。首先配置 `loadNavbar`,默认加载的文件为 `_navbar.md`。具体配置规则见[配置项#load-navbar](configuration.md#load-navbar)。
*index.html*
_index.html_
```html
<script>
@@ -29,11 +31,11 @@ _index.html_
<script src="//unpkg.com/docsify"></script>
```
_\_navbar.md_
*_navbar.md*
```markdown
* [En](/)
* [中文](/zh-cn/)
- [En](/)
- [中文](/zh-cn/)
```
`_navbar.md` 加载逻辑和 `sidebar` 文件一致,从每层目录下获取。例如当前路由为 `/zh-cn/custom-navbar` 那么是从 `/zh-cn/_navbar.md` 获取导航栏。
@@ -42,23 +44,24 @@ _\_navbar.md_
如果导航内容过多,可以写成嵌套的列表,会被渲染成下拉列表的形式。
_\_navbar.md_
*_navbar.md*
```markdown
* 基础
* [快速开始](zh-cn/quickstart.md)
* [多页文档](zh-cn/more-pages.md)
* [定制导航栏](zh-cn/custom-navbar.md)
* [封面](zh-cn/cover.md)
- 基础
- [快速开始](zh-cn/quickstart.md)
- [多页文档](zh-cn/more-pages.md)
- [定制导航栏](zh-cn/custom-navbar.md)
- [封面](zh-cn/cover.md)
* 配置
* [配置项](zh-cn/configuration.md)
* [主题](zh-cn/themes.md)
* [使用插件](zh-cn/plugins.md)
* [Markdown 配置](zh-cn/markdown.md)
* [代码高亮](zh-cn/language-highlight.md)
- 配置
- [配置项](zh-cn/configuration.md)
- [主题](zh-cn/themes.md)
- [使用插件](zh-cn/plugins.md)
- [Markdown 配置](zh-cn/markdown.md)
- [代码高亮](zh-cn/language-highlight.md)
```
效果图
![嵌套导航栏](../_images/zh-cn/nested-navbar.png '嵌套导航栏')
![嵌套导航栏](_images/zh-cn/nested-navbar.png "嵌套导航栏")
+4 -17
View File
@@ -5,24 +5,24 @@
## GitHub Pages
GitHub Pages 支持从三个地方读取文件
- `docs/` 目录
- master 分支
- gh-pages 分支
我们推荐直接将文档放在 `docs/` 目录下,在设置页面开启 **GitHub Pages** 功能并选择 `master branch /docs folder` 选项。
![github pages](../_images/deploy-github-pages.png)
![github pages](_images/deploy-github-pages.png)
!> 可以将文档放在根目录下,然后选择 **master 分支** 作为文档目录。
## GitLab Pages
如果你正在部署你的主分支, 在 `.gitlab-ci.yml` 中包含以下脚本:
?> `.public` 的解决方法是这样的,`cp` 不会无限循环的将 `public/` 复制到自身。
```YAML
``` YAML
pages:
stage: deploy
script:
@@ -38,6 +38,7 @@ pages:
!> 你可以用 `- cp -r docs/. public` 替换脚本, 如果 `./docs` 是你的 docsify 子文件夹。
## VPS
和部署所有静态网站一样,只需将服务器的访问根目录设定为 `index.html` 文件。
@@ -55,17 +56,3 @@ server {
}
}
```
## 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
```
-63
View File
@@ -1,63 +0,0 @@
# 文件嵌入
docsify 4.6 开始支持嵌入任何类型的文件到文档里。你可以将文件当成 `iframe``video``audio` 或者 `code block`,如果是 Markdown 文件,甚至可以直接插入到当前文档里。
这是一个嵌入 Markdown 文件的例子。
```markdown
[filename](../_media/example.md ':include')
```
`example.md` 文件的内容将会直接显示在这里
[filename](../_media/example.md ':include')
你可以查看 [example.md](../_media/example.md ':ignore') 原始内容对比效果。
通常情况下,这样的语法将会被当作链接处理。但是在 docsify 里,如果你添加一个 `:include` 选项,它就会被当作文件嵌入。
## 嵌入的类型
当前,嵌入的类型是通过文件后缀自动识别的,这是目前支持的类型:
* **iframe** `.html`, `.htm`
* **markdown** `.markdown`, `.md`
* **audio** `.mp3`
* **video** `.mp4`, `.ogg`
* **code** other file extension
当然,你也可以强制设置嵌入类型。例如你想将 Markdown 文件当作一个 `code block` 嵌入。
```markdown
[filename](../_media/example.md ':include :type=code')
```
你将得到
[filename](../_media/example.md ':include :type=code')
## 标签属性
如果你嵌入文件是一个 `iframe``audio` 或者 `video`,你可以给这些标签设置属性。
```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')
看见没?你只需要直接写属性就好了,每个标签有哪些属性建议你查看 [MDN 文档](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe)。
## 代码块高亮
如果是嵌入一个代码块,你可以设置高亮的语言,或者让它自动识别。这里是手动设置高亮语言
```markdown
[](../_media/example.html ':include :type=code text')
```
⬇️
[](../_media/example.html ':include :type=code text')
?> 如何高亮代码?你可以查看[这份文档](language-highlight.md).
+25 -29
View File
@@ -2,6 +2,7 @@
docsify 扩展了一些 Markdown 语法,可以让文档更易读。
## 强调内容
适合显示重要的提示信息,语法为 `!> 内容`
@@ -12,15 +13,17 @@ docsify 扩展了一些 Markdown 语法,可以让文档更易读。
!> 一段重要的内容,可以和其他 **Markdown** 语法混用。
## 普通提示
普通的提示信息,比如写 TODO 或者参考内容等。
```markdown
?> _TODO_ 完善示例
?> *TODO* 完善示例
```
?> _TODO_ 完善示例
?> *TODO* 完善示例
## 忽略编译链接
@@ -30,53 +33,46 @@ docsify 扩展了一些 Markdown 语法,可以让文档更易读。
[link](/demo/)
```
它将被编译为 `<a href="/#/demo/">link</a>` 并将加载 `/demo/README.md`. 可能你想跳转到 `/demo/index.html`
现在你可以做到这一点
```md
[link](/demo/ ':ignore')
[link](/demo/ ":ignore")
```
即将会得到 `<a href="/demo/">link</a>` html 代码。不要担心,你仍然可以为链接设置标题。
```md
[link](/demo/ ':ignore title')
[link](/demo/ ":ignore title")
<a href="/demo/" title="title">link</a>
```
## 设置链接的 target 属性
```md
[link](/demo ':target=_blank')
[link](/demo2 ':target=_self')
[link](/demo ":target=_blank")
[link](/demo2 ":target=_self")
```
## Github 任务列表
```md
- [ ] foo
- bar
- [x] baz
- [] bam <~ not working
- [ ] bim
- [ ] lim
* [ ] foo
* bar
* [x] baz
* [] bam
* [ ] bim
* [ ] lim
```
- [ ] foo
- bar
- [x] baz
- [] bam <~ not working
- [ ] bim
- [ ] lim
## Image resizing
```md
![logo](https://docsify.js.org/_media/icon.svg ':size=50x100')
![logo](https://docsify.js.org/_media/icon.svg ':size=100')
```
![logo](https://docsify.js.org/_media/icon.svg ':size=50x100')
![logo](https://docsify.js.org/_media/icon.svg ':size=100')
* [ ] foo
* bar
* [x] baz
* [] bam
* [ ] bim
* [ ] lim
+2 -2
View File
@@ -1,6 +1,6 @@
# Markdown 配置
内置的 Markdown 解析器是 [marked](https://github.com/markedjs/marked),可以修改它的配置。同时可以直接配置 `renderer`
内置的 Markdown 解析器是 [marked](https://github.com/chjj/marked),可以修改它的配置。同时可以直接配置 `renderer`
```js
window.$docsify = {
@@ -15,7 +15,7 @@ window.$docsify = {
}
```
?> 完整配置参数参考 [marked 文档](https://github.com/markedjs/marked#options-1)
?> 完整配置参数参考 [marked 文档](https://github.com/chjj/marked#options-1)
当然也可以完全定制 Markdown 解析规则。
+6 -19
View File
@@ -26,7 +26,7 @@ docs/zh-cn/guide.md => http://domain.com/zh-cn/guide
默认情况下,侧边栏会根据当前文档的标题生成目录。也可以设置文档链接,通过 Markdown 文件生成,效果如当前的文档的侧边栏。
首先配置 `loadSidebar` 选项,具体配置规则见[配置项#loadSidebar](zh-cn/configuration.md#loadsidebar)。
首先配置 `loadSidebar` 选项,具体配置规则见[配置项#load-sidebar](configuration.md#load-sidebar)。
```html
<script>
@@ -40,27 +40,15 @@ docs/zh-cn/guide.md => http://domain.com/zh-cn/guide
接着创建 `_sidebar.md` 文件,内容如下
```markdown
* [首页](zh-cn/)
* [指南](zh-cn/guide)
- [首页](zh-cn/)
- [指南](zh-cn/guide)
```
!> 需要在文档根目录创建 `.nojekyll` 命名的空文件,阻止 GitHub Pages 忽略命名是下划线开头的文件。
`_sidebar.md` 的加载逻辑是从每层目录下获取文件,如果当前目录不存在该文件则回退到上一级目录。例如当前路径为 `/zh-cn/more-pages` 则从 `/zh-cn/_sidebar.md` 获取文件,如果不存在则从 `/_sidebar.md` 获取。
当然你也可以配置 `alias` 避免不必要的回退过程。
```html
<script>
window.$docsify = {
loadSidebar: true,
alias: {
'/.*/_sidebar.md': '/_sidebar.md'
}
}
</script>
```
## 显示目录
自定义侧边栏同时也可以开启目录功能。设置 `subMaxLevel` 配置项,具体介绍见 [配置项#sub-max-level](zh-cn/configuration#sub-max-level)。
@@ -77,13 +65,12 @@ docs/zh-cn/guide.md => http://domain.com/zh-cn/guide
## 忽略副标题
当设置了 `subMaxLevel` 时,默认情况下每个标题都会自动添加到目录中。如果你想忽略特定的标题,可以给它添加  `{docsify-ignore}`
当设置了 `subMaxLevel` 时,默认情况下每个标题都会自动添加到目录中。如果你想忽略特定的标题,可以给它添加 `{docsify-ignore}`
```markdown
# Getting Started
## Header {docsify-ignore}
该标题不会出现在侧边栏的目录中。
```
@@ -93,8 +80,8 @@ docs/zh-cn/guide.md => http://domain.com/zh-cn/guide
# Getting Started {docsify-ignore-all}
## Header
该标题不会出现在侧边栏的目录中。
```
在使用时, `{docsify-ignore}``{docsify-ignore-all}` 都不会在页面上呈现。
+21 -19
View File
@@ -4,6 +4,7 @@
全文搜索插件会根据当前页面上的超链接获取文档内容,在 `localStorage` 内建立文档索引。默认过期时间为一天,当然我们可以自己指定需要缓存的文件列表或者配置过期时间。
```html
<script>
window.$docsify = {
@@ -90,6 +91,7 @@ When readers expand the demo box, the source code and description are shown ther
[Vue](https://njleonzhang.github.io/docsify-demo-box-vue/) and [React](https://njleonzhang.github.io/docsify-demo-box-react/) are both supported.
## 图片缩放 - Zoom image
Medium's 风格的图片缩放插件. 基于 [medium-zoom](https://github.com/francoischalifour/medium-zoom)。
@@ -98,26 +100,41 @@ Medium's 风格的图片缩放插件. 基于 [medium-zoom](https://github.com/fr
<script src="//unpkg.com/docsify/lib/plugins/zoom-image.js"></script>
```
忽略某张图片
```markdown
![](image.png ':no-zoom')
```
## 在 Github 上编辑
在每一页上添加 `Edit on github` 按钮. 由第三方库提供, 查看 [document](https://github.com/njleonzhang/docsify-edit-on-github)
## 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
<script src="//unpkg.com/docsify-copy-code"></script>
<link rel="stylesheet" href="//unpkg.com/docsify-copy-code/styles.css">
<script src="//unpkg.com/docsify-copy-code/index.js"></script>
```
```javascript
window.$docsify = {
plugins: [
window.DocsifyCopyCodePlugin.init()
]
}
```
See [here](https://github.com/jperasmus/docsify-copy-code/blob/master/README.md) for more details.
## Disqus
Disqus comments. https://disqus.com/
@@ -131,9 +148,10 @@ Disqus comments. https://disqus.com/
<script src="//unpkg.com/docsify/lib/plugins/disqus.min.js"></script>
```
## Gitalk
[Gitalk](https://github.com/gitalk/gitalk) is a modern comment component based on Github Issue and Preact.
[Gitalk](https://github.com/gitalk/gitalk) is a modern comment component based on Github Issue and Preact.
```html
<link rel="stylesheet" href="//unpkg.com/gitalk/dist/gitalk.css">
@@ -153,7 +171,7 @@ Disqus comments. https://disqus.com/
</script>
```
## Pagination
## Navigation
Pagination for docsify. By [@imyelo](https://github.com/imyelo)
@@ -161,19 +179,3 @@ Pagination for docsify. By [@imyelo](https://github.com/imyelo)
<script src="//unpkg.com/docsify/lib/docsify.min.js"></script>
<script src="//unpkg.com/docsify-pagination/dist/docsify-pagination.min.js"></script>
```
## Code Fund
帮你快速接入[Code Fund](https://codesponsor.io/)的[插件](https://github.com/njleonzhang/docsify-plugin-codefund), 由[@njleonzhang](https://github.com/njleonzhang)提供。
> Code Fund 以前叫 codesponsor
```
<script src="//unpkg.com/docsify/lib/docsify.min.js"></script>
window.$docsify = {
plugins: [
DocsifyCodefund.create('51d43327-eea3-4e27-bd44-e075e67a84fb') // 把这个id改成你的codefund id
]
}
```
+1 -6
View File
@@ -51,13 +51,8 @@ docsify serve docs
</head>
<body>
<div id="app"></div>
<script>
window.$docsify = {
//...
}
</script>
<script src="//unpkg.com/docsify/lib/docsify.min.js"></script>
</body>
<script src="//unpkg.com/docsify"></script>
</html>
```
-5
View File
@@ -54,8 +54,3 @@
});
};
</script>
## Other themes
- [docsify-themeable](https://jhildenbiddle.github.io/docsify-themeable/#/) A delightfully simple theme system for docsify.
+499 -1037
View File
File diff suppressed because it is too large Load Diff
+2 -1
View File
File diff suppressed because one or more lines are too long
+4 -2
View File
@@ -1,10 +1,12 @@
(function () {
'use strict';
var fixedPath = location.href.replace('/-/', '/#/');
if (fixedPath !== location.href) {
location.href = fixedPath;
}
function install(hook, vm) {
function install (hook, vm) {
var dom = Docsify.dom;
var disqus = vm.config.disqus;
if (!disqus) {
@@ -16,7 +18,7 @@ function install(hook, vm) {
script.async = true;
script.src = "https://" + disqus + ".disqus.com/embed.js";
script.setAttribute('data-timestamp', Number(new Date()));
script.setAttribute('data-timestamp', +new Date());
dom.appendTo(dom.body, script);
});
+1 -1
View File
@@ -1 +1 @@
!function(){var i=location.href.replace("/-/","/#/");i!==location.href&&(location.href=i);$docsify.plugins=[].concat(function(i,t){var e=Docsify.dom,o=t.config.disqus;if(!o)throw Error("$docsify.disqus is required");i.init(function(i){var t=e.create("script");t.async=!0,t.src="https://"+o+".disqus.com/embed.js",t.setAttribute("data-timestamp",Number(new Date)),e.appendTo(e.body,t)}),i.mounted(function(i){var o=e.create("div");o.id="disqus_thread";var n=e.getNode("#main");o.style="width: "+n.clientWidth+"px; margin: 0 auto 20px;",e.appendTo(e.find(".content"),o),window.disqus_config=function(){this.page.url=location.origin+"/-"+t.route.path,this.page.identifier=t.route.path,this.page.title=document.title}}),i.doneEach(function(i){void 0!==window.DISQUS&&window.DISQUS.reset({reload:!0,config:function(){this.page.url=location.origin+"/-"+t.route.path,this.page.identifier=t.route.path,this.page.title=document.title}})})},$docsify.plugins)}();
!function(){"use strict";function i(i,t){var e=Docsify.dom,o=t.config.disqus;if(!o)throw Error("$docsify.disqus is required");i.init(function(i){var t=e.create("script");t.async=!0,t.src="https://"+o+".disqus.com/embed.js",t.setAttribute("data-timestamp",+new Date),e.appendTo(e.body,t)}),i.mounted(function(i){var o=e.create("div");o.id="disqus_thread";var n=e.getNode("#main");o.style="width: "+n.clientWidth+"px; margin: 0 auto 20px;",e.appendTo(e.find(".content"),o),window.disqus_config=function(){this.page.url=location.origin+"/-"+t.route.path,this.page.identifier=t.route.path,this.page.title=document.title}}),i.doneEach(function(i){void 0!==window.DISQUS&&window.DISQUS.reset({reload:!0,config:function(){this.page.url=location.origin+"/-"+t.route.path,this.page.identifier=t.route.path,this.page.title=document.title}})})}var t=location.href.replace("/-/","/#/");t!==location.href&&(location.href=t),$docsify.plugins=[].concat(i,$docsify.plugins)}();
+6 -4
View File
@@ -1,4 +1,6 @@
(function () {
'use strict';
var AllGithubEmoji = [
'+1',
'100',
@@ -888,12 +890,12 @@ var AllGithubEmoji = [
'zzz'
];
// Emoji from All-Github-Emoji-Icons
// emoji from All-Github-Emoji-Icons
// https://github.com/scotch-io/All-Github-Emoji-Icons
window.emojify = function (match, $1) {
return AllGithubEmoji.indexOf($1) === -1 ?
match :
'<img class="emoji" src="https://assets-cdn.github.com/images/icons/emoji/' +
return AllGithubEmoji.indexOf($1) === -1
? match
: '<img class="emoji" src="https://assets-cdn.github.com/images/icons/emoji/' +
$1 +
'.png" alt="' +
$1 +
+1 -1
View File
File diff suppressed because one or more lines are too long
+3 -1
View File
@@ -1,5 +1,7 @@
(function () {
function handleExternalScript() {
'use strict';
function handleExternalScript () {
var container = Docsify.dom.getNode('#main');
var scripts = Docsify.dom.findAll(container, 'script');
+1 -1
View File
@@ -1 +1 @@
!function(){function o(){for(var o=Docsify.dom.getNode("#main"),e=Docsify.dom.findAll(o,"script"),n=e.length;n--;){var i=e[n];if(i&&i.src){var t=document.createElement("script");Array.prototype.slice.call(i.attributes).forEach(function(o){t[o.name]=o.value}),i.parentNode.insertBefore(t,i),i.parentNode.removeChild(i)}}}window.$docsify.plugins=[].concat(function(e){e.doneEach(o)},window.$docsify.plugins)}();
!function(){"use strict";function e(){for(var e=Docsify.dom.getNode("#main"),o=Docsify.dom.findAll(e,"script"),n=o.length;n--;){var i=o[n];if(i&&i.src){var t=document.createElement("script");Array.prototype.slice.call(i.attributes).forEach(function(e){t[e.name]=e.value}),i.parentNode.insertBefore(t,i),i.parentNode.removeChild(i)}}}var o=function(o){o.doneEach(e)};window.$docsify.plugins=[].concat(o,window.$docsify.plugins)}();
+3 -1
View File
@@ -1,4 +1,6 @@
(function () {
'use strict';
/**
* Fork https://github.com/egoist/docute/blob/master/src/utils/yaml.js
*/
@@ -485,7 +487,7 @@ var install = function (hook, vm) {
var attributes = ref.attributes;
var body = ref.body;
vm.frontmatter = attributes;
Docsify.util.merge(vm.config, attributes.config);
return body
});
+1 -1
View File
File diff suppressed because one or more lines are too long
+5 -3
View File
@@ -1,13 +1,15 @@
(function () {
'use strict';
// From https://github.com/egoist/vue-ga/blob/master/src/index.js
function appendScript() {
function appendScript () {
var script = document.createElement('script');
script.async = true;
script.src = 'https://www.google-analytics.com/analytics.js';
document.body.appendChild(script);
}
function init(id) {
function init (id) {
appendScript();
window.ga =
window.ga ||
@@ -18,7 +20,7 @@ function init(id) {
window.ga('create', id, 'auto');
}
function collect() {
function collect () {
if (!window.ga) {
init($docsify.ga);
}
+1 -1
View File
@@ -1 +1 @@
!function(){function n(n){!function(){var n=document.createElement("script");n.async=!0,n.src="https://www.google-analytics.com/analytics.js",document.body.appendChild(n)}(),window.ga=window.ga||function(){(window.ga.q=window.ga.q||[]).push(arguments)},window.ga.l=Number(new Date),window.ga("create",n,"auto")}function o(){window.ga||n($docsify.ga),window.ga("set","page",location.hash),window.ga("send","pageview")}$docsify.plugins=[].concat(function(n){$docsify.ga?n.beforeEach(o):console.error("[Docsify] ga is required.")},$docsify.plugins)}();
!function(){"use strict";function n(){var n=document.createElement("script");n.async=!0,n.src="https://www.google-analytics.com/analytics.js",document.body.appendChild(n)}function o(o){n(),window.ga=window.ga||function(){(window.ga.q=window.ga.q||[]).push(arguments)},window.ga.l=Number(new Date),window.ga("create",o,"auto")}function i(){window.ga||o($docsify.ga),window.ga("set","page",location.hash),window.ga("send","pageview")}var a=function(n){if(!$docsify.ga)return void console.error("[Docsify] ga is required.");n.beforeEach(i)};$docsify.plugins=[].concat(a,$docsify.plugins)}();
+3 -1
View File
@@ -1,5 +1,7 @@
(function () {
function install(hook) {
'use strict';
function install (hook, vm) {
var dom = Docsify.dom;
hook.mounted(function (_) {
+1 -1
View File
@@ -1 +1 @@
!function(){$docsify.plugins=[].concat(function(n){var t=Docsify.dom;n.mounted(function(n){var i=t.create("div");i.id="gitalk-container";var e=t.getNode("#main");i.style="width: "+e.clientWidth+"px; margin: 0 auto 20px;",t.appendTo(t.find(".content"),i);var o=t.create("script");o.textContent="gitalk.render('gitalk-container')",t.appendTo(t.body,o)})},$docsify.plugins)}();
!function(){"use strict";function t(t,n){var i=Docsify.dom;t.mounted(function(t){var n=i.create("div");n.id="gitalk-container";var e=i.getNode("#main");n.style="width: "+e.clientWidth+"px; margin: 0 auto 20px;",i.appendTo(i.find(".content"),n);var o=i.create("script");o.textContent="gitalk.render('gitalk-container')",i.appendTo(i.body,o)})}$docsify.plugins=[].concat(t,$docsify.plugins)}();
+53 -74
View File
@@ -1,8 +1,10 @@
(function () {
'use strict';
var INDEXS = {};
var helper;
function escapeHtml(string) {
function escapeHtml (string) {
var entityMap = {
'&': '&amp;',
'<': '&lt;',
@@ -12,35 +14,34 @@ function escapeHtml(string) {
'/': '&#x2F;'
};
return String(string).replace(/[&<>"'/]/g, function (s) { return entityMap[s]; })
return String(string).replace(/[&<>"'\/]/g, function (s) { return entityMap[s]; })
}
function getAllPaths(router) {
function getAllPaths (router) {
var paths = [];
helper.dom.findAll('a:not([data-nosearch])').forEach(function (node) {
var href = node.href;
var originHref = node.getAttribute('href');
var path = router.parse(href).path;
helper.dom.findAll('a:not([data-nosearch])')
.map(function (node) {
var href = node.href;
var originHref = node.getAttribute('href');
var path = router.parse(href).path;
if (
path &&
paths.indexOf(path) === -1 &&
!Docsify.util.isAbsolutePath(originHref)
) {
paths.push(path);
}
});
if (path &&
paths.indexOf(path) === -1 &&
!Docsify.util.isAbsolutePath(originHref)) {
paths.push(path);
}
});
return paths
}
function saveData(maxAge) {
function saveData (maxAge) {
localStorage.setItem('docsify.search.expires', Date.now() + maxAge);
localStorage.setItem('docsify.search.index', JSON.stringify(INDEXS));
}
function genIndex(path, content, router, depth) {
function genIndex (path, content, router, depth) {
if ( content === void 0 ) content = '';
var tokens = window.marked.lexer(content);
@@ -50,18 +51,18 @@ function genIndex(path, content, router, depth) {
tokens.forEach(function (token) {
if (token.type === 'heading' && token.depth <= depth) {
slug = router.toURL(path, {id: slugify(token.text)});
index[slug] = {slug: slug, title: token.text, body: ''};
slug = router.toURL(path, { id: slugify(token.text) });
index[slug] = { slug: slug, title: token.text, body: '' };
} else {
if (!slug) {
return
}
if (!slug) { return }
if (!index[slug]) {
index[slug] = {slug: slug, title: '', body: ''};
} else if (index[slug].body) {
index[slug].body += '\n' + (token.text || '');
index[slug] = { slug: slug, title: '', body: '' };
} else {
index[slug].body = token.text;
if (index[slug].body) {
index[slug].body += '\n' + (token.text || '');
} else {
index[slug].body = token.text;
}
}
}
});
@@ -73,7 +74,7 @@ function genIndex(path, content, router, depth) {
* @param {String} query
* @returns {Array}
*/
function search(query) {
function search (query) {
var matchingResults = [];
var data = [];
Object.keys(INDEXS).forEach(function (key) {
@@ -81,7 +82,7 @@ function search(query) {
});
query = query.trim();
var keywords = query.split(/[\s\-\\/]+/);
var keywords = query.split(/[\s\-\\\/]+/);
if (keywords.length !== 1) {
keywords = [].concat(query, keywords);
}
@@ -95,12 +96,8 @@ function search(query) {
var postUrl = post.slug || '';
if (postTitle && postContent) {
keywords.forEach(function (keyword) {
// From https://github.com/sindresorhus/escape-string-regexp
var regEx = new RegExp(
keyword.replace(/[|\\{}()[\]^$+*?.]/g, '\\$&'),
'gi'
);
keywords.forEach(function (keyword, i) {
var regEx = new RegExp(keyword, 'gi');
var indexTitle = -1;
var indexContent = -1;
@@ -111,9 +108,7 @@ function search(query) {
isMatch = false;
} else {
isMatch = true;
if (indexContent < 0) {
indexContent = 0;
}
if (indexContent < 0) { indexContent = 0; }
var start = 0;
var end = 0;
@@ -121,16 +116,13 @@ function search(query) {
start = indexContent < 11 ? 0 : indexContent - 10;
end = start === 0 ? 70 : indexContent + keyword.length + 60;
if (end > postContent.length) {
end = postContent.length;
}
if (end > postContent.length) { end = postContent.length; }
var matchContent =
'...' +
var matchContent = '...' +
escapeHtml(postContent)
.substring(start, end)
.replace(regEx, ("<em class=\"search-keyword\">" + keyword + "</em>")) +
'...';
'...';
resultStr += matchContent;
}
@@ -153,7 +145,7 @@ function search(query) {
return matchingResults
}
function init$1(config, vm) {
function init$1 (config, vm) {
helper = Docsify;
var isAuto = config.paths === 'auto';
@@ -172,12 +164,10 @@ function init$1(config, vm) {
var count = 0;
paths.forEach(function (path) {
if (INDEXS[path]) {
return count++
}
if (INDEXS[path]) { return count++ }
helper
.get(vm.router.getFile(path), false, vm.config.requestHeaders)
.get(vm.router.getFile(path))
.then(function (result) {
INDEXS[path] = genIndex(path, result, vm.router, config.depth);
len === ++count && saveData(config.maxAge);
@@ -187,17 +177,19 @@ function init$1(config, vm) {
var NO_DATA_TEXT = '';
function style() {
var code = "\n.sidebar {\n padding-top: 0;\n}\n\n.search {\n margin-bottom: 20px;\n padding: 6px;\n border-bottom: 1px solid #eee;\n}\n\n.search .input-wrap {\n display: flex;\n align-items: center;\n}\n\n.search .results-panel {\n display: none;\n}\n\n.search .results-panel.show {\n display: block;\n}\n\n.search input {\n outline: none;\n border: none;\n width: 100%;\n padding: 0 7px;\n line-height: 36px;\n font-size: 14px;\n}\n\n.search input::-webkit-search-decoration,\n.search input::-webkit-search-cancel-button,\n.search input {\n -webkit-appearance: none;\n -moz-appearance: none;\n appearance: none;\n}\n.search .clear-button {\n width: 36px;\n text-align: right;\n display: none;\n}\n\n.search .clear-button.show {\n display: block;\n}\n\n.search .clear-button svg {\n transform: scale(.5);\n}\n\n.search h2 {\n font-size: 17px;\n margin: 10px 0;\n}\n\n.search a {\n text-decoration: none;\n color: inherit;\n}\n\n.search .matching-post {\n border-bottom: 1px solid #eee;\n}\n\n.search .matching-post:last-child {\n border-bottom: 0;\n}\n\n.search p {\n font-size: 14px;\n overflow: hidden;\n text-overflow: ellipsis;\n display: -webkit-box;\n -webkit-line-clamp: 2;\n -webkit-box-orient: vertical;\n}\n\n.search p.empty {\n text-align: center;\n}";
function style () {
var code = "\n.sidebar {\n padding-top: 0;\n}\n\n.search {\n margin-bottom: 20px;\n padding: 6px;\n border-bottom: 1px solid #eee;\n}\n\n.search .results-panel {\n display: none;\n}\n\n.search .results-panel.show {\n display: block;\n}\n\n.search input {\n outline: none;\n border: none;\n width: 100%;\n padding: 7px;\n line-height: 22px;\n font-size: 14px;\n -webkit-appearance: none;\n -moz-appearance: none;\n appearance: none;\n}\n\n.search h2 {\n font-size: 17px;\n margin: 10px 0;\n}\n\n.search a {\n text-decoration: none;\n color: inherit;\n}\n\n.search .matching-post {\n border-bottom: 1px solid #eee;\n}\n\n.search .matching-post:last-child {\n border-bottom: 0;\n}\n\n.search p {\n font-size: 14px;\n overflow: hidden;\n text-overflow: ellipsis;\n display: -webkit-box;\n -webkit-line-clamp: 2;\n -webkit-box-orient: vertical;\n}\n\n.search p.empty {\n text-align: center;\n}";
Docsify.dom.style(code);
}
function tpl(opts, defaultValue) {
function tpl (opts, defaultValue) {
if ( defaultValue === void 0 ) defaultValue = '';
var html =
"<div class=\"input-wrap\">\n <input type=\"search\" value=\"" + defaultValue + "\" />\n <div class=\"clear-button\">\n <svg width=\"26\" height=\"24\">\n <circle cx=\"12\" cy=\"12\" r=\"11\" fill=\"#ccc\" />\n <path stroke=\"white\" stroke-width=\"2\" d=\"M8.25,8.25,15.75,15.75\" />\n <path stroke=\"white\" stroke-width=\"2\"d=\"M8.25,15.75,15.75,8.25\" />\n </svg>\n </div>\n </div>\n <div class=\"results-panel\"></div>\n </div>";
"<input type=\"search\" value=\"" + defaultValue + "\" />" +
'<div class="results-panel"></div>' +
'</div>';
var el = Docsify.dom.create('div', html);
var aside = Docsify.dom.find('aside');
@@ -205,14 +197,12 @@ function tpl(opts, defaultValue) {
Docsify.dom.before(aside, el);
}
function doSearch(value) {
function doSearch (value) {
var $search = Docsify.dom.find('div.search');
var $panel = Docsify.dom.find($search, '.results-panel');
var $clearBtn = Docsify.dom.find($search, '.clear-button');
if (!value) {
$panel.classList.remove('show');
$clearBtn.classList.remove('show');
$panel.innerHTML = '';
return
}
@@ -220,18 +210,16 @@ function doSearch(value) {
var html = '';
matchs.forEach(function (post) {
html += "<div class=\"matching-post\">\n<a href=\"" + (post.url) + "\">\n<h2>" + (post.title) + "</h2>\n<p>" + (post.content) + "</p>\n</a>\n</div>";
html += "<div class=\"matching-post\">\n<a href=\"" + (post.url) + "\"> \n<h2>" + (post.title) + "</h2>\n<p>" + (post.content) + "</p>\n</a>\n</div>";
});
$panel.classList.add('show');
$clearBtn.classList.add('show');
$panel.innerHTML = html || ("<p class=\"empty\">" + NO_DATA_TEXT + "</p>");
}
function bindEvents() {
function bindEvents () {
var $search = Docsify.dom.find('div.search');
var $input = Docsify.dom.find($search, 'input');
var $inputWrap = Docsify.dom.find($search, '.input-wrap');
var timeId;
// Prevent to Fold sidebar
@@ -244,21 +232,12 @@ function bindEvents() {
clearTimeout(timeId);
timeId = setTimeout(function (_) { return doSearch(e.target.value.trim()); }, 100);
});
Docsify.dom.on($inputWrap, 'click', function (e) {
// Click input outside
if (e.target.tagName !== 'INPUT') {
$input.value = '';
doSearch();
}
});
}
function updatePlaceholder(text, path) {
function updatePlaceholder (text, path) {
var $input = Docsify.dom.getNode('.search input[type="search"]');
if (!$input) {
return
}
if (!$input) { return }
if (typeof text === 'string') {
$input.placeholder = text;
} else {
@@ -267,7 +246,7 @@ function updatePlaceholder(text, path) {
}
}
function updateNoData(text, path) {
function updateNoData (text, path) {
if (typeof text === 'string') {
NO_DATA_TEXT = text;
} else {
@@ -276,7 +255,7 @@ function updateNoData(text, path) {
}
}
function init(opts, vm) {
function init$$1 (opts, vm) {
var keywords = vm.router.parse().query.s;
style();
@@ -285,7 +264,7 @@ function init(opts, vm) {
keywords && setTimeout(function (_) { return doSearch(keywords); }, 500);
}
function update(opts, vm) {
function update (opts, vm) {
updatePlaceholder(opts.placeholder, vm.route.path);
updateNoData(opts.noData, vm.route.path);
}
@@ -315,7 +294,7 @@ var install = function (hook, vm) {
var isAuto = CONFIG.paths === 'auto';
hook.mounted(function (_) {
init(CONFIG, vm);
init$$1(CONFIG, vm);
!isAuto && init$1(CONFIG, vm);
});
hook.doneEach(function (_) {
+1 -1
View File
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 9.6 KiB

+2743 -3979
View File
File diff suppressed because it is too large Load Diff
+28 -47
View File
@@ -1,6 +1,6 @@
{
"name": "docsify",
"version": "4.7.0",
"version": "4.5.7",
"description": "A magical documentation generator.",
"author": {
"name": "qingwei-li",
@@ -14,7 +14,6 @@
"url": "git+https://github.com/QingWei-Li/docsify.git"
},
"main": "lib/docsify.js",
"unpkg": "lib/docsify.min.js",
"files": [
"lib",
"src",
@@ -22,53 +21,40 @@
],
"scripts": {
"bootstrap": "npm i && lerna bootstrap && npm run build:ssr",
"serve": "node server",
"serve:ssr": "cross-env SSR=1 node server",
"dev": "run-p serve watch:*",
"dev:ssr": "run-p serve:ssr watch:*",
"lint": "eslint {src,packages} --fix",
"test": "run-p lint",
"css": "stylus src/themes/*.styl -u autoprefixer-stylus",
"watch:css": "run-p 'css -- -o themes -w'",
"watch:js": "node build/build.js",
"build:css:min": "mkdir lib/themes && run-p 'css -- -o lib/themes' && node build/mincss.js",
"build:css": "mkdir themes && run-p 'css -- -o themes'",
"build:js": "cross-env NODE_ENV=production node build/build.js",
"build:ssr": "node build/ssr.js",
"build:cover": "node build/cover.js",
"build": "rimraf lib themes && run-s build:js build:css build:css:min build:ssr build:cover",
"pub:next": "cross-env RELEASE_TAG=next sh build/release.sh",
"pub": "sh build/release.sh",
"postinstall": "opencollective postinstall"
"build": "rm -rf lib themes && node build/build && mkdir lib/themes && mkdir themes && node build/build-css && npm run build:ssr && node build/build-cover",
"dev:build": "rm -rf lib themes && mkdir themes && node build/build --dev && node build/build-css --dev",
"dev": "node app & nodemon -w src -e js,css --exec 'npm run dev:build'",
"build:ssr": "node build/build-ssr",
"test": "eslint {src,packages} --fix",
"pub:next": "RELEASE_TAG=next sh build/release.sh",
"pub": "sh build/release.sh"
},
"dependencies": {
"marked": "^0.3.12",
"medium-zoom": "^0.4.0",
"opencollective": "^1.0.3",
"prismjs": "^1.9.0",
"marked": "^0.3.6",
"medium-zoom": "^0.2.0",
"prismjs": "^1.6.0",
"tinydate": "^1.0.0",
"tweezer.js": "^1.4.0"
},
"devDependencies": {
"autoprefixer-stylus": "^0.14.0",
"chokidar": "^2.0.2",
"conventional-changelog-cli": "^1.3.5",
"cross-env": "^5.1.3",
"conventional-changelog-cli": "^1.3.2",
"cssnano": "^3.10.0",
"eslint": "^4.14.0",
"eslint-config-xo-space": "^0.18.0",
"lerna": "^2.5.1",
"live-server": "^1.2.0",
"npm-run-all": "^4.1.2",
"rimraf": "^2.6.2",
"rollup": "^0.53.3",
"eslint": "^3.18.0",
"eslint-config-vue": "^2.0.2",
"eslint-plugin-vue": "^2.0.1",
"lerna": "^2.0.0-rc.5",
"nodemon": "^1.11.0",
"postcss": "^5.2.16",
"postcss-salad": "^1.0.8",
"rollup": "^0.41.6",
"rollup-plugin-async": "^1.2.0",
"rollup-plugin-buble": "^0.18.0",
"rollup-plugin-commonjs": "^8.2.6",
"rollup-plugin-node-resolve": "^3.0.0",
"rollup-plugin-replace": "^2.0.0",
"rollup-plugin-uglify": "^2.0.1",
"stylus": "^0.54.5"
"rollup-plugin-buble": "^0.15.0",
"rollup-plugin-commonjs": "^8.0.2",
"rollup-plugin-node-resolve": "^2.0.0",
"rollup-plugin-replace": "^1.1.1",
"rollup-plugin-string": "^2.0.2",
"rollup-plugin-uglify": "^1.0.1",
"serve-static": "^1.12.1"
},
"keywords": [
"doc",
@@ -76,10 +62,5 @@
"documentation",
"creator",
"generator"
],
"collective": {
"type": "opencollective",
"url": "https://opencollective.com/docsify",
"logo": "https://docsify.js.org/_media/icon.svg"
}
]
}
+21 -59
View File
@@ -1,22 +1,21 @@
import * as tpl from '../../src/core/render/tpl'
import fetch from 'node-fetch'
import {AbstractHistory} from '../../src/core/router/history/abstract'
import {Compiler} from '../../src/core/render/compiler'
import {isAbsolutePath} from '../../src/core/router/util'
import {readFileSync} from 'fs'
import {resolve, basename} from 'path'
import { AbstractHistory } from '../../src/core/router/history/abstract'
import { Compiler } from '../../src/core/render/compiler'
import { isAbsolutePath } from '../../src/core/router/util'
import { readFileSync } from 'fs'
import { resolve, basename } from 'path'
import resolvePathname from 'resolve-pathname'
import debug from 'debug'
import {prerenderEmbed} from '../../src/core/render/embed'
function cwd(...args) {
function cwd (...args) {
return resolve(process.cwd(), ...args)
}
function mainTpl(config) {
let html = `<nav class="app-nav${
config.repo ? '' : ' no-badge'
}"><!--navbar--></nav>`
function mainTpl (config) {
let html = `<nav class="app-nav${config.repo
? ''
: ' no-badge'}"><!--navbar--></nav>`
if (config.repo) {
html += tpl.corner(config.repo)
@@ -31,7 +30,7 @@ function mainTpl(config) {
}
export default class Renderer {
constructor({template, config, cache}) {
constructor ({ template, config, cache }) {
this.html = template
this.config = config = Object.assign({}, config, {
routerMode: 'history'
@@ -51,18 +50,18 @@ export default class Renderer {
this.template = this.html
}
_getPath(url) {
_getPath (url) {
const file = this.router.getFile(url)
return isAbsolutePath(file) ? file : cwd(`./${file}`)
}
async renderToString(url) {
async renderToString (url) {
this.url = url = this.router.parse(url).path
const {loadSidebar, loadNavbar, coverpage} = this.config
const { loadSidebar, loadNavbar } = this.config
const mainFile = this._getPath(url)
this._renderHtml('main', await this._render(mainFile, 'main'))
this._renderHtml('main', await this._render(mainFile))
if (loadSidebar) {
const name = loadSidebar === true ? '_sidebar.md' : loadSidebar
@@ -76,40 +75,21 @@ export default class Renderer {
this._renderHtml('navbar', await this._render(navbarFile, 'navbar'))
}
if (coverpage) {
let path = null
if (typeof coverpage === 'string') {
if (url === '/') {
path = coverpage
}
} else if (Array.isArray(coverpage)) {
path = coverpage.indexOf(url) > -1 && '_coverpage.md'
} else {
const cover = coverpage[url]
path = cover === true ? '_coverpage.md' : cover
}
const coverFile = this._getPath(resolve(url, `./${path}`))
this._renderHtml('cover', await this._render(coverFile), 'cover')
}
const html = this.html
this.html = this.template
return html
}
_renderHtml(match, content) {
_renderHtml (match, content) {
this.html = this.html.replace(new RegExp(`<!--${match}-->`, 'g'), content)
return this.html
}
async _render(path, type) {
async _render (path, type) {
let html = await this._loadFile(path)
const {subMaxLevel, maxLevel} = this.config
let tokens
const { subMaxLevel, maxLevel } = this.config
switch (type) {
case 'sidebar':
@@ -122,19 +102,6 @@ export default class Renderer {
case 'cover':
html = this.compiler.cover(html)
break
case 'main':
tokens = await new Promise(r => {
prerenderEmbed(
{
fetch: url => this._loadFile(this._getPath(url)),
compiler: this.compiler,
raw: html
},
r
)
})
html = this.compiler.compile(tokens)
break
case 'navbar':
case 'article':
default:
@@ -145,15 +112,13 @@ export default class Renderer {
return html
}
async _loadFile(filePath) {
async _loadFile (filePath) {
debug('docsify')(`load > ${filePath}`)
let content
try {
if (isAbsolutePath(filePath)) {
const res = await fetch(filePath)
if (!res.ok) {
throw Error()
}
if (!res.ok) throw Error()
content = await res.text()
this.lock = 0
} else {
@@ -169,11 +134,8 @@ export default class Renderer {
}
const fileName = basename(filePath)
const result = await this._loadFile(
resolvePathname(`../${fileName}`, filePath)
)
return result
return await this._loadFile(resolvePathname(`../${fileName}`, filePath))
}
}
}
+1 -1
View File
@@ -37,5 +37,5 @@
"integrity": "sha1-6DWIAbhrg7F1YNTjw4LXrvIQCUQ="
}
},
"version": "4.7.0"
"version": "4.5.7"
}
@@ -1,6 +1,6 @@
{
"name": "docsify-server-renderer",
"version": "4.7.0",
"version": "4.5.7",
"description": "docsify server renderer",
"author": {
"name": "qingwei-li",
-55
View File
@@ -1,55 +0,0 @@
const liveServer = require('live-server')
const isSSR = !!process.env.SSR
const middleware = []
if (isSSR) {
const Renderer = require('./packages/docsify-server-renderer/build.js')
const renderer = new Renderer({
template: `
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>docsify</title>
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<link rel="stylesheet" href="/themes/vue.css" title="vue">
</head>
<body>
<!--inject-app-->
<!--inject-config-->
<script src="/lib/docsify.js"></script>
</body>
</html>`,
config: {
name: 'docsify',
repo: 'qingwei-li/docsify',
basePath: 'https://docsify.js.org/',
loadNavbar: true,
loadSidebar: true,
subMaxLevel: 3,
auto2top: true,
alias: {
'/de-de/changelog': '/changelog',
'/zh-cn/changelog': '/changelog',
'/changelog':
'https://raw.githubusercontent.com/QingWei-Li/docsify/master/CHANGELOG'
}
},
path: './'
})
middleware.push(function(req, res, next) {
if (/\.(css|js)$/.test(req.url)) {
return next()
}
renderer.renderToString(req.url).then(html => res.end(html))
})
}
const params = {
port: 3000,
watch: ['lib', 'docs', 'themes'],
middleware
}
liveServer.start(params)
+47 -62
View File
@@ -1,70 +1,55 @@
import {merge, hyphenate, isPrimitive, hasOwn} from './util/core'
import { merge, hyphenate, isPrimitive } from './util/core'
export default function () {
const config = merge(
{
el: '#app',
repo: '',
maxLevel: 6,
subMaxLevel: 0,
loadSidebar: null,
loadNavbar: null,
homepage: 'README.md',
coverpage: '',
basePath: '',
auto2top: false,
name: '',
themeColor: '',
nameLink: window.location.pathname,
autoHeader: false,
executeScript: null,
noEmoji: false,
ga: '',
ext: '.md',
mergeNavbar: false,
formatUpdated: '',
externalLinkTarget: '_blank',
routerMode: 'hash',
noCompileLinks: []
},
window.$docsify
)
const config = merge(
{
el: '#app',
repo: '',
maxLevel: 6,
subMaxLevel: 0,
loadSidebar: null,
loadNavbar: null,
homepage: 'README.md',
coverpage: '',
basePath: '',
auto2top: false,
name: '',
themeColor: '',
nameLink: window.location.pathname,
autoHeader: false,
executeScript: null,
noEmoji: false,
ga: '',
mergeNavbar: false,
formatUpdated: '',
externalLinkTarget: '_blank',
routerMode: 'hash',
noCompileLinks: []
},
window.$docsify
)
const script =
document.currentScript ||
[].slice
.call(document.getElementsByTagName('script'))
.filter(n => /docsify\./.test(n.src))[0]
const script =
document.currentScript ||
[].slice
.call(document.getElementsByTagName('script'))
.filter(n => /docsify\./.test(n.src))[0]
if (script) {
for (const prop in config) {
if (hasOwn.call(config, prop)) {
const val = script.getAttribute('data-' + hyphenate(prop))
if (script) {
for (const prop in config) {
const val = script.getAttribute('data-' + hyphenate(prop))
if (isPrimitive(val)) {
config[prop] = val === '' ? true : val
}
}
}
if (config.loadSidebar === true) {
config.loadSidebar = '_sidebar' + config.ext
}
if (config.loadNavbar === true) {
config.loadNavbar = '_navbar' + config.ext
}
if (config.coverpage === true) {
config.coverpage = '_coverpage' + config.ext
}
if (config.repo === true) {
config.repo = ''
}
if (config.name === true) {
config.name = ''
if (isPrimitive(val)) {
config[prop] = val === '' ? true : val
}
}
window.$docsify = config
return config
if (config.loadSidebar === true) config.loadSidebar = '_sidebar.md'
if (config.loadNavbar === true) config.loadNavbar = '_navbar.md'
if (config.coverpage === true) config.coverpage = '_coverpage.md'
if (config.repo === true) config.repo = ''
if (config.name === true) config.name = ''
}
window.$docsify = config
export default config
+6 -10
View File
@@ -1,22 +1,18 @@
import {isMobile} from '../util/env'
import {body, on} from '../util/dom'
import { isMobile } from '../util/env'
import { body, on } from '../util/dom'
import * as sidebar from './sidebar'
import {scrollIntoView} from './scroll'
import { scrollIntoView } from './scroll'
export function eventMixin(proto) {
export function eventMixin (proto) {
proto.$resetEvents = function () {
scrollIntoView(this.route.path, this.route.query.id)
if (this.config.loadNavbar) {
sidebar.getAndActive(this.router, 'nav')
}
sidebar.getAndActive(this.router, 'nav')
}
}
export function initEvent(vm) {
export function initEvent (vm) {
// Bind toggle button
sidebar.btn('button.sidebar-toggle', vm.router)
sidebar.collapse('.sidebar', vm.router)
// Bind sticky effect
if (vm.config.coverpage) {
!isMobile && on('scroll', sidebar.sticky)
+20 -40
View File
@@ -1,4 +1,4 @@
import {isMobile} from '../util/env'
import { isMobile } from '../util/env'
import * as dom from '../util/dom'
import Tweezer from 'tweezer.js'
@@ -8,10 +8,8 @@ let scroller = null
let enableScrollEvent = true
let coverHeight = 0
function scrollTo(el) {
if (scroller) {
scroller.stop()
}
function scrollTo (el) {
if (scroller) scroller.stop()
enableScrollEvent = false
scroller = new Tweezer({
start: window.pageYOffset,
@@ -26,10 +24,8 @@ function scrollTo(el) {
.begin()
}
function highlight(path) {
if (!enableScrollEvent) {
return
}
function highlight (path) {
if (!enableScrollEvent) return
const sidebar = dom.getNode('.sidebar')
const anchors = dom.findAll('.anchor')
const wrap = dom.find(sidebar, '.sidebar-nav')
@@ -42,28 +38,22 @@ function highlight(path) {
const node = anchors[i]
if (node.offsetTop > top) {
if (!last) {
last = node
}
if (!last) last = node
break
} else {
last = node
}
}
if (!last) {
return
}
const li = nav[getNavKey(decodeURIComponent(path), last.getAttribute('data-id'))]
if (!last) return
const li = nav[getNavKey(path, last.getAttribute('data-id'))]
if (!li || li === active) {
return
}
if (!li || li === active) return
active && active.classList.remove('active')
li.classList.add('active')
active = li
// Scroll into view
// scroll into view
// https://github.com/vuejs/vuejs.org/blob/master/themes/vue/source/js/common.js#L282-L297
if (!hoverOver && dom.body.classList.contains('sticky')) {
const height = sidebar.clientHeight
@@ -78,11 +68,11 @@ function highlight(path) {
}
}
function getNavKey(path, id) {
function getNavKey (path, id) {
return `${path}?id=${id}`
}
export function scrollActiveSidebar(router) {
export function scrollActiveSidebar (router) {
const cover = dom.find('.cover.show')
coverHeight = cover ? cover.offsetHeight : 0
@@ -92,26 +82,18 @@ export function scrollActiveSidebar(router) {
for (let i = 0, len = lis.length; i < len; i += 1) {
const li = lis[i]
const a = li.querySelector('a')
if (!a) {
continue
}
if (!a) continue
let href = a.getAttribute('href')
if (href !== '/') {
const {query: {id}, path} = router.parse(href)
if (id) {
href = getNavKey(path, id)
}
const { query: { id }, path } = router.parse(href)
if (id) href = getNavKey(path, id)
}
if (href) {
nav[decodeURIComponent(href)] = li
}
if (href) nav[decodeURIComponent(href)] = li
}
if (isMobile) {
return
}
if (isMobile) return
const path = router.getCurrentPath()
dom.off('scroll', () => highlight(path))
dom.on('scroll', () => highlight(path))
@@ -123,10 +105,8 @@ export function scrollActiveSidebar(router) {
})
}
export function scrollIntoView(path, id) {
if (!id) {
return
}
export function scrollIntoView (path, id) {
if (!id) return
const section = dom.find('#' + id)
section && scrollTo(section)
@@ -140,6 +120,6 @@ export function scrollIntoView(path, id) {
const scrollEl = dom.$.scrollingElement || dom.$.documentElement
export function scroll2Top(offset = 0) {
export function scroll2Top (offset = 0) {
scrollEl.scrollTop = offset === true ? 0 : Number(offset)
}
+11 -22
View File
@@ -1,11 +1,11 @@
import {isMobile} from '../util/env'
import { isMobile } from '../util/env'
import * as dom from '../util/dom'
const title = dom.$.title
/**
* Toggle button
*/
export function btn(el) {
export function btn (el, router) {
const toggle = _ => dom.body.classList.toggle('close')
el = dom.getNode(el)
@@ -14,33 +14,22 @@ export function btn(el) {
toggle()
})
const sidebar = dom.getNode('.sidebar')
isMobile &&
dom.on(
dom.body,
'click',
_ => dom.body.classList.contains('close') && toggle()
)
dom.on(sidebar, 'click', _ =>
setTimeout((_ => getAndActive(router, sidebar, true, true), 0))
)
}
export function collapse(el) {
el = dom.getNode(el)
dom.on(el, 'click', ({target}) => {
if (
target.nodeName === 'A' &&
target.nextSibling &&
target.nextSibling.classList.contains('app-sub-sidebar')
) {
dom.toggleClass(target.parentNode, 'collapse')
}
})
}
export function sticky() {
export function sticky () {
const cover = dom.getNode('section.cover')
if (!cover) {
return
}
if (!cover) return
const coverHeight = cover.getBoundingClientRect().height
if (window.pageYOffset >= coverHeight || cover.classList.contains('hidden')) {
@@ -58,11 +47,11 @@ export function sticky() {
* @param {Boolean} autoTitle auto set title
* @return {element}
*/
export function getAndActive(router, el, isParent, autoTitle) {
export function getAndActive (router, el, isParent, autoTitle) {
el = dom.getNode(el)
const links = dom.findAll(el, 'a')
const hash = decodeURI(router.toURL(router.getCurrentPath()))
const hash = router.toURL(router.getCurrentPath())
let target
links.sort((a, b) => b.href.length - a.href.length).forEach(a => {
+4 -9
View File
@@ -1,5 +1,5 @@
import progressbar from '../render/progressbar'
import {noop, hasOwn} from '../util/core'
import { noop } from '../util/core'
const cache = {}
@@ -9,7 +9,7 @@ const cache = {}
* @param {boolean} [hasBar=false] has progress bar
* @return { then(resolve, reject), abort }
*/
export function get(url, hasBar = false, headers = {}) {
export function get (url, hasBar = false) {
const xhr = new XMLHttpRequest()
const on = function () {
xhr.addEventListener.apply(xhr, arguments)
@@ -17,15 +17,10 @@ export function get(url, hasBar = false, headers = {}) {
const cached = cache[url]
if (cached) {
return {then: cb => cb(cached.content, cached.opt), abort: noop}
return { then: cb => cb(cached.content, cached.opt), abort: noop }
}
xhr.open('GET', url)
for (const i in headers) {
if (hasOwn.call(headers, i)) {
xhr.setRequestHeader(i, headers[i])
}
}
xhr.send()
return {
@@ -47,7 +42,7 @@ export function get(url, hasBar = false, headers = {}) {
}
on('error', error)
on('load', ({target}) => {
on('load', ({ target }) => {
if (target.status >= 400) {
error(target)
} else {
+47 -169
View File
@@ -1,68 +1,37 @@
import {get} from './ajax'
import {callHook} from '../init/lifecycle'
import {getParentPath, stringifyQuery} from '../router/util'
import {noop} from '../util/core'
import {getAndActive} from '../event/sidebar'
import { get } from './ajax'
import { callHook } from '../init/lifecycle'
import { getParentPath, stringifyQuery } from '../router/util'
import { noop } from '../util/core'
import { getAndActive } from '../event/sidebar'
function loadNested(path, qs, file, next, vm, first) {
function loadNested (path, qs, file, next, vm, first) {
path = first ? path : path.replace(/\/$/, '')
path = getParentPath(path)
if (!path) {
return
}
if (!path) return
get(
vm.router.getFile(path + file) + qs,
false,
vm.config.requestHeaders
).then(next, _ => loadNested(path, qs, file, next, vm))
get(vm.router.getFile(path + file) + qs).then(next, _ =>
loadNested(path, qs, file, next, vm)
)
}
export function fetchMixin(proto) {
export function fetchMixin (proto) {
let last
proto._fetch = function (cb = noop) {
const { path, query } = this.route
const qs = stringifyQuery(query, ['id'])
const { loadNavbar, loadSidebar } = this.config
const abort = () => last && last.abort && last.abort()
const request = (url, hasbar, requestHeaders) => {
abort()
last = get(url, true, requestHeaders)
return last
}
// Abort last request
last && last.abort && last.abort()
const get404Path = (path, config) => {
const {notFoundPage, ext} = config
const defaultPath = '_404' + (ext || '.md')
let key
let path404
last = get(this.router.getFile(path) + qs, true)
switch (typeof notFoundPage) {
case 'boolean':
path404 = defaultPath
break
case 'string':
path404 = notFoundPage
break
// Current page is html
this.isHTML = /\.html$/g.test(path)
case 'object':
key = Object.keys(notFoundPage)
.sort((a, b) => b.length - a.length)
.find(key => path.match(new RegExp('^' + key)))
path404 = (key && notFoundPage[key]) || defaultPath
break
default:
break
}
return path404
}
proto._loadSideAndNav = function (path, qs, loadSidebar, cb) {
return () => {
if (!loadSidebar) {
return cb()
}
const loadSideAndNav = () => {
if (!loadSidebar) return cb()
const fn = result => {
this._renderSidebar(result)
@@ -72,30 +41,16 @@ export function fetchMixin(proto) {
// Load sidebar
loadNested(path, qs, loadSidebar, fn, this, true)
}
}
proto._fetch = function (cb = noop) {
const {path, query} = this.route
const qs = stringifyQuery(query, ['id'])
const {loadNavbar, requestHeaders, loadSidebar} = this.config
// Abort last request
const file = this.router.getFile(path)
const req = request(file + qs, true, requestHeaders)
// Current page is html
this.isHTML = /\.html$/g.test(file)
// Load main content
req.then(
(text, opt) =>
this._renderMain(
text,
opt,
this._loadSideAndNav(path, qs, loadSidebar, cb)
),
last.then(
(text, opt) => {
this._renderMain(text, opt)
loadSideAndNav()
},
_ => {
this._fetchFallbackPage(file, qs, cb) || this._fetch404(file, qs, cb)
this._renderMain(null)
loadSideAndNav()
}
)
@@ -112,120 +67,43 @@ export function fetchMixin(proto) {
}
proto._fetchCover = function () {
const {coverpage, requestHeaders} = this.config
const { coverpage } = this.config
const query = this.route.query
const root = getParentPath(this.route.path)
const path = this.router.getFile(root + coverpage)
if (coverpage) {
let path = null
const routePath = this.route.path
if (typeof coverpage === 'string') {
if (routePath === '/') {
path = coverpage
}
} else if (Array.isArray(coverpage)) {
path = coverpage.indexOf(routePath) > -1 && '_coverpage'
} else {
const cover = coverpage[routePath]
path = cover === true ? '_coverpage' : cover
}
const coverOnly = Boolean(path) && this.config.onlyCover
if (path) {
path = this.router.getFile(root + path)
this.coverIsHTML = /\.html$/g.test(path)
get(path + stringifyQuery(query, ['id']), false, requestHeaders).then(
text => this._renderCover(text, coverOnly)
)
} else {
this._renderCover(null, coverOnly)
}
return coverOnly
if (this.route.path !== '/' || !coverpage) {
this._renderCover()
return
}
this.coverIsHTML = /\.html$/g.test(path)
get(path + stringifyQuery(query, ['id'])).then(text =>
this._renderCover(text)
)
}
proto.$fetch = function (cb = noop) {
const done = () => {
this._fetchCover()
this._fetch(result => {
this.$resetEvents()
callHook(this, 'doneEach')
cb()
}
const onlyCover = this._fetchCover()
if (onlyCover) {
done()
} else {
this._fetch(() => {
this.$resetEvents()
done()
})
}
}
proto._fetchFallbackPage = function (path, qs, cb = noop) {
const {requestHeaders, fallbackLanguages, loadSidebar} = this.config
if (!fallbackLanguages) {
return false
}
const local = path.split('/')[1]
if (fallbackLanguages.indexOf(local) === -1) {
return false
}
const newPath = path.replace(new RegExp(`^/${local}`), '')
const req = request(newPath + qs, true, requestHeaders)
req.then(
(text, opt) =>
this._renderMain(
text,
opt,
this._loadSideAndNav(path, qs, loadSidebar, cb)
),
() => this._fetch404(path, qs, cb)
)
return true
}
/**
* Load the 404 page
* @param path
* @param qs
* @param cb
* @returns {*}
* @private
*/
proto._fetch404 = function (path, qs, cb = noop) {
const {loadSidebar, requestHeaders, notFoundPage} = this.config
const fnLoadSideAndNav = this._loadSideAndNav(path, qs, loadSidebar, cb)
if (notFoundPage) {
const path404 = get404Path(path, this.config)
request(this.router.getFile(path404), true, requestHeaders).then(
(text, opt) => this._renderMain(text, opt, fnLoadSideAndNav),
() => this._renderMain(null, {}, fnLoadSideAndNav)
)
return true
}
this._renderMain(null, {}, fnLoadSideAndNav)
return false
})
}
}
export function initFetch(vm) {
const {loadSidebar} = vm.config
export function initFetch (vm) {
const { loadSidebar } = vm.config
// Server-Side Rendering
// server-client renderer
if (vm.rendered) {
const activeEl = getAndActive(vm.router, '.sidebar-nav', true, true)
if (loadSidebar && activeEl) {
activeEl.parentNode.innerHTML += window.__SUB_SIDEBAR__
}
vm._bindEventOnRendered(activeEl)
vm._fetchCover()
vm.$resetEvents()
callHook(vm, 'doneEach')
callHook(vm, 'ready')
+4 -4
View File
@@ -1,13 +1,13 @@
import * as util from './util'
import * as dom from './util/dom'
import {Compiler} from './render/compiler'
import {slugify} from './render/slugify'
import {get} from './fetch/ajax'
import { Compiler } from './render/compiler'
import { slugify } from './render/slugify'
import { get } from './fetch/ajax'
import marked from 'marked'
import prism from 'prismjs'
export default function () {
window.Docsify = {util, dom, get, slugify}
window.Docsify = { util, dom, get, slugify }
window.DocsifyCompiler = Compiler
window.marked = marked
window.Prism = prism
+7 -7
View File
@@ -1,14 +1,14 @@
import {initMixin} from './init'
import {routerMixin} from './router'
import {renderMixin} from './render'
import {fetchMixin} from './fetch'
import {eventMixin} from './event'
import { initMixin } from './init'
import { routerMixin } from './router'
import { renderMixin } from './render'
import { fetchMixin } from './fetch'
import { eventMixin } from './event'
import initGlobalAPI from './global-api'
/**
* Fork https://github.com/bendrucker/document-ready/blob/master/index.js
*/
function ready(callback) {
function ready (callback) {
const state = document.readyState
if (state === 'complete' || state === 'interactive') {
@@ -18,7 +18,7 @@ function ready(callback) {
document.addEventListener('DOMContentLoaded', callback)
}
function Docsify() {
function Docsify () {
this._init()
}
+9 -9
View File
@@ -1,15 +1,15 @@
import config from '../config'
import {initLifecycle, callHook} from './lifecycle'
import {initRender} from '../render'
import {initRouter} from '../router'
import {initEvent} from '../event'
import {initFetch} from '../fetch'
import {isFn} from '../util/core'
import { initLifecycle, callHook } from './lifecycle'
import { initRender } from '../render'
import { initRouter } from '../router'
import { initEvent } from '../event'
import { initFetch } from '../fetch'
import { isFn } from '../util/core'
export function initMixin(proto) {
export function initMixin (proto) {
proto._init = function () {
const vm = this
vm.config = config()
vm.config = config || {}
initLifecycle(vm) // Init hooks
initPlugin(vm) // Install plugins
@@ -22,6 +22,6 @@ export function initMixin(proto) {
}
}
function initPlugin(vm) {
function initPlugin (vm) {
[].concat(vm.config.plugins).forEach(fn => isFn(fn) && fn(vm._lifecycle, vm))
}

Some files were not shown because too many files have changed in this diff Show More