Compare commits

..
126 Commits
Author SHA1 Message Date
qingwei.li d6ac7031b0 chore: add changelog 4.2.9 2017-08-15 23:47:21 +08:00
qingwei.li 4417f4669d [build] 4.2.9 2017-08-15 23:47:20 +08:00
qingwei.li b7735066ff chore(*): remove document-ready 2017-08-15 23:46:47 +08:00
yeloandcinwell.li 10045249d3 ensure document ready before init Docsify (#233) 2017-08-15 23:35:27 +08:00
qingwei.li 190710733e chore: add changelog 4.2.8 2017-08-10 08:46:26 +08:00
qingwei.li b292d819fc [build] 4.2.8 2017-08-10 08:46:25 +08:00
qingwei.li 7f270f93c6 feat(compiler): support for setting target attribute for link, fixed #230 2017-08-10 08:45:49 +08:00
qingwei.li c3a149679a chore(*): tweaks changelog 2017-08-05 09:56:53 +08:00
qingwei.li 5efa763075 chore: add changelog 4.2.7 2017-08-05 09:54:25 +08:00
qingwei.li 03a04f7898 [build] 4.2.7 2017-08-05 09:54:24 +08:00
qingwei.li a88252c6b2 fix(style): nowrap => pre-wrap, fixed #228 2017-08-05 09:53:57 +08:00
Nedim Arabacıandcinwell.li 2f5f90750a Noty added to showcase (#226)
Nice documentation site generator! Thanks.
2017-07-28 13:30:09 +08:00
qingwei.li 709c152950 chore: add changelog 4.2.6 2017-07-27 10:03:18 +08:00
qingwei.li b09a5a317e [build] 4.2.6 2017-07-27 10:03:17 +08:00
qingwei.li 628e2115a3 fix(release): release shell 2017-07-27 10:02:49 +08:00
qingwei.li 271dde8f5e chore(*): fix changelog script 2017-07-27 09:58:37 +08:00
qingwei.li 1fa1619278 fix(css): hide the nav when the content has not yet been loaded 2017-07-27 09:50:21 +08:00
qingwei.li 3de3def8a8 chore(*): fix changelog script 2017-07-26 18:55:13 +08:00
qingwei.li fb25726426 chore: add changelog 4.2.4 2017-07-26 18:52:59 +08:00
qingwei.li 36ddc42e91 [release] 4.2.4 2017-07-26 18:52:58 +08:00
qingwei.li abb0f6019f [build] 4.2.4 2017-07-26 18:52:58 +08:00
qingwei.li b8dd346baf fix(render): Remove getRootNode to be compatible with the lower version of Chrome, fixed #225 2017-07-26 18:52:36 +08:00
qingwei.li 7191d702e1 chore(*): add cdn 2017-07-26 08:42:07 +08:00
qingwei.li c039f1bfc0 chore: add changelog 4.2.3 2017-07-26 08:37:36 +08:00
qingwei.li f859d2d0b2 [release] 4.2.3 2017-07-26 08:37:35 +08:00
qingwei.li 9735f4036e [build] 4.2.3 2017-07-26 08:37:35 +08:00
qingwei.li b8a96b867b Merge branch 'master' of github.com:qingwei-li/docsify 2017-07-26 08:37:02 +08:00
qingwei.li b7b589b1bf feat(search): Supports the max depth of the search headline, fixed #223, resolve #129 2017-07-26 08:36:35 +08:00
qingwei.li 761e38f6ad chore: add changelog 4.2.2 2017-07-24 19:06:24 +08:00
qingwei.li 78899a0251 [release] 4.2.2 2017-07-24 19:00:39 +08:00
qingwei.li 357631c8b7 [build] 4.2.2 2017-07-24 19:00:12 +08:00
qingwei.li 17ff3d1506 fix: style rerender due to setting themeColor 2017-07-24 18:57:41 +08:00
Leon Zhangandcinwell.li f59aac478a Update README.md (#219) 2017-07-20 10:54:21 +08:00
qingwei.li 0dd2497467 chore: add history.md 2017-07-20 01:15:39 +08:00
qingwei.li 306136f6a3 chore: update changlog 2017-07-20 01:13:47 +08:00
qingwei.li 4aba9d0a25 chore(*): remove history.md 2017-07-20 01:05:01 +08:00
qingwei.li 3d2f23bcdc chore: add changelog 4.2.1 2017-07-20 00:58:17 +08:00
qingwei.li b85eb0ff4b [release] 4.2.1 2017-07-20 00:58:16 +08:00
qingwei.li efa8d25912 [build] 4.2.1 2017-07-20 00:58:15 +08:00
qingwei.li 437737cc5a chore: update release shell 2017-07-20 00:53:25 +08:00
qingwei.li 992ff77808 chore: remove yarnlock 2017-07-20 00:41:46 +08:00
yeloandcinwell.li 4cf13db685 give the navbar some line-height (#216) 2017-07-19 16:09:10 +08:00
Kim Burgessandcinwell.li e54062f80d Remove unnecessary moduleName option from rollup config for plugins (#209) 2017-07-18 17:44:25 +08:00
qingwei.li cee8ac6698 fix typo 2017-07-12 08:56:52 +08:00
Mario Neblandcinwell.li d057f66fce docs: add commitlint to showcase (#207) 2017-07-12 08:55:27 +08:00
Dobromir Hristovandcinwell.li 9b0f1978a4 docs: Add palettify in Showcase (#206) 2017-07-11 08:19:00 +08:00
qingwei.li d9848c3384 [release] 4.2.0 2017-07-10 22:40:40 +08:00
qingwei.li 4dabae3bf2 [build] 4.2.0 2017-07-10 22:40:38 +08:00
qingwei.li b430993f4f chore: add changelog 2017-07-10 22:39:42 +08:00
cinwell.liandGitHub 2e00f4c993 feat: ignore to compiled link, fixed #203 (#204)
* feat: ignore to compiled link, fixed #203

* feat: add noCompileLinks, fixed #203

* fix: remove test code
2017-07-10 22:38:26 +08:00
qingwei.li 7fb5ce6c84 docs: add alias 2017-07-10 22:23:09 +08:00
qingwei.li c4aa22c56d feat: alias option supports regexp, resolve #183 2017-07-10 22:19:55 +08:00
qingwei.li 9af855921e fix: not found page 2017-07-09 10:48:41 +08:00
qingwei.li 4492c3e19f [release] 4.1.14 2017-06-24 20:52:21 +08:00
qingwei.li f598e53098 [build] 4.1.14 2017-06-24 20:52:21 +08:00
qingwei.li 4bde6d685c add changelog 2017-06-24 20:51:53 +08:00
qingwei.li ce0e9acd50 feat: add context attribute, fixed #191 2017-06-23 17:09:13 +08:00
qingwei.li e8117e515d fix: get file path, fixed jrappen/sublime-distractionless/commit/81bfadd391428823191cc03eca956a2312e04d13#commitcomment-22427070 2017-06-23 16:52:37 +08:00
cinwell.liandGitHub 25e09dfe07 Merge pull request #195 from crawt/master
Filter picture
2017-06-18 02:19:14 +08:00
Leo PanandGitHub a6b46a3e26 Filter picture
use regular filter picturn in search
2017-06-16 16:45:21 +08:00
Kevin Leungandcinwell.li d469442eae Update doc for external link target (#194) 2017-06-16 16:14:23 +08:00
qingwei.li 9f310bbd7d [release] 4.1.13 2017-06-11 18:58:32 +08:00
qingwei.li cc8a7c97b6 [build] 4.1.13 2017-06-11 18:58:31 +08:00
qingwei.li 19da658ba2 add changelog 2017-06-11 18:58:13 +08:00
qingwei.li 97db30a0b9 fix ga 2017-06-11 18:57:21 +08:00
Tony Nganandcinwell.li 3a0765e11e add samlify (#189) 2017-06-08 22:03:25 +08:00
Samina Fuandcinwell.li aaf71b1ac0 Add CDNJS version badge in README.md (#185)
This badge will show the version on CDNJS!
2017-06-06 12:44:33 +08:00
qingwei.li b37781e949 [release] 4.1.12 2017-06-03 20:12:32 +08:00
qingwei.li 54a48dd3ff [build] 4.1.12 2017-06-03 20:12:32 +08:00
qingwei.li 1aabc41db7 add changelog 2017-06-03 20:12:08 +08:00
qingwei.li d087d5753b fix(render): ubtitle in side bar shows undefined, fixed #182 2017-06-03 20:11:34 +08:00
qingwei.li bb793ec08e update package size 2017-06-02 22:37:27 +08:00
qingwei.li 6a78ae7ddc [release] 4.1.11 2017-06-02 22:18:36 +08:00
qingwei.li ac28040bd7 [build] 4.1.11 2017-06-02 22:18:36 +08:00
qingwei.li b12f74b159 add changelog 2017-06-02 22:16:39 +08:00
qingwei.li 1304d2ea1a fix(render): autoHeader does not work 2017-06-02 22:14:28 +08:00
qingwei.li ccf4c7c5cc fix(compiler): force reset toc when rendering sidebar fixed #181 2017-06-02 22:12:07 +08:00
qingwei.li 9b15d8d577 update cdn version 2017-06-02 18:04:20 +08:00
qingwei.li 642e7da7ee [release] 4.1.10 2017-06-02 17:57:56 +08:00
qingwei.li 75381cf046 [build] 4.1.10 2017-06-02 17:57:56 +08:00
qingwei.li 7e2e5a7c90 add changelog 2017-06-02 17:57:32 +08:00
qingwei.li 6d48ce1266 fix(hash): hash routing crashes when url has querystring 2017-06-02 17:56:38 +08:00
qingwei.li d286963da0 update readme 2017-06-02 17:41:13 +08:00
qingwei.li 8a4cedd962 replaced unpkg cdn with jsdelivr 2017-06-01 21:25:08 +08:00
Wei Wangandcinwell.li a3b7b66a76 Fix broken footer (#178) 2017-06-01 13:32:39 +08:00
qingwei.li 5a0d4b7897 docs(cdn): update jsdelivr cdn 2017-06-01 10:29:12 +08:00
Michelle Brierandcinwell.li fcfdb17b8d Add license scan badge (#176) 2017-06-01 07:44:19 +08:00
Michelle Brierandcinwell.li e4d2e7ec12 Add license report
Large report badge
2017-06-01 07:43:59 +08:00
qingwei.li ece00e6b3a [release] 4.1.9 2017-05-31 22:32:57 +08:00
qingwei.li 841829427b [build] 4.1.9 2017-05-31 22:32:30 +08:00
qingwei.li 56c7b9ae2d add changelog 2017-05-31 22:20:46 +08:00
qingwei.li db8400a6ac docs: add feature 2017-05-31 22:19:43 +08:00
qingwei.li 955d3d5988 fix(lifecycle): continue to handle data 2017-05-31 21:20:09 +08:00
qingwei.li d9b487e67b fix: can't render toc on first load 2017-05-31 20:42:29 +08:00
qingwei.li 91b66a5cac fix(render): broken name link, fixed #167 2017-05-31 20:35:59 +08:00
qingwei.li 90bba60367 add package-lock.json 2017-05-31 14:22:43 +08:00
qingwei.li d05c4f65a8 add lerna 2017-05-31 10:01:15 +08:00
qingwei.li 3380a62142 [release] 4.1.8 2017-05-31 08:39:22 +08:00
qingwei.li 8e418a1681 [build] 4.1.8 2017-05-31 08:39:22 +08:00
qingwei.li 20d60c401f docs(write-a-plugin): update demo 2017-05-31 08:39:01 +08:00
qingwei.li 1938fd5146 docs(ssr): update 2017-05-31 08:35:01 +08:00
qingwei.li 3b74c49f00 fix(pure-css):add coverpage style, fixed #165 2017-05-31 08:27:11 +08:00
qingwei.li 22b50f07c3 fix: auto replace version 2017-05-31 08:25:00 +08:00
qingwei.li ec887c1b5f fix: update edit button demo 2017-05-30 20:17:17 +08:00
qingwei.li 036fdac131 feat: add edit button demo, close #162 2017-05-30 20:14:31 +08:00
qingwei.li a64cee1236 feat: add edit button demo 2017-05-30 20:12:25 +08:00
qingwei.li f943fede99 [release] 4.1.7 2017-05-30 19:40:03 +08:00
qingwei.li e296439df3 [build] 4.1.7 2017-05-30 19:40:02 +08:00
qingwei.li 0014895c19 fix(ssr): clean files 2017-05-30 19:39:39 +08:00
qingwei.li 23590fa7e7 fix typo 2017-05-30 17:58:28 +08:00
qingwei.li 8689a37121 update readme 2017-05-30 16:34:36 +08:00
qingwei.li 05a0211861 update readme 2017-05-30 16:27:13 +08:00
qingwei.li 318189a13f [release] 4.1.6 2017-05-30 16:18:24 +08:00
qingwei.li 42795a0483 [build] 4.1.6 2017-05-30 16:18:23 +08:00
qingwei.li 6b9e0922cf fix(ssr): add debug 2017-05-30 16:16:36 +08:00
qingwei.li 8cb4189b96 update docs 2017-05-30 15:41:34 +08:00
qingwei.li 7eb6346075 [release] 4.1.5 2017-05-30 15:38:44 +08:00
qingwei.li 238e9633f9 [build] 4.1.5 2017-05-30 15:38:44 +08:00
qingwei.li 6db8c9e6c9 fix(ssr): missing package 2017-05-30 15:34:48 +08:00
qingwei.li e160bcaded [release] 4.1.4 2017-05-30 15:28:58 +08:00
qingwei.li 8cf69754b5 [build] 4.1.4 2017-05-30 15:28:58 +08:00
qingwei.li 79a83bc17d fix(ssr): file path 2017-05-30 15:27:04 +08:00
qingwei.li 81c87f7926 update readme 2017-05-30 14:01:06 +08:00
qingwei.li 67ec128315 [release] 4.1.3 2017-05-30 13:58:28 +08:00
qingwei.li 77657e3b64 [build] 4.1.3 2017-05-30 13:58:28 +08:00
qingwei.li 9825db47af fix: update babel config 2017-05-30 13:58:05 +08:00
80 changed files with 6532 additions and 4278 deletions
+215 -99
View File
@@ -1,165 +1,281 @@
# Changelog
<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)
## 4.1.0 / 2017-05-30 🎂 for me
* feat: Support server client renderer [See detail](//docsify.js.org/#/ssr)
* feat: Support HTML5 history API. `$docsify.routerMode = 'history'`
* Breaking change: Clean global API
<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)
## 3.7.3 / 2017-05-22
* fix(render): find => filter, Compatible with old browser
* Pretty dir tree
### Features
## 3.7.2 / 2017-05-19
* **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))
* tweaks
## 3.7.1 / 2017-05-19
* fix: docsify-updated is undefined
<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)
## 3.7.0 / 2017-05-16
* feat: add externalLinkTarget, close ([#149](https://github.com/QingWei-Li/docsify/issues/149)
* feat: add **{docsify-updated<span>}</span>**, close ([#158](https://github.com/QingWei-Li/docsify/issues/158)
### Bug Fixes
## 3.6.6 / 2017-05-06
* **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))
* feat: support query string for the search, likes `https://docsify.js.org/#/?s=navbar`, fixed ([#156](https://github.com/QingWei-Li/docsify/issues/156)
## 3.6.5 / 2017-04-28
* fix(util): fix crash, fixed ([#154](https://github.com/QingWei-Li/docsify/issues/154)
<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)
## 3.6.4 / 2017-04-28
* fix(util): correctly clean up duplicate slashes, fixed ([#153](https://github.com/QingWei-Li/docsify/issues/153)
### Bug Fixes
## 3.6.3 / 2017-04-25
* **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))
* fix(external-script): script attrs
## 3.6.2/ 2017-04-12
* feat(external-script): detect more than one script dom, fixed ([#146](https://github.com/QingWei-Li/docsify/issues/146)
* GA: Send hash instead of complete href ([#147](https://github.com/QingWei-Li/docsify/issues/147)
<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)
## 3.6.1 / 2017-04-09
* feat(event): Collapse the sidebar when click outside element in the small screen
### Bug Fixes
## 3.6.0 / 2017-04-09
* **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))
* feat(render): add mergeNavbar option, close ([#125](https://github.com/QingWei-Li/docsify/issues/125)
<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)
## 3.5.2/ 2017-04-05
* add optional current route param to toURL and use it to properly compose local anchor links
* fix code style by removing semicolons
* in toURL test for anchor links and if so prepend the currentPath to the generated path. fixes ([#142](https://github.com/QingWei-Li/docsify/issues/142))
### Features
## 3.5.1 / 2017-03-25
* **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))
* fix: .md file extension regex
## 3.5.0 / 2017-03-25
* feat(route): auto remove .md extension
* fix: adjust display on small screens [@jrappen](https://github.com/jrappen)
* fix: navbar labels for German [@jrappen](https://github.com/jrappen)
<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)
## 3.4.4 / 2017-03-17
* fix(search): fix input style
* fix search plugin match bug
### Bug Fixes
## 3.4.3 / 2017-03-16
* style rerender due to setting themeColor ([17ff3d1](https://github.com/QingWei-Li/docsify/commit/17ff3d1))
* Add ability to ignore headers when generating toc ([#127](https://github.com/QingWei-Li/docsify/issues/127) [@christopherwk210](https://github.com/christopherwk210))
* fix external-script not inserting script at right place [@Leopoldthecoder](https://github.com/Leopoldthecoder)
* add German docs [@jrappen](https://github.com/jrappen)
## 3.4.2 / 2017-03-11
* feat(emojify): add no-emoji option
<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)
## 3.4.1 / 2017-03-10
- give the navbar some line-height (#216)
- Remove unnecessary moduleName option from rollup config for plugins (#209)
* fix(dom): Disable the dom cache when vue is present, fixed [#119](https://github.com/QingWei-Li/docsify/issues/119)
* update english docs, [@jrappen](https://github.com/jrappen)
<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)
## 3.4.0 / 2017-03-09
* feat(zoom-image): add plugin
### Bug Fixes
## 3.3.0 / 2017-03-07
* not found page ([9af8559](https://github.com/QingWei-Li/docsify/commit/9af8559))
* add front-matter plugin
* add external-script plugin, [@Leopoldthecoder](https://github.com/Leopoldthecoder)
* Fix nav showing while loading ([#112](https://github.com/QingWei-Li/docsify/issues/112))
## 3.2.0 / 2017-02-28
### Features
* fix(render): Toc rendering error, fixed [#106](https://github.com/QingWei-Li/docsify/issues/106)
* feat(search): Localization for no data tip, close [#103](https://github.com/QingWei-Li/docsify/issues/103)
* fix(fetch): load sidebar and navbar for parent path, fixed [#100](https://github.com/QingWei-Li/docsify/issues/100)
* feat(render) nameLink for each route, fixed [#99](https://github.com/QingWei-Li/docsify/issues/99)
* 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))
## 3.1.2 / 2017-02-27
* fix(search): dont search nameLink, fixed [#102](https://github.com/QingWei-Li/docsify/issues/102)
## 3.1.1 / 2017-02-24
<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)
* fix(search): dont search nameLink, fixed [#102](https://github.com/QingWei-Li/docsify/issues/102)
* fix(render): custom cover background image
* fix(tpl): extra character, fixed [#101](https://github.com/QingWei-Li/docsify/issues/101)
## 3.1.0 / 2017-02-22
### Bug Fixes
* fix(search): incorrect anchor link, fixed [#90](https://github.com/QingWei-Li/docsify/issues/90)
* feat(emoji): add emoji plugin
* 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)
## 3.0.5 / 2017-02-21
* feat(pwa): add sw.js
* fix(layout.css): loading style
* fix(event): highlight sidebar when clicked, fixed [#86](https://github.com/QingWei-Li/docsify/issues/86)
* fix(gen-tree): cache toc list, fixed [#88](https://github.com/QingWei-Li/docsify/issues/88)
### Features
## 3.0.4 / 2017-02-20
* add context attribute, fixed [#191](https://github.com/QingWei-Li/docsify/issues/191) ([ce0e9ac](https://github.com/QingWei-Li/docsify/commit/ce0e9ac))
* fix(render): execute script
* fix(render): disable rendering sub list when loadSidebar is false
## 3.0.3 / 2017-02-19
* fixed look of links in blockquote
* fix(scroll) highlight bug
<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)
## 3.0.2 / 2017-02-19
* fix(search): add lazy input
* fix(compiler): link
## 3.0.1 / 2017-02-19
<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)
* fix(route): empty alias
## 3.0.0 / 2017-02-19
### Bug Fixes
##### Breaking change
* **render:** ubtitle in side bar shows undefined, fixed [#182](https://github.com/QingWei-Li/docsify/issues/182) ([d087d57](https://github.com/QingWei-Li/docsify/commit/d087d57))
* Not support IE9
* The route becomes: `/#/page?id=slug`. The previous route will be redirected
##### Features
* Faster rendering
* Clearer source code
* More powerful API
* Auto header for each page [#78](https://github.com/QingWei-Li/docsify/issues/78)
* Localization for search plugin [#80](https://github.com/QingWei-Li/docsify/issues/80)
* Execute the script in markdown (see `executeScript`)
<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>
## [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>
## [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>
## [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>
## [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>
## [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>
## [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))
<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>
## [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>
## [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>
## [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>
# [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>
## [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>
## [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>
# [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))
+568 -344
View File
File diff suppressed because it is too large Load Diff
+16 -5
View File
@@ -11,22 +11,26 @@
<p align="center">
<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://cdnjs.com/libraries/docsify"><img alt="cdnjs" src="https://img.shields.io/cdnjs/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>
<a href="https://app.fossa.io/projects/git%2Bhttps%3A%2F%2Fgithub.com%2FQingWei-Li%2Fdocsify?ref=badge_shield" alt="FOSSA Status"><img src="https://app.fossa.io/api/projects/git%2Bhttps%3A%2F%2Fgithub.com%2FQingWei-Li%2Fdocsify.svg?type=shield"/></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/)
## Features
- No statically built html files
- Simple and lightweight (~16kB gzipped)
- 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
@@ -39,12 +43,12 @@ Create an `index.html`.
<html>
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="//unpkg.com/docsify/lib/themes/vue.css">
<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>
<script src="//unpkg.com/docsify/lib/docsify.min.js"></script>
</html>
```
@@ -54,7 +58,7 @@ Modern browsers and Internet Explorer 10+.
## Showcase
These open-source projects are using docsify to generate their sites. Pull requests welcome :blush:
These projects are using docsify to generate their sites. Pull requests welcome :blush:
| Project | Description |
|---|---|
@@ -67,6 +71,11 @@ These open-source projects are using docsify to generate their sites. Pull reque
| [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 tablebased on vue2 and element-ui. |
| [Noty](http://ned.im/noty/) | A Dependency-free notification library |
## Similar projects
@@ -87,10 +96,12 @@ These open-source projects are using docsify to generate their sites. Pull reque
## Development
```bash
npm i && npm run dev
npm run bootstrap && npm run dev
open http://localhost:3000
```
## 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)
+11
View File
@@ -0,0 +1,11 @@
var fs = require('fs')
var read = fs.readFileSync
var write = fs.writeFileSync
var version = process.env.VERSION || require('../package.json').version
var file = __dirname + '/../docs/_coverpage.md'
var cover = read(file, 'utf8').toString()
console.log('Replace version number in cover page...')
cover = cover.replace(/<small>(\S+)?<\/small>/g, '<small>' + version + '</small>')
write(file, cover)
+11 -12
View File
@@ -1,21 +1,20 @@
var rollup = require('rollup')
var babel = require('rollup-plugin-babel')
var isProd = process.argv[process.argv.length - 1] !== '--dev'
var buble = require('rollup-plugin-buble')
var async = require('rollup-plugin-async')
var replace = require('rollup-plugin-replace')
rollup
.rollup({
entry: 'packages/docsify-server-renderer/index.js',
plugins: [
babel({
plugins: ['transform-async-to-generator'],
presets: [
[
'es2015',
{
modules: false
}
]
]
async(),
replace({
__VERSION__: process.env.VERSION || require('../package.json').version
}),
buble({
transforms: {
generator: false
}
})
],
onwarn: function() {}
+13 -11
View File
@@ -4,7 +4,9 @@ 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
var build = function (opts) {
rollup
@@ -14,7 +16,10 @@ var build = function (opts) {
string({ include: '**/*.css' }),
buble(),
commonjs(),
nodeResolve()
nodeResolve(),
replace({
__VERSION__: version
})
])
})
.then(function (bundle) {
@@ -23,7 +28,6 @@ var build = function (opts) {
console.log(dest)
bundle.write({
format: 'iife',
moduleName: opts.moduleName || 'D',
dest: dest
})
})
@@ -38,19 +42,18 @@ build({
})
var plugins = [
{ name: 'search', entry: 'search/index.js', moduleName: 'Search' },
{ name: 'ga', entry: 'ga.js', moduleName: 'GA' },
{ name: 'emoji', entry: 'emoji.js', moduleName: 'Emoji' },
{ name: 'external-script', entry: 'external-script.js', moduleName: 'ExternalScript' },
{ name: 'front-matter', entry: 'front-matter/index.js', moduleName: 'FrontMatter' },
{ name: 'zoom-image', entry: 'zoom-image.js', moduleName: 'ZoomImage' }
{ 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' }
]
plugins.forEach(item => {
build({
entry: 'plugins/' + item.entry,
output: 'plugins/' + item.name + '.js',
moduleName: 'D.' + item.moduleName
output: 'plugins/' + item.name + '.js'
})
})
@@ -64,7 +67,6 @@ if (isProd) {
build({
entry: 'plugins/' + item.entry,
output: 'plugins/' + item.name + '.min.js',
moduleName: 'D.' + item.moduleName,
plugins: [uglify()]
})
})
+8 -1
View File
@@ -30,9 +30,16 @@ if [[ $REPLY =~ ^[Yy]$ ]]; then
# commit
git add -A
git commit -m "[build] $VERSION $RELEASE_TAG"
npm version $VERSION --message "[release] $VERSION $RELEASE_TAG"
npm --no-git-tag-version version $VERSION --message "[release] $VERSION $RELEASE_TAG"
# changelog
node_modules/.bin/conventional-changelog -p angular -i CHANGELOG.md -s
git add .
git commit -m "chore: add changelog $VERSION"
# publish
git tag v$VERSION
git push origin refs/tags/v$VERSION
git push
if [[ -z $RELEASE_TAG ]]; then
+13 -7
View File
@@ -19,24 +19,30 @@
<script>
window.$docsify = {
alias: {
'/de-de/changelog': '/changelog',
'/zh-cn/changelog': '/changelog',
'/changelog': 'https://raw.githubusercontent.com/QingWei-Li/docsify/master/CHANGELOG'
'.*?/changelog': 'https://raw.githubusercontent.com/QingWei-Li/docsify/master/CHANGELOG',
'/.*/_navbar.md': '/_navbar.md'
},
auto2top: true,
basePath: '/docs/',
executeScript: true,
loadNavbar: true,
loadSidebar: true,
coverpage: true,
name: 'docsify',
subMaxLevel: 2,
subMaxLevel: 0,
mergeNavbar: true,
formatUpdated: '{MM}/{DD} {HH}:{mm}',
routerMode: 'history',
plugins: [
function(hook) {
function(hook, vm) {
hook.beforeEach(function (html) {
return html += '\n> Last modified {docsify-updated}'
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'
+ 'Last modified {docsify-updated} '
+ editHtml
})
}
]
+2 -1
View File
@@ -11,12 +11,13 @@ See the [Quick start](quickstart.md) for more details.
## Features
* No statically built html files
* Simple and lightweight (~16kB 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
+2 -2
View File
@@ -1,10 +1,10 @@
![logo](_media/icon.svg)
# docsify <small>3.7</small>
# docsify <small>4.2.9</small>
> A magical documentation site generator.
- Simple and lightweight (~16kB gzipped)
- Simple and lightweight (~18kB gzipped)
- No statically built html files
- Multiple themes
+1 -1
View File
@@ -45,6 +45,6 @@ Alternatively, use [compressed files](#compressed-files).
## Other CDN
- http://www.bootcdn.cn/docsify
- http://www.jsdelivr.com/projects/docsify
- https://cdn.jsdelivr.net/npm/docsify/
- https://cdnjs.com/libraries/docsify
+35 -2
View File
@@ -250,11 +250,12 @@ window.$docsify = {
- Type: `Object`
Set the route alias. You can freely manage routing rules.
Set the route alias. You can freely manage routing rules. Supports RegExp.
```js
window.$docsify = {
alias: {
'/foo/(+*)': '/bar/$1', // supports regexp
'/zh-cn/changelog': '/changelog',
'/changelog': 'https://raw.githubusercontent.com/QingWei-Li/docsify/master/CHANGELOG'
}
@@ -298,6 +299,8 @@ Note that if you are running an external script, e.g. an embedded jsfiddle demo,
## no-emoji
- type: `Boolean`
Disabled emoji parse.
```js
@@ -308,6 +311,8 @@ window.$docsify = {
## merge-navbar
- type: `Boolean`
Navbar will be merged with the sidebar on smaller screens.
```js
@@ -317,6 +322,9 @@ window.$docsify = {
```
## 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
@@ -333,7 +341,10 @@ window.$docsify = {
## external-link-target
Currently it defaults to _blank, would be nice if configurable:
- type: `String`
- default: `_self`
Target to open external links. Default `'_blank'` (new window/tab)
```js
window.$docsify = {
@@ -342,8 +353,30 @@ window.$docsify = {
```
## router-mode
- 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/.*'
]
}
```
+1 -1
View File
@@ -26,7 +26,7 @@ Set `coverpage` to **true**, and create a `_coverpage.md`:
> A magical documentation site generator.
- Simple and lightweight (~16kB gzipped)
- Simple and lightweight (~18kB gzipped)
- No statically built html files
- Multiple themes
+2 -1
View File
@@ -11,12 +11,13 @@ Siehe [Schnellstart](de-de/quickstart.md) für weitere Informationen.
## Features
* keine generierten, statischen HTML Dateien
* einfach und klein (~16kB 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
+1 -1
View File
@@ -45,5 +45,5 @@ Alternativ kannst du auch die [komprimierten Dateien](#komprimierte-dateien) ver
## Andere CDN
- http://www.bootcdn.cn/docsify
- http://www.jsdelivr.com/projects/docsify
- https://cdn.jsdelivr.net/npm/docsify/
- https://cdnjs.com/libraries/docsify
+21 -2
View File
@@ -250,11 +250,12 @@ window.$docsify = {
- Typ: `Object`
Verwende alternative Routen. Du kannst sie ungehindert anpassen.
Verwende alternative Routen. Du kannst sie ungehindert anpassen. Supports RegExp.
```js
window.$docsify = {
alias: {
'/foo/(+*)': '/bar/$1', // supports regexp
'/zh-cn/changelog': '/changelog',
'/changelog': 'https://raw.githubusercontent.com/QingWei-Li/docsify/master/CHANGELOG'
}
@@ -317,7 +318,7 @@ window.$docsify = {
```
## format-updated
We can display the file update date through **{docsify-updated<span>}</span>** variable. And format it by `formatUpdated`.
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 = {
@@ -340,3 +341,21 @@ window.$docsify = {
externalLinkTarget: '_self' // default: '_blank'
}
```
## 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/.*'
]
}
```
+1 -1
View File
@@ -26,7 +26,7 @@ Setze `coverpage` auf **true**, und erstelle `_coverpage.md`:
> Ein magischer Generator für Dokumentationsseiten.
- Einfach und wenig Speicherbedarf (~16kB gzipped)
- Einfach und wenig Speicherbedarf (~18kB gzipped)
- Keine statischen HTML Dateien
- Mehrere Themes
+31
View File
@@ -25,3 +25,34 @@ Generelle Tipps wie:
wird wie folgt gerendert:
?> *TODO* unit test
## Ignore to compile link
Some time we will put some other relative path to the link, you have to need to tell docsify you don't need to compile this link. For example
```md
[link](/demo/)
```
It will be compiled to `<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")
```
You will get `<a href="/demo/">link</a>`html. Do not worry, you can still set title for link.
```md
[link](/demo/ ":ignore title")
<a href="/demo/" title="title">link</a>
```
## Set target attribute for link
```md
[link](/demo ":target=_blank")
[link](/demo2 ":target=_self")
```
+4 -1
View File
@@ -35,7 +35,10 @@ Als Standardeinstellung werden Hyperlinks auf der aktuellen Seite erkannt und de
noData: {
'/de-de/': 'Keine Ergebnisse',
'/': 'No Results'
}
},
// Headline depth, 1 - 6
depth: 2
}
}
</script>
+9 -10
View File
@@ -2,6 +2,8 @@
See https://docsify.now.sh
Repo in https://github.com/QingWei-Li/docsify-ssr-demo
## Why SSR?
- Better SEO
- Feeling cool
@@ -11,24 +13,24 @@ See https://docsify.now.sh
Install `now` and `docsify-cli` in your project.
```bash
npm i now -g
npm i docsify-cli -D
npm i now docsify-cli -D
```
Edit `package.json`. If the documentation in `./docs` subdirectory.
Edit `package.json`. If the documentation in `./docs` subdirectory.
```json
{
"name": "my-project",
"scripts": {
"start": "docsify start ."
"start": "docsify start . -c ssr.config.js",
"deploy": "now -p"
},
"files": [
"docs"
],
"docsify": {
"config": {
"basePath": "/docs/",
"basePath": 'https://docsify.js.org/',
"loadSidebar": true,
"loadNavbar": true,
"coverpage": true,
@@ -38,10 +40,7 @@ npm i docsify-cli -D
}
```
Remove `index.html`
!> The `basePath` just like webpack `publicPath`. You should config it if your docs is in the subdirectory.
!> The `basePath` just like webpack `publicPath`. We can use local or remote files.
We can preview in the local to see if it works.
@@ -94,7 +93,7 @@ You can configure it in a special config file, or `package.json`.
```js
module.exports = {
tempate: './ssr.html',
template: './ssr.html',
config: {
// docsify config
}
+24
View File
@@ -47,6 +47,8 @@ window.$docsify = {
## Beispiel
### footer
Füge jeder Seite eine footer Komponente hinzu:
```js
@@ -68,3 +70,25 @@ window.$docsify = {
]
}
```
### Edit Button
```js
window.$docsify = {
plugins: [
function(hook, vm) {
hook.beforeEach(function (html) {
var url = 'https://github.com/QingWei-Li/docsify/blob/master/docs' + vm.route.file
var editHtml = '[📝 EDIT DOCUMENT](' + url + ')\n'
return editHtml
+ html
+ '\n----\n'
+ 'Last modified {docsify-updated} '
+ editHtml
})
}
]
}
```
+32
View File
@@ -25,3 +25,35 @@ General tips like:
are rendered as:
?> *TODO* unit test
## Ignore to compile link
Some time we will put some other relative path to the link, you have to need to tell docsify you don't need to compile this link. For example
```md
[link](/demo/)
```
It will be compiled to `<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")
```
You will get `<a href="/demo/">link</a>`html. Do not worry, you can still set title for link.
```md
[link](/demo/ ":ignore title")
<a href="/demo/" title="title">link</a>
```
## Set target attribute for link
```md
[link](/demo ":target=_blank")
[link](/demo2 ":target=_self")
```
+20 -14
View File
@@ -7,10 +7,10 @@
<meta name="keywords" content="doc,docs,documentation,gitbook,creator,generator,github,jekyll,github-pages">
<meta name="description" content="A magical documentation generator.">
<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="//unpkg.com/docsify/lib/themes/vue.css" title="vue">
<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>
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/docsify@latest/lib/themes/vue.css" title="vue">
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/docsify@latest/lib/themes/dark.css" title="dark" disabled>
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/docsify@latest/lib/themes/buble.css" title="buble" disabled>
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/docsify@latest/lib/themes/pure.css" title="pure" disabled>
<style>
nav.app-nav li ul {
min-width: 100px;
@@ -23,9 +23,8 @@
<script>
window.$docsify = {
alias: {
'/de-de/changelog': '/changelog',
'/zh-cn/changelog': '/changelog',
'/changelog': 'https://raw.githubusercontent.com/QingWei-Li/docsify/master/CHANGELOG'
'.*?/changelog': 'https://raw.githubusercontent.com/QingWei-Li/docsify/master/CHANGELOG',
'/.*/_navbar.md': '/_navbar.md'
},
auto2top: true,
coverpage: true,
@@ -51,17 +50,24 @@
},
formatUpdated: '{MM}/{DD} {HH}:{mm}',
plugins: [
function(hook) {
function(hook, vm) {
hook.beforeEach(function (html) {
return html += '\n> Last modified {docsify-updated}'
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'
+ 'Last modified {docsify-updated} '
+ editHtml
})
}
]
}
</script>
<script src="//unpkg.com/docsify/lib/docsify.min.js"></script>
<script src="//unpkg.com/docsify/lib/plugins/search.min.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>
<script src="//cdn.jsdelivr.net/npm/docsify@latest/lib/docsify.min.js"></script>
<script src="//cdn.jsdelivr.net/npm/docsify@latest/lib/plugins/search.min.js"></script>
<script src="//cdn.jsdelivr.net/npm/prismjs/components/prism-bash.min.js"></script>
<script src="//cdn.jsdelivr.net/npm/prismjs/components/prism-markdown.min.js"></script>
<script src="//cdn.jsdelivr.net/npm/prismjs/components/prism-nginx.min.js"></script>
</html>
+4 -1
View File
@@ -35,7 +35,10 @@ By default, the hyperlink on the current page is recognized and the content is s
noData: {
'/zh-cn/': '找不到结果',
'/': 'No Results'
}
},
// Headline depth, 1 - 6
depth: 2
}
}
</script>
-33
View File
@@ -1,33 +0,0 @@
module.exports = {
config: {
alias: {
'/de-de/changelog': '/changelog',
'/zh-cn/changelog': '/changelog',
'/changelog': 'https://raw.githubusercontent.com/QingWei-Li/docsify/master/CHANGELOG'
},
auto2top: true,
coverpage: true,
executeScript: true,
loadSidebar: true,
loadNavbar: true,
mergeNavbar: true,
maxLevel: 4,
subMaxLevel: 2,
basePath: '/docs/',
name: 'docsify',
search: {
noData: {
'/de-de/': 'Keine Ergebnisse!',
'/zh-cn/': '没有结果!',
'/': 'No results!'
},
paths: 'auto',
placeholder: {
'/de-de/': 'Suche',
'/zh-cn/': '搜索',
'/': 'Search'
}
}
},
template: './docs/ssr.html'
}
-29
View File
@@ -1,29 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>docsify</title>
<link rel="icon" href="_media/favicon.ico">
<meta name="keywords" content="doc,docs,documentation,gitbook,creator,generator,github,jekyll,github-pages">
<meta name="description" content="A magical documentation generator.">
<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="//unpkg.com/docsify/lib/themes/vue.css" title="vue">
<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>
<style>
nav.app-nav li ul {
min-width: 100px;
}
</style>
</head>
<body>
<!--inject-app-->
<!--inject-config-->
</body>
<script src="//unpkg.com/docsify/lib/docsify.min.js"></script>
<script src="//unpkg.com/docsify/lib/plugins/search.min.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>
+8 -8
View File
@@ -2,6 +2,8 @@
See https://docsify.now.sh
Repo in https://github.com/QingWei-Li/docsify-ssr-demo
## Why SSR?
- Better SEO
- Feeling cool
@@ -11,8 +13,7 @@ See https://docsify.now.sh
Install `now` and `docsify-cli` in your project.
```bash
npm i now -g
npm i docsify-cli -D
npm i now docsify-cli -D
```
Edit `package.json`. If the documentation in `./docs` subdirectory.
@@ -21,14 +22,15 @@ Edit `package.json`. If the documentation in `./docs` subdirectory.
{
"name": "my-project",
"scripts": {
"start": "docsify start ."
"start": "docsify start . -c ssr.config.js",
"deploy": "now -p"
},
"files": [
"docs"
],
"docsify": {
"config": {
"basePath": "/docs/",
"basePath": 'https://docsify.js.org/',
"loadSidebar": true,
"loadNavbar": true,
"coverpage": true,
@@ -38,9 +40,7 @@ Edit `package.json`. If the documentation in `./docs` subdirectory.
}
```
Remove `index.html`
!> The `basePath` just like webpack `publicPath`. You should config it if your docs is in the subdirectory.
!> The `basePath` just like webpack `publicPath`. We can use local or remote files.
We can preview in the local to see if it works.
@@ -93,7 +93,7 @@ You can configure it in a special config file, or `package.json`.
```js
module.exports = {
tempate: './ssr.html',
template: './ssr.html',
config: {
// docsify config
}
+23
View File
@@ -47,6 +47,8 @@ window.$docsify = {
## Example
#### footer
Add footer component in each pages.
```js
@@ -68,3 +70,24 @@ window.$docsify = {
]
}
```
### Edit Button
```js
window.$docsify = {
plugins: [
function(hook, vm) {
hook.beforeEach(function (html) {
var url = 'https://github.com/QingWei-Li/docsify/blob/master/docs' + vm.route.file
var editHtml = '[📝 EDIT DOCUMENT](' + url + ')\n'
return editHtml
+ html
+ '\n----\n'
+ 'Last modified {docsify-updated} '
+ editHtml
})
}
]
}
```
+2 -1
View File
@@ -12,12 +12,13 @@ docsify 是一个动态生成文档网站的工具。不同于 GitBook、Hexo
## 特性
- 无需构建,写完文档直接发布
- 容易使用并且轻量 (~16kB gzipped)
- 容易使用并且轻量 (~18kB gzipped)
- 智能的全文搜索
- 提供多套主题
- 丰富的 API
- 支持 Emoji
- 兼容 IE10+
- 支持 SSR ([example](https://github.com/QingWei-Li/docsify-ssr-demo))
## 例子
+2 -2
View File
@@ -44,6 +44,6 @@ JS 的压缩文件是原有文件路径的基础上加 `.min`后缀
## 其他 CDN
- http://www.bootcdn.cn/docsify
- http://www.jsdelivr.com/projects/docsify
- http://www.bootcdn.cn/docsify (支持国内)
- https://cdn.jsdelivr.net/npm/docsify/ (国内外都支持)
- https://cdnjs.com/libraries/docsify
+22 -2
View File
@@ -258,12 +258,13 @@ window.$docsify = {
- 类型:`Object`
定义路由别名,可以更自由的定义路由规则。
定义路由别名,可以更自由的定义路由规则。 支持正则。
```js
window.$docsify = {
alias: {
'/foo/(+*)': '/bar/$1', // supports regexp
'/zh-cn/changelog': '/changelog',
'/changelog': 'https://raw.githubusercontent.com/QingWei-Li/docsify/master/CHANGELOG'
}
@@ -327,7 +328,8 @@ window.$docsify = {
```
## format-updated
我们可以显示文档更新日期通过 **{docsify-updated<span>}</span>** 变量. 并且格式化日期通过 `formatUpdated`.
我们可以显示文档更新日期通过 **{docsify-updated<span>}</span>** 变量. 并且格式化日期通过 `formatUpdated`.
参考 https://github.com/lukeed/tinydate#patterns
```js
window.$docsify = {
@@ -350,3 +352,21 @@ window.$docsify = {
externalLinkTarget: '_self' // default: '_blank'
}
```
## 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/.*'
]
}
```
+32
View File
@@ -24,3 +24,35 @@ docsify 扩展了一些 Markdown 语法,可以让文档更易读。
?> *TODO* 完善示例
## Ignore to compile link
Some time we will put some other relative path to the link, you have to need to tell docsify you don't need to compile this link. For example
```md
[link](/demo/)
```
It will be compiled to `<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")
```
You will get `<a href="/demo/">link</a>`html. Do not worry, you can still set title for link.
```md
[link](/demo/ ":ignore title")
<a href="/demo/" title="title">link</a>
```
## Set target attribute for link
```md
[link](/demo ":target=_blank")
[link](/demo2 ":target=_self")
```
+1 -1
View File
@@ -8,4 +8,4 @@
<script src="//unpkg.com/prismjs/components/prism-php.js"></script>
```
?> 其他的语言高亮插件可以查看[Prims 仓库](https://github.com/PrismJS/prism/tree/gh-pages/components)。
?> 其他的语言高亮插件可以查看[Prims 仓库](https://github.com/PrismJS/prism/tree/gh-pages/components)。
+4 -1
View File
@@ -35,7 +35,10 @@
noData: {
'/zh-cn/': '找不到结果',
'/': 'No Results'
}
},
// 搜索标题的最大程级, 1 - 6
depth: 2
}
}
</script>
+52 -58
View File
@@ -1,67 +1,61 @@
# Server client renderer
# 服务端渲染(SSR
See https://docsify.now.sh
先看例子 https://docsify.now.sh
## Why SSR?
- Better SEO
- Feeling cool
项目地址在 https://github.com/QingWei-Li/docsify-ssr-demo
## Quick start
![](https://dn-mhke0kuv.qbox.me/2bfef08c592706108055.png)
Install `now` and `docsify-cli` in your project.
文档依旧是部署在 GitHub Pages 上,Node 服务部署在 now.sh 里,渲染的内容是从 GitHub Pages 上同步过来的。所以静态部署文档的服务器和服务端渲染的 Node 服务器是分开的,也就是说你还是可以用之前的方式更新文档,并不需要每次都部署。
## 快速开始
如果你熟悉 `now` 的使用,接下来的介绍就很简单了。先创建一个新项目,并安装 `now``docsify-cli`
```bash
npm i now -g
npm i docsify-cli -D
mkdir my-ssr-demo && cd my-ssr-demo
npm init -y
npm i now docsify-cli -D
```
2. Edit `package.json`. If the documentation in `./docs` subdirectory.
配置 `package.json`
```json
{
"name": "my-project",
"scripts": {
"start": "docsify start ."
"start": "docsify start .",
"deploy": "now -p"
},
"files": [
"docs"
],
"docsify": {
"config": {
"basePath": "/docs/",
"basePath": "https://docsify.js.org/",
"loadSidebar": true,
"loadNavbar": true,
"coverpage": true,
"name": "docsify"
"loadNavbar": true
}
}
}
```
如果你还没有创建文档,可以参考[之前的文章](https://zhuanlan.zhihu.com/p/24540753)。其中 `basePath` 为文档所在的路径,可以填你的 docsify 文档网站。
Remove `index.html`
配置可以单独写在配置文件内,然后通过 `--config config.js` 加载。
!> The `basePath` just like webpack `publicPath`. You should config it if your docs is in the subdirectory.
渲染的基础模版也可以自定义,配置在 `template` 属性上,例如
We can preview in the local to see if it works.
```bash
npm start
# open http://localhost:4000
```js
"docsify": {
"template": "./ssr.html",
"config": {
"basePath": "https://docsify.js.org/",
"loadSidebar": true,
"loadNavbar": true
}
}
```
Publish it!
```bash
now -p
```
Now, You have a support for SSR the docs site.
## Custom template
You can provide a templte for entire page's HTML. such as
*ssr.html*
```html
<!DOCTYPE html>
@@ -69,41 +63,39 @@ You can provide a templte for entire page's HTML. such as
<head>
<meta charset="UTF-8">
<title>docsify</title>
<link rel="icon" href="_media/favicon.ico">
<meta name="keywords" content="doc,docs,documentation,gitbook,creator,generator,github,jekyll,github-pages">
<meta name="description" content="A magical documentation generator.">
<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="//unpkg.com/docsify/themes/vue.css" title="vue">
<link rel="stylesheet" href="//unpkg.com/docsify/lib/themes/vue.css" title="vue">
</head>
<body>
<!--inject-app-->
<!--inject-config-->
</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>
<script src="//unpkg.com/docsify/lib/docsify.min.js"></script>
<script src="//unpkg.com/docsify/lib/plugins/search.min.js"></script>
</html>
```
The template should contain these comments for rendered app content.
- `<!--inject-app-->`
- `<!--inject-config-->`
其中 `<!--inject-app-->``<!--inject-config-->` 为占位符,会自动将渲染后的 html 和配置内容注入到页面上。
## Configuration
现在,你可以运行 `npm start` 预览效果,如果没有问题就通过 `npm run deploy` 部署服务。
You can configure it in a special config file, or `package.json`.
```bash
npm start
# open http://localhost:4000
```js
module.exports = {
tempate: './ssr.html',
config: {
// docsify config
}
}
npm run deploy
# now ...
```
## Deploy for your VPS
You can run `docsify start` directly on your Node server, or write your own server app with `docsify-server-renderer`.
## 更多玩法
`docsify start` 其实是依赖了 [`docsify-server-renderer`](https://npmarket.surge.sh/?name=docsify-server-renderer) 模块,如果你感兴趣,你完全可以用它自己实现一个 server,可以加入缓存等功能。
```js
var Renderer = require('docsify-server-renderer')
@@ -122,3 +114,5 @@ renderer.renderToString(url)
.then(html => {})
.catch(err => {})
```
当然文档文件和 server 也是可以部署在一起的,`basePath` 不是一个 URL 的话就会当做文件路径处理,也就是从服务器上加载资源。
+25
View File
@@ -46,6 +46,9 @@ window.$docsify = {
## 例子
### footer
给每个页面的末尾加上 `footer`
```js
@@ -66,4 +69,26 @@ window.$docsify = {
}
]
}
```
### Edit Button
```js
window.$docsify = {
plugins: [
function(hook, vm) {
hook.beforeEach(function (html) {
var url = 'https://github.com/QingWei-Li/docsify/blob/master/docs' + vm.route.file
var editHtml = '[📝 EDIT DOCUMENT](' + url + ')\n'
return editHtml
+ html
+ '\n----\n'
+ 'Last modified {docsify-updated} '
+ editHtml
})
}
]
}
```
+7
View File
@@ -0,0 +1,7 @@
{
"lerna": "2.0.0-rc.5",
"packages": [
"packages/*"
],
"version": "0.0.0"
}
+117 -34
View File
@@ -80,7 +80,8 @@ var config = merge({
mergeNavbar: false,
formatUpdated: '',
externalLinkTarget: '_blank',
routerModel: 'hash'
routerModel: 'hash',
noCompileLinks: []
}, window.$docsify);
var script = document.currentScript ||
@@ -126,23 +127,22 @@ function initLifecycle (vm) {
function callHook (vm, hook, data, next) {
if ( next === void 0 ) next = noop;
var newData = data;
var queue = vm._hooks[hook];
var step = function (index) {
var hook = queue[index];
if (index >= queue.length) {
next(newData);
next(data);
} else {
if (typeof hook === 'function') {
if (hook.length === 2) {
hook(data, function (result) {
newData = result;
data = result;
step(index + 1);
});
} else {
var result = hook(data);
newData = result !== undefined ? result : newData;
data = result !== undefined ? result : data;
step(index + 1);
}
} else {
@@ -2718,8 +2718,9 @@ function parseQuery (query) {
query.split('&').forEach(function (param) {
var parts = param.replace(/\+/g, ' ').split('=');
res[parts[0]] = decode(parts[1]);
res[parts[0]] = parts[1] && decode(parts[1]);
});
return res
}
@@ -2727,7 +2728,9 @@ function stringifyQuery (obj) {
var qs = [];
for (var key in obj) {
qs.push(((encode(key)) + "=" + (encode(obj[key]))).toLowerCase());
qs.push(obj[key]
? ((encode(key)) + "=" + (encode(obj[key]))).toLowerCase()
: encode(key));
}
return qs.length ? ("?" + (qs.join('&'))) : ''
@@ -2741,7 +2744,7 @@ function getPath () {
}
var isAbsolutePath = cached(function (path) {
return /(:|(\/{2}))/.test(path)
return /(:|(\/{2}))/g.test(path)
});
var getParentPath = cached(function (path) {
@@ -2758,6 +2761,8 @@ var cleanPath = cached(function (path) {
.replace(/([^:])\/{2,}/g, '$1/')
});
var cachedLinks = {};
var Compiler = function Compiler (config, router) {
this.config = config;
this.router = router;
@@ -2792,13 +2797,26 @@ var Compiler = function Compiler (config, router) {
});
};
Compiler.prototype.matchNotCompileLink = function matchNotCompileLink (link) {
var links = this.config.noCompileLinks;
for (var i = 0; i < links.length; i++) {
var n = links[i];
var re = cachedLinks[n] || (cachedLinks[n] = new RegExp(("^" + n + "$")));
if (re.test(link)) {
return link
}
}
};
Compiler.prototype._initRenderer = function _initRenderer () {
var renderer = new marked.Renderer();
var ref = this;
var linkTarget = ref.linkTarget;
var router = ref.router;
var toc = ref.toc;
var contentBase = ref.contentBase;
var _self = this;
/**
* render anchor tag
* @link https://github.com/chjj/marked#overriding-renderer-methods
@@ -2821,7 +2839,7 @@ Compiler.prototype._initRenderer = function _initRenderer () {
var slug = slugify(text);
var url = router.toURL(router.getCurrentPath(), { id: slug });
nextToc.slug = url;
toc.push(nextToc);
_self.toc.push(nextToc);
return ("<h" + level + " id=\"" + slug + "\"><a href=\"" + url + "\" data-id=\"" + slug + "\" class=\"anchor\"><span>" + text + "</span></a></h" + level + ">")
};
@@ -2835,11 +2853,23 @@ Compiler.prototype._initRenderer = function _initRenderer () {
};
renderer.link = function (href, title, text) {
var blank = '';
if (!/:|(\/{2})/.test(href)) {
if (!/:|(\/{2})/.test(href) &&
!_self.matchNotCompileLink(href) &&
!/(\s?:ignore)(\s\S+)?$/.test(title)) {
href = router.toURL(href, null, router.getCurrentPath());
} else {
blank = " target=\"" + linkTarget + "\"";
title = title && title.replace(/:ignore/g, '').trim();
}
var target = title && title.match(/:target=\w+/);
if (target) {
target = target[0];
title = title.replace(target, '');
blank = ' ' + target.slice(1);
}
if (title) {
title = " title=\"" + title + "\"";
}
@@ -2890,6 +2920,10 @@ Compiler.prototype.sidebar = function sidebar (text, level) {
* Compile sub sidebar
*/
Compiler.prototype.subSidebar = function subSidebar (level) {
if (!level) {
this.toc = [];
return
}
var currentPath = this.router.getCurrentPath();
var ref = this;
var cacheTree = ref.cacheTree;
@@ -3159,10 +3193,13 @@ function renderMixin (proto) {
this._renderTo('.sidebar-nav', this.compiler.sidebar(text, maxLevel));
var activeEl = getAndActive(this.router, '.sidebar-nav', true, true);
if (loadSidebar && activeEl) {
activeEl.parentNode.innerHTML += this.compiler.subSidebar(subMaxLevel);
activeEl.parentNode.innerHTML += (this.compiler.subSidebar(subMaxLevel) || '');
} else {
// reset toc
this.compiler.subSidebar();
}
// bind event
this._bindEventOnRendered();
this._bindEventOnRendered(activeEl);
};
proto._bindEventOnRendered = function (activeEl) {
@@ -3194,6 +3231,10 @@ function renderMixin (proto) {
var this$1 = this;
if ( opt === void 0 ) opt = {};
if (!text) {
return renderMain.call(this, text)
}
callHook(this, 'beforeEach', text, function (result) {
var html = this$1.isHTML ? result : this$1.compiler.compile(result);
if (opt.updatedAt) {
@@ -3284,15 +3325,25 @@ function initRender (vm) {
before(navAppendToTarget, navEl);
if (config.themeColor) {
$.head.innerHTML += theme(config.themeColor);
$.head.appendChild(
create('div', theme(config.themeColor)).firstElementChild
);
// Polyfll
cssVars(config.themeColor);
}
vm._updateRender();
toggleClass(body, 'ready');
}
function getAlias (path, alias) {
return alias[path] ? getAlias(alias[path], alias) : path
var cached$1 = {};
function getAlias (path, alias, last) {
var match = Object.keys(alias).filter(function (key) {
var re = cached$1[key] || (cached$1[key] = new RegExp(("^" + key + "$")));
return re.test(path) && path !== last
})[0];
return match ? getAlias(path.replace(cached$1[match], alias[match]), alias, path) : path
}
function getFileName (path) {
@@ -3311,7 +3362,7 @@ History.prototype.getBasePath = function getBasePath () {
return this.config.basePath
};
History.prototype.getFile = function getFile (path) {
History.prototype.getFile = function getFile (path, isRelative) {
path = path || this.getCurrentPath();
var ref = this;
@@ -3323,6 +3374,10 @@ History.prototype.getFile = function getFile (path) {
path = path === '/README.md' ? (config.homepage || path) : path;
path = isAbsolutePath(path) ? path : getPath(base, path);
if (isRelative) {
path = path.replace(new RegExp(("^" + base)), '');
}
return path
};
@@ -3403,20 +3458,20 @@ var HashHistory = (function (History$$1) {
var query = '';
var hashIndex = path.indexOf('#');
if (hashIndex) {
path = path.slice(hashIndex + 1);
}
var queryIndex = path.indexOf('?');
if (queryIndex >= 0) {
query = path.slice(queryIndex + 1);
path = path.slice(0, queryIndex);
}
var hashIndex = path.indexOf('#');
if (hashIndex) {
path = path.slice(hashIndex + 1);
}
return {
path: path,
file: this.getFile(path),
file: this.getFile(path, true),
query: parseQuery(query)
}
};
@@ -3529,6 +3584,12 @@ function routerMixin (proto) {
var lastRoute = {};
function updateRender (vm) {
vm.router.normalize();
vm.route = vm.router.parse();
body.setAttribute('data-page', vm.route.file);
}
function initRouter (vm) {
var config = vm.config;
var mode = config.routerMode || 'hash';
@@ -3541,14 +3602,11 @@ function initRouter (vm) {
}
vm.router = router;
router.normalize();
lastRoute = vm.route = router.parse();
vm._updateRender();
updateRender(vm);
lastRoute = vm.route;
router.onchange(function (_) {
router.normalize();
vm.route = router.parse();
updateRender(vm);
vm._updateRender();
if (lastRoute.path === vm.route.path) {
@@ -3609,17 +3667,24 @@ function fetchMixin (proto) {
// Current page is html
this.isHTML = /\.html$/g.test(path);
// Load main content
last.then(function (text, opt) {
this$1._renderMain(text, opt);
var loadSideAndNav = function () {
if (!loadSidebar) { return cb() }
var fn = function (result) { this$1._renderSidebar(result); cb(); };
// Load sidebar
loadNested(path, loadSidebar, fn, this$1, true);
};
// Load main content
last.then(function (text, opt) {
this$1._renderMain(text, opt);
loadSideAndNav();
},
function (_) { return this$1._renderMain(null); });
function (_) {
this$1._renderMain(null);
loadSideAndNav();
});
// Load nav
loadNavbar &&
@@ -3724,6 +3789,19 @@ var initGlobalAPI = function () {
window.Prism = prism;
};
/**
* Fork https://github.com/bendrucker/document-ready/blob/master/index.js
*/
function ready (callback) {
var state = document.readyState;
if (state === 'complete' || state === 'interactive') {
return setTimeout(callback, 0)
}
document.addEventListener('DOMContentLoaded', callback);
}
function Docsify () {
this._init();
}
@@ -3741,9 +3819,14 @@ eventMixin(proto);
*/
initGlobalAPI();
/**
* Version
*/
Docsify.version = '4.2.9';
/**
* Run Docsify
*/
setTimeout(function (_) { return new Docsify(); }, 0);
ready(function (_) { return new Docsify(); });
}());
+2 -2
View File
File diff suppressed because one or more lines are too long
-1
View File
@@ -1,4 +1,3 @@
this.D = this.D || {};
(function () {
'use strict';
+1 -1
View File
File diff suppressed because one or more lines are too long
-1
View File
@@ -1,4 +1,3 @@
this.D = this.D || {};
(function () {
'use strict';
+1 -1
View File
@@ -1 +1 @@
this.D=this.D||{},function(){"use strict";function e(){for(var e=Docsify.dom.getNode("#main"),i=Docsify.dom.findAll(e,"script"),o=i.length;o--;){var t=i[o];if(t&&t.src){var n=document.createElement("script");Array.prototype.slice.call(t.attributes).forEach(function(e){n[e.name]=e.value}),t.parentNode.insertBefore(n,t),t.parentNode.removeChild(t)}}}var i=function(i){i.doneEach(e)};window.$docsify.plugins=[].concat(i,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)}();
+1 -2
View File
@@ -1,4 +1,3 @@
this.D = this.D || {};
(function () {
'use strict';
@@ -498,6 +497,6 @@ var install = function (hook, vm) {
});
};
window.$docsify.plugins = [].concat(install, window.$docsify.plugins);
$docsify.plugins = [].concat(install, $docsify.plugins);
}());
+1 -1
View File
File diff suppressed because one or more lines are too long
+11 -15
View File
@@ -1,4 +1,3 @@
this.D = this.D || {};
(function () {
'use strict';
@@ -11,24 +10,21 @@ function appendScript () {
}
function init (id) {
var ga = window.ga;
if (!ga) {
appendScript();
ga = ga || function () {
(ga.q = ga.q || []).push(arguments);
};
ga.l = Number(new Date());
ga('create', id, 'auto');
}
return ga
appendScript();
window.ga = window.ga || function () {
(window.ga.q = window.ga.q || []).push(arguments);
};
window.ga.l = Number(new Date());
window.ga('create', id, 'auto');
}
function collect () {
var ga = init($docsify.ga);
if (!window.ga) {
init($docsify.ga);
}
ga('set', 'page', location.hash);
ga('send', 'pageview');
window.ga('set', 'page', location.hash);
window.ga('send', 'pageview');
}
var install = function (hook) {
+1 -1
View File
@@ -1 +1 @@
this.D=this.D||{},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 c(c){var e=window.ga;return e||(n(),e=e||function(){(e.q=e.q||[]).push(arguments)},e.l=Number(new Date),e("create",c,"auto")),e}function e(){var n=c($docsify.ga);n("set","page",location.hash),n("send","pageview")}var i=function(n){if(!$docsify.ga)return void console.error("[Docsify] ga is required.");n.beforeEach(e)};$docsify.plugins=[].concat(i,$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)}();
+5 -4
View File
@@ -1,4 +1,3 @@
this.D = this.D || {};
(function () {
'use strict';
@@ -42,7 +41,7 @@ function saveData (maxAge) {
localStorage.setItem('docsify.search.index', JSON.stringify(INDEXS));
}
function genIndex (path, content, router) {
function genIndex (path, content, router, depth) {
if ( content === void 0 ) content = '';
var tokens = window.marked.lexer(content);
@@ -51,7 +50,7 @@ function genIndex (path, content, router) {
var slug;
tokens.forEach(function (token) {
if (token.type === 'heading' && token.depth <= 2) {
if (token.type === 'heading' && token.depth <= depth) {
slug = router.toURL(path, { id: slugify(token.text) });
index[slug] = { slug: slug, title: token.text, body: '' };
} else {
@@ -162,7 +161,7 @@ function init$1 (config, vm) {
helper
.get(vm.router.getFile(path))
.then(function (result) {
INDEXS[path] = genIndex(path, result, vm.router);
INDEXS[path] = genIndex(path, result, vm.router, config.depth);
len === ++count && saveData(config.maxAge);
});
});
@@ -263,6 +262,7 @@ var CONFIG = {
placeholder: 'Type to search',
noData: 'No Results!',
paths: 'auto',
depth: 2,
maxAge: 86400000 // 1 day
};
@@ -277,6 +277,7 @@ var install = function (hook, vm) {
CONFIG.maxAge = util.isPrimitive(opts.maxAge) ? opts.maxAge : CONFIG.maxAge;
CONFIG.placeholder = opts.placeholder || CONFIG.placeholder;
CONFIG.noData = opts.noData || CONFIG.noData;
CONFIG.depth = opts.depth || CONFIG.depth;
}
var isAuto = CONFIG.paths === 'auto';
+1 -1
View File
@@ -1 +1 @@
this.D=this.D||{},function(){"use strict";function e(e){var n={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;"};return String(e).replace(/[&<>"'\/]/g,function(e){return n[e]})}function n(e){var n=[];return h.dom.findAll("a:not([data-nosearch])").map(function(t){var o=t.href,i=t.getAttribute("href"),r=e.parse(o).path;r&&-1===n.indexOf(r)&&!Docsify.util.isAbsolutePath(i)&&n.push(r)}),n}function t(e){localStorage.setItem("docsify.search.expires",Date.now()+e),localStorage.setItem("docsify.search.index",JSON.stringify(y))}function o(e,n,t){void 0===n&&(n="");var o,i=window.marked.lexer(n),r=window.Docsify.slugify,a={};return i.forEach(function(n){if("heading"===n.type&&n.depth<=2)o=t.toURL(e,{id:r(n.text)}),a[o]={slug:o,title:n.text,body:""};else{if(!o)return;a[o]?a[o].body?a[o].body+="\n"+(n.text||""):a[o].body=n.text:a[o]={slug:o,title:"",body:""}}}),r.clear(),a}function i(n){var t=[],o=[];Object.keys(y).forEach(function(e){o=o.concat(Object.keys(y[e]).map(function(n){return y[e][n]}))}),n=[].concat(n,n.trim().split(/[\s\-\\\\/]+/));for(var i=0;i<o.length;i++)!function(i){var r=o[i],a=!1,s="",c=r.title&&r.title.trim(),f=r.body&&r.body.trim(),l=r.slug||"";if(c&&f&&(n.forEach(function(n,t){var o=new RegExp(n,"gi"),i=-1,r=-1;if(i=c&&c.search(o),r=f&&f.search(o),i<0&&r<0)a=!1;else{a=!0,r<0&&(r=0);var l=0,d=0;l=r<11?0:r-10,d=0===l?70:r+n.length+60,d>f.length&&(d=f.length);var u="..."+e(f).substring(l,d).replace(o,'<em class="search-keyword">'+n+"</em>")+"...";s+=u}}),a)){var d={title:e(c),content:s,url:l};t.push(d)}}(i);return t}function r(e,i){h=Docsify;var r="auto"===e.paths,a=localStorage.getItem("docsify.search.expires")<Date.now();if(y=JSON.parse(localStorage.getItem("docsify.search.index")),a)y={};else if(!r)return;var s=r?n(i.router):e.paths,c=s.length,f=0;s.forEach(function(n){if(y[n])return f++;h.get(i.router.getFile(n)).then(function(r){y[n]=o(n,r,i.router),c===++f&&t(e.maxAge)})})}function a(){var e=Docsify.dom.create("style","\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.appendTo(Docsify.dom.head,e)}function s(e,n){void 0===n&&(n="");var t='<input type="search" value="'+n+'" /><div class="results-panel"></div></div>',o=Docsify.dom.create("div",t),i=Docsify.dom.find("aside");Docsify.dom.toggleClass(o,"search"),Docsify.dom.before(i,o)}function c(e){var n=Docsify.dom.find("div.search"),t=Docsify.dom.find(n,".results-panel");if(!e)return t.classList.remove("show"),void(t.innerHTML="");var o=i(e),r="";o.forEach(function(e){r+='<div class="matching-post">\n<h2><a href="'+e.url+'">'+e.title+"</a></h2>\n<p>"+e.content+"</p>\n</div>"}),t.classList.add("show"),t.innerHTML=r||'<p class="empty">'+m+"</p>"}function f(){var e,n=Docsify.dom.find("div.search"),t=Docsify.dom.find(n,"input");Docsify.dom.on(n,"click",function(e){return"A"!==e.target.tagName&&e.stopPropagation()}),Docsify.dom.on(t,"input",function(n){clearTimeout(e),e=setTimeout(function(e){return c(n.target.value.trim())},100)})}function l(e,n){var t=Docsify.dom.getNode('.search input[type="search"]');if(t)if("string"==typeof e)t.placeholder=e;else{var o=Object.keys(e).filter(function(e){return n.indexOf(e)>-1})[0];t.placeholder=e[o]}}function d(e,n){if("string"==typeof e)m=e;else{var t=Object.keys(e).filter(function(e){return n.indexOf(e)>-1})[0];m=e[t]}}function u(e,n){var t=n.router.parse().query.s;a(),s(e,t),f(),t&&setTimeout(function(e){return c(t)},500)}function p(e,n){l(e.placeholder,n.route.path),d(e.noData,n.route.path)}var h,y={},m="",g={placeholder:"Type to search",noData:"No Results!",paths:"auto",maxAge:864e5},v=function(e,n){var t=Docsify.util,o=n.config.search||g;Array.isArray(o)?g.paths=o:"object"==typeof o&&(g.paths=Array.isArray(o.paths)?o.paths:"auto",g.maxAge=t.isPrimitive(o.maxAge)?o.maxAge:g.maxAge,g.placeholder=o.placeholder||g.placeholder,g.noData=o.noData||g.noData);var i="auto"===g.paths;e.mounted(function(e){u(g,n),!i&&r(g,n)}),e.doneEach(function(e){p(g,n),i&&r(g,n)})};$docsify.plugins=[].concat(v,$docsify.plugins)}();
!function(){"use strict";function e(e){var n={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;"};return String(e).replace(/[&<>"'\/]/g,function(e){return n[e]})}function n(e){var n=[];return h.dom.findAll("a:not([data-nosearch])").map(function(t){var o=t.href,i=t.getAttribute("href"),r=e.parse(o).path;r&&-1===n.indexOf(r)&&!Docsify.util.isAbsolutePath(i)&&n.push(r)}),n}function t(e){localStorage.setItem("docsify.search.expires",Date.now()+e),localStorage.setItem("docsify.search.index",JSON.stringify(y))}function o(e,n,t,o){void 0===n&&(n="");var i,r=window.marked.lexer(n),a=window.Docsify.slugify,s={};return r.forEach(function(n){if("heading"===n.type&&n.depth<=o)i=t.toURL(e,{id:a(n.text)}),s[i]={slug:i,title:n.text,body:""};else{if(!i)return;s[i]?s[i].body?s[i].body+="\n"+(n.text||""):s[i].body=n.text:s[i]={slug:i,title:"",body:""}}}),a.clear(),s}function i(n){var t=[],o=[];Object.keys(y).forEach(function(e){o=o.concat(Object.keys(y[e]).map(function(n){return y[e][n]}))}),n=[].concat(n,n.trim().split(/[\s\-\\\\/]+/));for(var i=0;i<o.length;i++)!function(i){var r=o[i],a=!1,s="",c=r.title&&r.title.trim(),f=r.body&&r.body.trim(),l=r.slug||"";if(c&&f&&(n.forEach(function(n,t){var o=new RegExp(n,"gi"),i=-1,r=-1;if(i=c&&c.search(o),r=f&&f.search(o),i<0&&r<0)a=!1;else{a=!0,r<0&&(r=0);var l=0,d=0;l=r<11?0:r-10,d=0===l?70:r+n.length+60,d>f.length&&(d=f.length);var p="..."+e(f).substring(l,d).replace(o,'<em class="search-keyword">'+n+"</em>")+"...";s+=p}}),a)){var d={title:e(c),content:s,url:l};t.push(d)}}(i);return t}function r(e,i){h=Docsify;var r="auto"===e.paths,a=localStorage.getItem("docsify.search.expires")<Date.now();if(y=JSON.parse(localStorage.getItem("docsify.search.index")),a)y={};else if(!r)return;var s=r?n(i.router):e.paths,c=s.length,f=0;s.forEach(function(n){if(y[n])return f++;h.get(i.router.getFile(n)).then(function(r){y[n]=o(n,r,i.router,e.depth),c===++f&&t(e.maxAge)})})}function a(){var e=Docsify.dom.create("style","\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.appendTo(Docsify.dom.head,e)}function s(e,n){void 0===n&&(n="");var t='<input type="search" value="'+n+'" /><div class="results-panel"></div></div>',o=Docsify.dom.create("div",t),i=Docsify.dom.find("aside");Docsify.dom.toggleClass(o,"search"),Docsify.dom.before(i,o)}function c(e){var n=Docsify.dom.find("div.search"),t=Docsify.dom.find(n,".results-panel");if(!e)return t.classList.remove("show"),void(t.innerHTML="");var o=i(e),r="";o.forEach(function(e){r+='<div class="matching-post">\n<h2><a href="'+e.url+'">'+e.title+"</a></h2>\n<p>"+e.content+"</p>\n</div>"}),t.classList.add("show"),t.innerHTML=r||'<p class="empty">'+m+"</p>"}function f(){var e,n=Docsify.dom.find("div.search"),t=Docsify.dom.find(n,"input");Docsify.dom.on(n,"click",function(e){return"A"!==e.target.tagName&&e.stopPropagation()}),Docsify.dom.on(t,"input",function(n){clearTimeout(e),e=setTimeout(function(e){return c(n.target.value.trim())},100)})}function l(e,n){var t=Docsify.dom.getNode('.search input[type="search"]');if(t)if("string"==typeof e)t.placeholder=e;else{var o=Object.keys(e).filter(function(e){return n.indexOf(e)>-1})[0];t.placeholder=e[o]}}function d(e,n){if("string"==typeof e)m=e;else{var t=Object.keys(e).filter(function(e){return n.indexOf(e)>-1})[0];m=e[t]}}function p(e,n){var t=n.router.parse().query.s;a(),s(e,t),f(),t&&setTimeout(function(e){return c(t)},500)}function u(e,n){l(e.placeholder,n.route.path),d(e.noData,n.route.path)}var h,y={},m="",g={placeholder:"Type to search",noData:"No Results!",paths:"auto",depth:2,maxAge:864e5},v=function(e,n){var t=Docsify.util,o=n.config.search||g;Array.isArray(o)?g.paths=o:"object"==typeof o&&(g.paths=Array.isArray(o.paths)?o.paths:"auto",g.maxAge=t.isPrimitive(o.maxAge)?o.maxAge:g.maxAge,g.placeholder=o.placeholder||g.placeholder,g.noData=o.noData||g.noData,g.depth=o.depth||g.depth);var i="auto"===g.paths;e.mounted(function(e){p(g,n),!i&&r(g,n)}),e.doneEach(function(e){u(g,n),i&&r(g,n)})};$docsify.plugins=[].concat(v,$docsify.plugins)}();
-1
View File
@@ -1,4 +1,3 @@
this.D = this.D || {};
(function () {
'use strict';
+1 -1
View File
@@ -1 +1 @@
this.D=this.D||{},function(){"use strict";function t(t){var o,i=Docsify.dom;i.appendTo(i.head,i.create("style",n)),t.doneEach(function(t){var n=i.findAll("img:not(.emoji)");Array.isArray(o)&&o.length&&(o.forEach(function(t){return t()}),o=[]),o=n.map(e)})}var e=("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self,function(t,e){return e={exports:{}},t(e,e.exports),e.exports}(function(t,e){!function(e,n){t.exports=function(){function t(){-1===g&&(g=window.pageYOffset),Math.abs(g-window.pageYOffset)>=40&&a()}function e(t){27===t.keyCode&&a()}function n(t){var e=t.touches[0];null!==e&&(y=e.pageY,t.target.addEventListener("touchmove",o))}function o(t){var e=t.touches[0];null!==e&&Math.abs(e.pageY-y)>10&&(a(),t.target.removeEventListener("touchmove",o))}function i(){a()}function r(){document.addEventListener("scroll",t),document.addEventListener("keyup",e),document.addEventListener("touchstart",n),document.addEventListener("click",i,!0)}function s(){document.removeEventListener("scroll",t),document.removeEventListener("keyup",e),document.removeEventListener("touchstart",n),document.removeEventListener("click",i,!0)}function a(t){null!==h&&(t?h.dispose():h.close(),s(),h=null)}function c(t){if(!document.body.classList.contains("zoom-overlay-open"))return t.metaKey||t.ctrlKey?void window.open(t.target.getAttribute("data-original")||t.target.src,"_blank"):void(t.target.width>=m()-v||(a(!0),h=new p(t.target,v),h.zoom(),r()))}var m=function(){return document.documentElement.clientWidth},u=function(){return document.documentElement.clientHeight},d=function(t){var e=t.getBoundingClientRect(),n=document.documentElement,o=window;return{top:e.top+o.pageYOffset-n.clientTop,left:e.left+o.pageXOffset-n.clientLeft}},l=function(t,e,n){var o=function(t){t.target.removeEventListener(e,o),n()};t.addEventListener(e,o)},f=function(t,e){this.w=t,this.h=e},p=function(t,e){this.img=t,this.preservedTransform=t.style.transform,this.wrap=null,this.overlay=null,this.offset=e};p.prototype.forceRepaint=function(){this.img.offsetWidth},p.prototype.zoom=function(){var t=new f(this.img.naturalWidth,this.img.naturalHeight);this.wrap=document.createElement("div"),this.wrap.classList.add("zoom-img-wrap"),this.img.parentNode.insertBefore(this.wrap,this.img),this.wrap.appendChild(this.img),this.img.classList.add("zoom-img"),this.img.setAttribute("data-action","zoom-out"),this.overlay=document.createElement("div"),this.overlay.classList.add("zoom-overlay"),document.body.appendChild(this.overlay),this.forceRepaint();var e=this.calculateScale(t);this.forceRepaint(),this.animate(e),document.body.classList.add("zoom-overlay-open")},p.prototype.calculateScale=function(t){var e=t.w/this.img.width,n=m()-this.offset,o=u()-this.offset,i=t.w/t.h,r=n/o;return t.w<n&&t.h<o?e:i<r?o/t.h*e:n/t.w*e},p.prototype.animate=function(t){var e=d(this.img),n=window.pageYOffset,o=m()/2,i=n+u()/2,r=e.left+this.img.width/2,s=e.top+this.img.height/2,a=o-r,c=i-s,l="scale("+t+")",f="translate3d("+a+"px, "+c+"px, 0px)";this.img.style.transform=l,this.wrap.style.transform=f},p.prototype.dispose=function(){null!==this.wrap&&null!==this.wrap.parentNode&&(this.img.classList.remove("zoom-img"),this.img.setAttribute("data-action","zoom"),this.wrap.parentNode.insertBefore(this.img,this.wrap),this.wrap.parentNode.removeChild(this.wrap),document.body.removeChild(this.overlay),document.body.classList.remove("zoom-overlay-transitioning"))},p.prototype.close=function(){var t=this;document.body.classList.add("zoom-overlay-transitioning"),this.img.style.transform=this.preservedTransform,0===this.img.style.length&&this.img.removeAttribute("style"),this.wrap.style.transform="none",l(this.img,"transitionend",function(){t.dispose(),document.body.classList.remove("zoom-overlay-open")})};var h=null,v=80,g=-1,y=-1;return function(t){return t.setAttribute("data-action","zoom"),t.addEventListener("click",c),function(){return t.removeEventListener("click",c)}}}()}()})),n='img[data-action="zoom"] {\n cursor: pointer;\n cursor: -webkit-zoom-in;\n cursor: zoom-in;\n}\n.zoom-img,\n.zoom-img-wrap {\n position: relative;\n z-index: 666;\n transition: -webkit-transform 300ms cubic-bezier(.2,0,.2,1);\n transition: transform 300ms cubic-bezier(.2,0,.2,1);\n transition: transform 300ms cubic-bezier(.2,0,.2,1), -webkit-transform 300ms cubic-bezier(.2,0,.2,1);\n}\n.zoom-overlay {\n z-index: 420;\n background: #fff;\n position: fixed;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n pointer-events: none;\n opacity: 0;\n transition: opacity 300ms;\n}\n.zoom-overlay-open .zoom-overlay {\n opacity: 1;\n}\n.zoom-overlay-open {\n cursor: pointer;\n cursor: -webkit-zoom-out;\n cursor: zoom-out;\n}\n.zoom-overlay-transitioning {\n cursor: default;\n}\n.zoom-overlay-open.zoom-overlay-transitioning .zoom-overlay{\n opacity: 0;\n}\n';$docsify.plugins=[].concat(t,$docsify.plugins)}();
!function(){"use strict";function t(t){var o,i=Docsify.dom;i.appendTo(i.head,i.create("style",n)),t.doneEach(function(t){var n=i.findAll("img:not(.emoji)");Array.isArray(o)&&o.length&&(o.forEach(function(t){return t()}),o=[]),o=n.map(e)})}var e=("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self,function(t,e){return e={exports:{}},t(e,e.exports),e.exports}(function(t,e){!function(e,n){t.exports=function(){function t(){-1===g&&(g=window.pageYOffset),Math.abs(g-window.pageYOffset)>=40&&a()}function e(t){27===t.keyCode&&a()}function n(t){var e=t.touches[0];null!==e&&(y=e.pageY,t.target.addEventListener("touchmove",o))}function o(t){var e=t.touches[0];null!==e&&Math.abs(e.pageY-y)>10&&(a(),t.target.removeEventListener("touchmove",o))}function i(){a()}function r(){document.addEventListener("scroll",t),document.addEventListener("keyup",e),document.addEventListener("touchstart",n),document.addEventListener("click",i,!0)}function s(){document.removeEventListener("scroll",t),document.removeEventListener("keyup",e),document.removeEventListener("touchstart",n),document.removeEventListener("click",i,!0)}function a(t){null!==h&&(t?h.dispose():h.close(),s(),h=null)}function c(t){if(!document.body.classList.contains("zoom-overlay-open"))return t.metaKey||t.ctrlKey?void window.open(t.target.getAttribute("data-original")||t.target.src,"_blank"):void(t.target.width>=m()-v||(a(!0),h=new p(t.target,v),h.zoom(),r()))}var m=function(){return document.documentElement.clientWidth},u=function(){return document.documentElement.clientHeight},d=function(t){var e=t.getBoundingClientRect(),n=document.documentElement,o=window;return{top:e.top+o.pageYOffset-n.clientTop,left:e.left+o.pageXOffset-n.clientLeft}},l=function(t,e,n){var o=function(t){t.target.removeEventListener(e,o),n()};t.addEventListener(e,o)},f=function(t,e){this.w=t,this.h=e},p=function(t,e){this.img=t,this.preservedTransform=t.style.transform,this.wrap=null,this.overlay=null,this.offset=e};p.prototype.forceRepaint=function(){this.img.offsetWidth},p.prototype.zoom=function(){var t=new f(this.img.naturalWidth,this.img.naturalHeight);this.wrap=document.createElement("div"),this.wrap.classList.add("zoom-img-wrap"),this.img.parentNode.insertBefore(this.wrap,this.img),this.wrap.appendChild(this.img),this.img.classList.add("zoom-img"),this.img.setAttribute("data-action","zoom-out"),this.overlay=document.createElement("div"),this.overlay.classList.add("zoom-overlay"),document.body.appendChild(this.overlay),this.forceRepaint();var e=this.calculateScale(t);this.forceRepaint(),this.animate(e),document.body.classList.add("zoom-overlay-open")},p.prototype.calculateScale=function(t){var e=t.w/this.img.width,n=m()-this.offset,o=u()-this.offset,i=t.w/t.h,r=n/o;return t.w<n&&t.h<o?e:i<r?o/t.h*e:n/t.w*e},p.prototype.animate=function(t){var e=d(this.img),n=window.pageYOffset,o=m()/2,i=n+u()/2,r=e.left+this.img.width/2,s=e.top+this.img.height/2,a=o-r,c=i-s,l="scale("+t+")",f="translate3d("+a+"px, "+c+"px, 0px)";this.img.style.transform=l,this.wrap.style.transform=f},p.prototype.dispose=function(){null!==this.wrap&&null!==this.wrap.parentNode&&(this.img.classList.remove("zoom-img"),this.img.setAttribute("data-action","zoom"),this.wrap.parentNode.insertBefore(this.img,this.wrap),this.wrap.parentNode.removeChild(this.wrap),document.body.removeChild(this.overlay),document.body.classList.remove("zoom-overlay-transitioning"))},p.prototype.close=function(){var t=this;document.body.classList.add("zoom-overlay-transitioning"),this.img.style.transform=this.preservedTransform,0===this.img.style.length&&this.img.removeAttribute("style"),this.wrap.style.transform="none",l(this.img,"transitionend",function(){t.dispose(),document.body.classList.remove("zoom-overlay-open")})};var h=null,v=80,g=-1,y=-1;return function(t){return t.setAttribute("data-action","zoom"),t.addEventListener("click",c),function(){return t.removeEventListener("click",c)}}}()}()})),n='img[data-action="zoom"] {\n cursor: pointer;\n cursor: -webkit-zoom-in;\n cursor: zoom-in;\n}\n.zoom-img,\n.zoom-img-wrap {\n position: relative;\n z-index: 666;\n transition: -webkit-transform 300ms cubic-bezier(.2,0,.2,1);\n transition: transform 300ms cubic-bezier(.2,0,.2,1);\n transition: transform 300ms cubic-bezier(.2,0,.2,1), -webkit-transform 300ms cubic-bezier(.2,0,.2,1);\n}\n.zoom-overlay {\n z-index: 420;\n background: #fff;\n position: fixed;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n pointer-events: none;\n opacity: 0;\n transition: opacity 300ms;\n}\n.zoom-overlay-open .zoom-overlay {\n opacity: 1;\n}\n.zoom-overlay-open {\n cursor: pointer;\n cursor: -webkit-zoom-out;\n cursor: zoom-out;\n}\n.zoom-overlay-transitioning {\n cursor: default;\n}\n.zoom-overlay-open.zoom-overlay-transitioning .zoom-overlay{\n opacity: 0;\n}\n';$docsify.plugins=[].concat(t,$docsify.plugins)}();
+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
+4959
View File
File diff suppressed because it is too large Load Diff
+7 -5
View File
@@ -1,6 +1,6 @@
{
"name": "docsify",
"version": "4.1.2",
"version": "4.2.9",
"description": "A magical documentation generator.",
"author": {
"name": "qingwei-li",
@@ -20,7 +20,8 @@
"themes"
],
"scripts": {
"build": "rm -rf lib themes && node build/build && mkdir lib/themes && mkdir themes && node build/build-css && npm run build:ssr",
"bootstrap": "npm i && lerna bootstrap",
"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",
@@ -35,20 +36,21 @@
"zoom-image": "^0.1.4"
},
"devDependencies": {
"babel-plugin-transform-async-to-generator": "^6.24.1",
"babel-preset-es2015": "^6.24.1",
"conventional-changelog-cli": "^1.3.2",
"cssnano": "^3.10.0",
"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-babel": "^2.7.1",
"rollup-plugin-async": "^1.2.0",
"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"
+8 -2
View File
@@ -5,6 +5,8 @@ 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'
function cwd (...args) {
return resolve(process.cwd(), ...args)
@@ -94,7 +96,7 @@ export default class Renderer {
case 'sidebar':
html = this.compiler.sidebar(html, maxLevel) +
`<script>window.__SUB_SIDEBAR__ = ${JSON.stringify(
this.compiler.subSidebar(html, subMaxLevel)
this.compiler.subSidebar(subMaxLevel)
)}</script>`
break
case 'cover':
@@ -111,10 +113,12 @@ export default class Renderer {
}
async _loadFile (filePath) {
debug('docsify')(`load > ${filePath}`)
let content
try {
if (isAbsolutePath(filePath)) {
const res = await fetch(filePath)
if (!res.ok) throw Error()
content = await res.text()
this.lock = 0
} else {
@@ -131,7 +135,9 @@ export default class Renderer {
const fileName = basename(filePath)
return await this._loadFile(cwd(filePath, '../..', fileName))
return await this._loadFile(resolvePathname(`../${fileName}`, filePath))
}
}
}
Renderer.version = '__VERSION__'
+41
View File
@@ -0,0 +1,41 @@
{
"lockfileVersion": 1,
"dependencies": {
"debug": {
"version": "2.6.8",
"resolved": "https://registry.npmjs.org/debug/-/debug-2.6.8.tgz",
"integrity": "sha1-5zFTHKLt4n0YgiJCfaF4IdaP9Pw="
},
"encoding": {
"version": "0.1.12",
"resolved": "https://registry.npmjs.org/encoding/-/encoding-0.1.12.tgz",
"integrity": "sha1-U4tm8+5izRq1HsMjgp0flIDHS+s="
},
"iconv-lite": {
"version": "0.4.18",
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.18.tgz",
"integrity": "sha512-sr1ZQph3UwHTR0XftSbK85OvBbxe/abLGzEnPENCQwmHf7sck8Oyu4ob3LgBxWWxRoM+QszeUyl7jbqapu2TqA=="
},
"is-stream": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz",
"integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ="
},
"ms": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
"integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g="
},
"node-fetch": {
"version": "1.7.1",
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-1.7.1.tgz",
"integrity": "sha512-j8XsFGCLw79vWXkZtMSmmLaOk9z5SQ9bV/tkbZVCqvgwzrjAGq66igobLofHtF63NvMTp2WjytpsNTGKa+XRIQ=="
},
"resolve-pathname": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/resolve-pathname/-/resolve-pathname-2.1.0.tgz",
"integrity": "sha1-6DWIAbhrg7F1YNTjw4LXrvIQCUQ="
}
},
"version": "4.2.9"
}
@@ -1,6 +1,6 @@
{
"name": "docsify-server-renderer",
"version": "4.1.2",
"version": "4.2.9",
"description": "docsify server renderer",
"author": {
"name": "qingwei-li",
@@ -15,6 +15,8 @@
"test": "echo 'hello'"
},
"dependencies": {
"node-fetch": "^1.7.0"
"debug": "^2.6.8",
"node-fetch": "^1.7.0",
"resolve-pathname": "^2.1.0"
}
}
+2 -1
View File
@@ -21,7 +21,8 @@ const config = merge({
mergeNavbar: false,
formatUpdated: '',
externalLinkTarget: '_blank',
routerModel: 'hash'
routerModel: 'hash',
noCompileLinks: []
}, window.$docsify)
const script = document.currentScript ||
+11 -4
View File
@@ -28,17 +28,24 @@ export function fetchMixin (proto) {
// Current page is html
this.isHTML = /\.html$/g.test(path)
// Load main content
last.then((text, opt) => {
this._renderMain(text, opt)
const loadSideAndNav = () => {
if (!loadSidebar) return cb()
const fn = result => { this._renderSidebar(result); cb() }
// Load sidebar
loadNested(path, loadSidebar, fn, this, true)
}
// Load main content
last.then((text, opt) => {
this._renderMain(text, opt)
loadSideAndNav()
},
_ => this._renderMain(null))
_ => {
this._renderMain(null)
loadSideAndNav()
})
// Load nav
loadNavbar &&
+19 -1
View File
@@ -5,6 +5,19 @@ 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) {
const state = document.readyState
if (state === 'complete' || state === 'interactive') {
return setTimeout(callback, 0)
}
document.addEventListener('DOMContentLoaded', callback)
}
function Docsify () {
this._init()
}
@@ -22,7 +35,12 @@ eventMixin(proto)
*/
initGlobalAPI()
/**
* Version
*/
Docsify.version = '__VERSION__'
/**
* Run Docsify
*/
setTimeout(_ => new Docsify(), 0)
ready(_ => new Docsify())
+3 -4
View File
@@ -19,23 +19,22 @@ export function initLifecycle (vm) {
}
export function callHook (vm, hook, data, next = noop) {
let newData = data
const queue = vm._hooks[hook]
const step = function (index) {
const hook = queue[index]
if (index >= queue.length) {
next(newData)
next(data)
} else {
if (typeof hook === 'function') {
if (hook.length === 2) {
hook(data, result => {
newData = result
data = result
step(index + 1)
})
} else {
const result = hook(data)
newData = result !== undefined ? result : newData
data = result !== undefined ? result : data
step(index + 1)
}
} else {
+35 -3
View File
@@ -7,6 +7,8 @@ import { emojify } from './emojify'
import { isAbsolutePath, getPath } from '../router/util'
import { isFn, merge, cached } from '../util/core'
const cachedLinks = {}
export class Compiler {
constructor (config, router) {
this.config = config
@@ -42,9 +44,23 @@ export class Compiler {
})
}
matchNotCompileLink (link) {
const links = this.config.noCompileLinks
for (var i = 0; i < links.length; i++) {
const n = links[i]
const re = cachedLinks[n] || (cachedLinks[n] = new RegExp(`^${n}$`))
if (re.test(link)) {
return link
}
}
}
_initRenderer () {
const renderer = new marked.Renderer()
const { linkTarget, router, toc, contentBase } = this
const { linkTarget, router, contentBase } = this
const _self = this
/**
* render anchor tag
* @link https://github.com/chjj/marked#overriding-renderer-methods
@@ -67,7 +83,7 @@ export class Compiler {
const slug = slugify(text)
const url = router.toURL(router.getCurrentPath(), { id: slug })
nextToc.slug = url
toc.push(nextToc)
_self.toc.push(nextToc)
return `<h${level} id="${slug}"><a href="${url}" data-id="${slug}" class="anchor"><span>${text}</span></a></h${level}>`
}
@@ -79,11 +95,23 @@ export class Compiler {
}
renderer.link = function (href, title, text) {
let blank = ''
if (!/:|(\/{2})/.test(href)) {
if (!/:|(\/{2})/.test(href) &&
!_self.matchNotCompileLink(href) &&
!/(\s?:ignore)(\s\S+)?$/.test(title)) {
href = router.toURL(href, null, router.getCurrentPath())
} else {
blank = ` target="${linkTarget}"`
title = title && title.replace(/:ignore/g, '').trim()
}
let target = title && title.match(/:target=\w+/)
if (target) {
target = target[0]
title = title.replace(target, '')
blank = ' ' + target.slice(1)
}
if (title) {
title = ` title="${title}"`
}
@@ -134,6 +162,10 @@ export class Compiler {
* Compile sub sidebar
*/
subSidebar (level) {
if (!level) {
this.toc = []
return
}
const currentPath = this.router.getCurrentPath()
const { cacheTree, toc } = this
+13 -3
View File
@@ -84,10 +84,13 @@ export function renderMixin (proto) {
this._renderTo('.sidebar-nav', this.compiler.sidebar(text, maxLevel))
const activeEl = getAndActive(this.router, '.sidebar-nav', true, true)
if (loadSidebar && activeEl) {
activeEl.parentNode.innerHTML += this.compiler.subSidebar(subMaxLevel)
activeEl.parentNode.innerHTML += (this.compiler.subSidebar(subMaxLevel) || '')
} else {
// reset toc
this.compiler.subSidebar()
}
// bind event
this._bindEventOnRendered()
this._bindEventOnRendered(activeEl)
}
proto._bindEventOnRendered = function (activeEl) {
@@ -114,6 +117,10 @@ export function renderMixin (proto) {
}
proto._renderMain = function (text, opt = {}) {
if (!text) {
return renderMain.call(this, text)
}
callHook(this, 'beforeEach', text, result => {
let html = this.isHTML ? result : this.compiler.compile(result)
if (opt.updatedAt) {
@@ -204,9 +211,12 @@ export function initRender (vm) {
dom.before(navAppendToTarget, navEl)
if (config.themeColor) {
dom.$.head.innerHTML += tpl.theme(config.themeColor)
dom.$.head.appendChild(
dom.create('div', tpl.theme(config.themeColor)).firstElementChild
)
// Polyfll
cssVars(config.themeColor)
}
vm._updateRender()
dom.toggleClass(dom.body, 'ready')
}
+14 -3
View File
@@ -1,8 +1,15 @@
import { getPath, isAbsolutePath } from '../util'
import { noop } from '../../util/core'
function getAlias (path, alias) {
return alias[path] ? getAlias(alias[path], alias) : path
const cached = {}
function getAlias (path, alias, last) {
const match = Object.keys(alias).filter((key) => {
const re = cached[key] || (cached[key] = new RegExp(`^${key}$`))
return re.test(path) && path !== last
})[0]
return match ? getAlias(path.replace(cached[match], alias[match]), alias, path) : path
}
function getFileName (path) {
@@ -22,7 +29,7 @@ export class History {
return this.config.basePath
}
getFile (path) {
getFile (path, isRelative) {
path = path || this.getCurrentPath()
const { config } = this
@@ -33,6 +40,10 @@ export class History {
path = path === '/README.md' ? (config.homepage || path) : path
path = isAbsolutePath(path) ? path : getPath(base, path)
if (isRelative) {
path = path.replace(new RegExp(`^${base}`), '')
}
return path
}
+6 -6
View File
@@ -58,20 +58,20 @@ export class HashHistory extends History {
parse (path = location.href) {
let query = ''
const hashIndex = path.indexOf('#')
if (hashIndex) {
path = path.slice(hashIndex + 1)
}
const queryIndex = path.indexOf('?')
if (queryIndex >= 0) {
query = path.slice(queryIndex + 1)
path = path.slice(0, queryIndex)
}
const hashIndex = path.indexOf('#')
if (hashIndex) {
path = path.slice(hashIndex + 1)
}
return {
path,
file: this.getFile(path),
file: this.getFile(path, true),
query: parseQuery(query)
}
}
+10 -6
View File
@@ -1,6 +1,7 @@
import { HashHistory } from './history/hash'
import { HTML5History } from './history/html5'
import { supportsPushState } from '../util/env'
import * as dom from '../util/dom'
export function routerMixin (proto) {
proto.route = {}
@@ -8,6 +9,12 @@ export function routerMixin (proto) {
let lastRoute = {}
function updateRender (vm) {
vm.router.normalize()
vm.route = vm.router.parse()
dom.body.setAttribute('data-page', vm.route.file)
}
export function initRouter (vm) {
const config = vm.config
const mode = config.routerMode || 'hash'
@@ -20,14 +27,11 @@ export function initRouter (vm) {
}
vm.router = router
router.normalize()
lastRoute = vm.route = router.parse()
vm._updateRender()
updateRender(vm)
lastRoute = vm.route
router.onchange(_ => {
router.normalize()
vm.route = router.parse()
updateRender(vm)
vm._updateRender()
if (lastRoute.path === vm.route.path) {
+6 -3
View File
@@ -16,8 +16,9 @@ export function parseQuery (query) {
query.split('&').forEach(function (param) {
const parts = param.replace(/\+/g, ' ').split('=')
res[parts[0]] = decode(parts[1])
res[parts[0]] = parts[1] && decode(parts[1])
})
return res
}
@@ -25,7 +26,9 @@ export function stringifyQuery (obj) {
const qs = []
for (const key in obj) {
qs.push(`${encode(key)}=${encode(obj[key])}`.toLowerCase())
qs.push(obj[key]
? `${encode(key)}=${encode(obj[key])}`.toLowerCase()
: encode(key))
}
return qs.length ? `?${qs.join('&')}` : ''
@@ -36,7 +39,7 @@ export function getPath (...args) {
}
export const isAbsolutePath = cached(path => {
return /(:|(\/{2}))/.test(path)
return /(:|(\/{2}))/g.test(path)
})
export const getParentPath = cached(path => {
+1 -1
View File
@@ -10,4 +10,4 @@ const install = function (hook, vm) {
})
}
window.$docsify.plugins = [].concat(install, window.$docsify.plugins)
$docsify.plugins = [].concat(install, $docsify.plugins)
+10 -13
View File
@@ -7,24 +7,21 @@ function appendScript () {
}
function init (id) {
let ga = window.ga
if (!ga) {
appendScript()
ga = ga || function () {
(ga.q = ga.q || []).push(arguments)
}
ga.l = Number(new Date())
ga('create', id, 'auto')
appendScript()
window.ga = window.ga || function () {
(window.ga.q = window.ga.q || []).push(arguments)
}
return ga
window.ga.l = Number(new Date())
window.ga('create', id, 'auto')
}
function collect () {
const ga = init($docsify.ga)
if (!window.ga) {
init($docsify.ga)
}
ga('set', 'page', location.hash)
ga('send', 'pageview')
window.ga('set', 'page', location.hash)
window.ga('send', 'pageview')
}
const install = function (hook) {
+2
View File
@@ -5,6 +5,7 @@ const CONFIG = {
placeholder: 'Type to search',
noData: 'No Results!',
paths: 'auto',
depth: 2,
maxAge: 86400000 // 1 day
}
@@ -19,6 +20,7 @@ const install = function (hook, vm) {
CONFIG.maxAge = util.isPrimitive(opts.maxAge) ? opts.maxAge : CONFIG.maxAge
CONFIG.placeholder = opts.placeholder || CONFIG.placeholder
CONFIG.noData = opts.noData || CONFIG.noData
CONFIG.depth = opts.depth || CONFIG.depth
}
const isAuto = CONFIG.paths === 'auto'
+3 -3
View File
@@ -38,14 +38,14 @@ function saveData (maxAge) {
localStorage.setItem('docsify.search.index', JSON.stringify(INDEXS))
}
export function genIndex (path, content = '', router) {
export function genIndex (path, content = '', router, depth) {
const tokens = window.marked.lexer(content)
const slugify = window.Docsify.slugify
const index = {}
let slug
tokens.forEach(token => {
if (token.type === 'heading' && token.depth <= 2) {
if (token.type === 'heading' && token.depth <= depth) {
slug = router.toURL(path, { id: slugify(token.text) })
index[slug] = { slug, title: token.text, body: '' }
} else {
@@ -154,7 +154,7 @@ export function init (config, vm) {
helper
.get(vm.router.getFile(path))
.then(result => {
INDEXS[path] = genIndex(path, result, vm.router)
INDEXS[path] = genIndex(path, result, vm.router, config.depth)
len === ++count && saveData(config.maxAge)
})
})
+5 -1
View File
@@ -10,7 +10,7 @@
body:not(.ready) {
overflow: hidden;
[data-cloak], .app-nav {
[data-cloak], .app-nav, > nav {
display: none;
}
}
@@ -245,6 +245,10 @@ main {
}
}
.sidebar-nav {
line-height: 2em;
}
ul {
margin: 0;
padding: 0;
+1 -1
View File
@@ -132,7 +132,7 @@ $sidebar-width: 16rem;
border-radius: 3px;
font-family: Inconsolata;
padding: 0.2em 0.4rem;
white-space: pre;
white-space: nowrap;
}
.markdown-section pre {
+1 -1
View File
@@ -134,7 +134,7 @@ body {
font-size: 0.8rem;
margin: 0 2px;
padding: 3px 5px;
white-space: nowrap;
white-space: pre-wrap;
}
.markdown-section pre {
+1
View File
@@ -3,3 +3,4 @@ $color-bg: #fff;
$color-text: #000;
$sidebar-width: 300px;
@import "basic/layout";
@import "basic/coverpage";
+1 -1
View File
@@ -145,7 +145,7 @@ body {
font-size: 0.8rem;
margin: 0 2px;
padding: 3px 5px;
white-space: nowrap;
white-space: pre-wrap;
}
.markdown-section pre {
-3492
View File
File diff suppressed because it is too large Load Diff