Compare commits

..
21 Commits
Author SHA1 Message Date
Kang Cheng 0586fe7174 chore: use imported util fn 2018-12-23 10:00:12 -08:00
Kang Cheng 3d0bfd6c39 fix: scrollToView not working properly if images exist
Closes: https://github.com/docsifyjs/docsify/issues/351
2018-12-23 09:52:39 -08:00
D.A.Bashkirtsevandcinwell.li 6ac7bace21 Fix getAndRemoveConfig regex (#708)
* Fix getAndRemoveConfig regex

Update getAndRemoveConfig regular expression for prevent cases, when header has name like "foo::bar::baz".

* Fix wrong regexp

* Fix regex

Ignore `:foo` cases
2018-12-05 10:29:55 +08:00
程康andcinwell.li 28beff80f7 feat(search-plugin): add namespace option (#706)
* feat(search-plugin): add namespace option

* docs(search-plugin): update doc for option namespace
2018-12-05 10:29:44 +08:00
Qingwei Li 049726e11e fix: upgrade npm-run-all 2018-11-27 13:13:38 +08:00
Qingwei Li a257a4ab4e chore: add changelog 4.8.6 2018-11-12 10:24:23 +08:00
Qingwei Li a07a613312 [build] 4.8.6 2018-11-12 10:24:21 +08:00
程康andcinwell.li 4db8cd6abf fix: IE10 compatibility (#691)
* fix: IE10 compatibility

* chore: use built-in helper fn
2018-11-12 10:22:14 +08:00
Li Yimingandcinwell.li a72e7490c3 docs: mermaid duplicated id, see #504 (#685)
Please makes sure these boxes are checked before submitting your PR, thank you!

* [x] Make sure you are merging your commits to `master` branch.
* [x] Add some descriptions and refer relative issues for you PR.
* [x] DO NOT include files inside `lib` directory.
2018-11-06 17:27:24 +08:00
qingwei.li cc79e2e992 chore: add changelog 4.8.5 2018-11-02 08:59:35 +08:00
qingwei.li 5b6525b8f1 [build] 4.8.5 2018-11-02 08:59:34 +08:00
qingwei.li aa719e3a47 fix: expose version info for Docsify, fixed #641 2018-11-02 08:53:46 +08:00
qingwei.li 22a5927eaf docs(helper): about markdown in html tag, fixed #655 fixed #667 2018-11-02 07:38:54 +08:00
qingwei.li 5ab9d8cb87 chore: add changelog 4.8.4 2018-11-02 02:17:37 +08:00
qingwei.li f84242d380 [build] 4.8.4 2018-11-02 02:17:36 +08:00
cinwell.liandGitHub 1a945d445a fix(cover): Compatible with legacy styles, fixed #677 (#678)
Please makes sure these boxes are checked before submitting your PR, thank you!

* [ ] Make sure you are merging your commits to `master` branch.
* [ ] Add some descriptions and refer relative issues for you PR.
* [ ] DO NOT include files inside `lib` directory.
2018-11-02 02:14:02 +08:00
qingwei.li 81ec7c763b chore: update changelog 2018-11-01 19:19:45 +08:00
qingwei.li d91a66cadd chore: add changelog 4.8.3 2018-11-01 19:09:51 +08:00
qingwei.li 58b130996e [build] 4.8.3 2018-11-01 19:09:50 +08:00
Qingwei Li ee800a6572 docs: add codesandbox link 2018-11-01 17:59:03 +08:00
Qingwei Li 6daecc8a68 docs: add more plugins link" 2018-11-01 14:05:10 +08:00
29 changed files with 928 additions and 726 deletions
+186 -182
View File
@@ -1,182 +1,186 @@
<a name="4.8.6"></a>
## [4.8.6](https://github.com/docsifyjs/docsify/compare/v4.8.5...v4.8.6) (2018-11-12)
### Bug Fixes
* IE10 compatibility ([#691](https://github.com/docsifyjs/docsify/issues/691)) ([4db8cd6](https://github.com/docsifyjs/docsify/commit/4db8cd6))
<a name="4.8.5"></a>
## [4.8.5](https://github.com/docsifyjs/docsify/compare/v4.8.4...v4.8.5) (2018-11-02)
### Bug Fixes
* expose version info for Docsify, fixed [#641](https://github.com/docsifyjs/docsify/issues/641) ([aa719e3](https://github.com/docsifyjs/docsify/commit/aa719e3))
<a name="4.8.4"></a>
## [4.8.4](https://github.com/docsifyjs/docsify/compare/v4.8.3...v4.8.4) (2018-11-01)
### Bug Fixes
* **cover:** Compatible with legacy styles, fixed [#677](https://github.com/docsifyjs/docsify/issues/677) ([#678](https://github.com/docsifyjs/docsify/issues/678)) ([1a945d4](https://github.com/docsifyjs/docsify/commit/1a945d4))
<a name="4.8.3"></a>
## [4.8.3](https://github.com/docsifyjs/docsify/compare/v4.8.2...v4.8.3) (2018-11-01)
Fix the last release files has the old version marked...
<a name="4.8.2"></a> <a name="4.8.2"></a>
## [4.8.2](https://github.com/docsifyjs/docsify/compare/v4.8.1...v4.8.2) (2018-11-01) ## [4.8.2](https://github.com/docsifyjs/docsify/compare/v4.8.1...v4.8.2) (2018-11-01)
### Bug Fixes ### Bug Fixes
* cover button style, fixed [#670](https://github.com/docsifyjs/docsify/issues/670), fixed [#665](https://github.com/docsifyjs/docsify/issues/665) ([#675](https://github.com/docsifyjs/docsify/issues/675)) ([fcd1087](https://github.com/docsifyjs/docsify/commit/fcd1087)) - cover button style, fixed [#670](https://github.com/docsifyjs/docsify/issues/670), fixed [#665](https://github.com/docsifyjs/docsify/issues/665) ([#675](https://github.com/docsifyjs/docsify/issues/675)) ([fcd1087](https://github.com/docsifyjs/docsify/commit/fcd1087))
* update match regex ([#669](https://github.com/docsifyjs/docsify/issues/669)) ([2edf47e](https://github.com/docsifyjs/docsify/commit/2edf47e)) - update match regex ([#669](https://github.com/docsifyjs/docsify/issues/669)) ([2edf47e](https://github.com/docsifyjs/docsify/commit/2edf47e))
* use copy of cached value ([#668](https://github.com/docsifyjs/docsify/issues/668)) ([5fcf210](https://github.com/docsifyjs/docsify/commit/5fcf210)) - use copy of cached value ([#668](https://github.com/docsifyjs/docsify/issues/668)) ([5fcf210](https://github.com/docsifyjs/docsify/commit/5fcf210))
* **compiler:** import prism-markup-templating, fixed [#672](https://github.com/docsifyjs/docsify/issues/672) ([#676](https://github.com/docsifyjs/docsify/issues/676)) ([fdd8826](https://github.com/docsifyjs/docsify/commit/fdd8826)) - **compiler:** import prism-markup-templating, fixed [#672](https://github.com/docsifyjs/docsify/issues/672) ([#676](https://github.com/docsifyjs/docsify/issues/676)) ([fdd8826](https://github.com/docsifyjs/docsify/commit/fdd8826))
### Features ### Features
* add heading config id ([#671](https://github.com/docsifyjs/docsify/issues/671)) ([ab19b13](https://github.com/docsifyjs/docsify/commit/ab19b13)) - add heading config id ([#671](https://github.com/docsifyjs/docsify/issues/671)) ([ab19b13](https://github.com/docsifyjs/docsify/commit/ab19b13))
<a name="4.8.1"></a> <a name="4.8.1"></a>
## [4.8.1](https://github.com/docsifyjs/docsify/compare/v4.8.0...v4.8.1) (2018-10-31) ## [4.8.1](https://github.com/docsifyjs/docsify/compare/v4.8.0...v4.8.1) (2018-10-31)
### Bug Fixes ### Bug Fixes
* ssr package dep, fixed [#605](https://github.com/docsifyjs/docsify/issues/605) ([2bc880d](https://github.com/docsifyjs/docsify/commit/2bc880d)) - ssr package dep, fixed [#605](https://github.com/docsifyjs/docsify/issues/605) ([2bc880d](https://github.com/docsifyjs/docsify/commit/2bc880d))
* **compiler:** extra quotes for codeblock ([4f588e0](https://github.com/docsifyjs/docsify/commit/4f588e0)) - **compiler:** extra quotes for codeblock ([4f588e0](https://github.com/docsifyjs/docsify/commit/4f588e0))
* **compiler:** prevent render of html code in paragraph, fixed [#663](https://github.com/docsifyjs/docsify/issues/663) ([d35059d](https://github.com/docsifyjs/docsify/commit/d35059d)) - **compiler:** prevent render of html code in paragraph, fixed [#663](https://github.com/docsifyjs/docsify/issues/663) ([d35059d](https://github.com/docsifyjs/docsify/commit/d35059d))
### Features ### Features
* upgrade PrismJS, fixed [#534](https://github.com/docsifyjs/docsify/issues/534) ([4805cb5](https://github.com/docsifyjs/docsify/commit/4805cb5)) - upgrade PrismJS, fixed [#534](https://github.com/docsifyjs/docsify/issues/534) ([4805cb5](https://github.com/docsifyjs/docsify/commit/4805cb5))
<a name="4.8.0"></a> <a name="4.8.0"></a>
# [4.8.0](https://github.com/docsifyjs/docsify/compare/v4.7.1...v4.8.0) (2018-10-31) # [4.8.0](https://github.com/docsifyjs/docsify/compare/v4.7.1...v4.8.0) (2018-10-31)
### Bug Fixes ### Bug Fixes
* Cache TOC for later usage in the case of cached file html ([#649](https://github.com/docsifyjs/docsify/issues/649)) ([9e86017](https://github.com/docsifyjs/docsify/commit/9e86017)) - Cache TOC for later usage in the case of cached file html ([#649](https://github.com/docsifyjs/docsify/issues/649)) ([9e86017](https://github.com/docsifyjs/docsify/commit/9e86017))
* improve external script plugin ([#632](https://github.com/docsifyjs/docsify/issues/632)) ([50c2434](https://github.com/docsifyjs/docsify/commit/50c2434)) - improve external script plugin ([#632](https://github.com/docsifyjs/docsify/issues/632)) ([50c2434](https://github.com/docsifyjs/docsify/commit/50c2434))
* missing variable declaration ([#660](https://github.com/docsifyjs/docsify/issues/660)) ([1ce37bd](https://github.com/docsifyjs/docsify/commit/1ce37bd)) - missing variable declaration ([#660](https://github.com/docsifyjs/docsify/issues/660)) ([1ce37bd](https://github.com/docsifyjs/docsify/commit/1ce37bd))
* Remove target for mailto links ([#652](https://github.com/docsifyjs/docsify/issues/652)) ([18f0f03](https://github.com/docsifyjs/docsify/commit/18f0f03)) - Remove target for mailto links ([#652](https://github.com/docsifyjs/docsify/issues/652)) ([18f0f03](https://github.com/docsifyjs/docsify/commit/18f0f03))
* Update getAllPath query selector ([#653](https://github.com/docsifyjs/docsify/issues/653)) ([f6f4e32](https://github.com/docsifyjs/docsify/commit/f6f4e32)) - Update getAllPath query selector ([#653](https://github.com/docsifyjs/docsify/issues/653)) ([f6f4e32](https://github.com/docsifyjs/docsify/commit/f6f4e32))
* Update vue.styl ([#634](https://github.com/docsifyjs/docsify/issues/634)) ([bf060be](https://github.com/docsifyjs/docsify/commit/bf060be)) - Update vue.styl ([#634](https://github.com/docsifyjs/docsify/issues/634)) ([bf060be](https://github.com/docsifyjs/docsify/commit/bf060be))
### Features ### Features
* Add docsify version to $window.docsify object ([#641](https://github.com/docsifyjs/docsify/issues/641)) ([94bc415](https://github.com/docsifyjs/docsify/commit/94bc415)), closes [#521](https://github.com/docsifyjs/docsify/issues/521) - Add docsify version to $window.docsify object ([#641](https://github.com/docsifyjs/docsify/issues/641)) ([94bc415](https://github.com/docsifyjs/docsify/commit/94bc415)), closes [#521](https://github.com/docsifyjs/docsify/issues/521)
* **compiler:** support embedded mermaid ([#629](https://github.com/docsifyjs/docsify/issues/629)) ([42ea8af](https://github.com/docsifyjs/docsify/commit/42ea8af)) - **compiler:** support embedded mermaid ([#629](https://github.com/docsifyjs/docsify/issues/629)) ([42ea8af](https://github.com/docsifyjs/docsify/commit/42ea8af))
* Add hideOtherSidebarContent option ([#661](https://github.com/docsifyjs/docsify/issues/661)) ([4a23c4a](https://github.com/docsifyjs/docsify/commit/4a23c4a)) - Add hideOtherSidebarContent option ([#661](https://github.com/docsifyjs/docsify/issues/661)) ([4a23c4a](https://github.com/docsifyjs/docsify/commit/4a23c4a))
* Allow base64, external, and relative logo values ([#642](https://github.com/docsifyjs/docsify/issues/642)) ([0a0802a](https://github.com/docsifyjs/docsify/commit/0a0802a)), closes [#577](https://github.com/docsifyjs/docsify/issues/577) - Allow base64, external, and relative logo values ([#642](https://github.com/docsifyjs/docsify/issues/642)) ([0a0802a](https://github.com/docsifyjs/docsify/commit/0a0802a)), closes [#577](https://github.com/docsifyjs/docsify/issues/577)
* upgrade marked to 0.5.x, fixed [#645](https://github.com/docsifyjs/docsify/issues/645), close [#644](https://github.com/docsifyjs/docsify/issues/644) ([#662](https://github.com/docsifyjs/docsify/issues/662)) ([a39b214](https://github.com/docsifyjs/docsify/commit/a39b214)) - upgrade marked to 0.5.x, fixed [#645](https://github.com/docsifyjs/docsify/issues/645), close [#644](https://github.com/docsifyjs/docsify/issues/644) ([#662](https://github.com/docsifyjs/docsify/issues/662)) ([a39b214](https://github.com/docsifyjs/docsify/commit/a39b214))
<a name="4.7.1"></a> <a name="4.7.1"></a>
## [4.7.1](https://github.com/docsifyjs/docsify/compare/v4.7.0...v4.7.1) (2018-08-30) ## [4.7.1](https://github.com/docsifyjs/docsify/compare/v4.7.0...v4.7.1) (2018-08-30)
<a name="4.7.0"></a> <a name="4.7.0"></a>
# [4.7.0](https://github.com/QingWei-Li/docsify/compare/v4.6.9...v4.7.0) (2018-06-29) # [4.7.0](https://github.com/QingWei-Li/docsify/compare/v4.6.9...v4.7.0) (2018-06-29)
### Bug Fixes ### Bug Fixes
* alldow addition content in sidebar, fix [#518](https://github.com/QingWei-Li/docsify/issues/518), fix 539 ([#543](https://github.com/QingWei-Li/docsify/issues/543)) ([04b36b0](https://github.com/QingWei-Li/docsify/commit/04b36b0)) - alldow addition content in sidebar, fix [#518](https://github.com/QingWei-Li/docsify/issues/518), fix 539 ([#543](https://github.com/QingWei-Li/docsify/issues/543)) ([04b36b0](https://github.com/QingWei-Li/docsify/commit/04b36b0))
* async install config, fixed [#425](https://github.com/QingWei-Li/docsify/issues/425) ([e4e011c](https://github.com/QingWei-Li/docsify/commit/e4e011c)) - async install config, fixed [#425](https://github.com/QingWei-Li/docsify/issues/425) ([e4e011c](https://github.com/QingWei-Li/docsify/commit/e4e011c))
* loading embed files synchronously, fixed [#525](https://github.com/QingWei-Li/docsify/issues/525), fixed [#527](https://github.com/QingWei-Li/docsify/issues/527) ([#544](https://github.com/QingWei-Li/docsify/issues/544)) ([feea7f9](https://github.com/QingWei-Li/docsify/commit/feea7f9)) - loading embed files synchronously, fixed [#525](https://github.com/QingWei-Li/docsify/issues/525), fixed [#527](https://github.com/QingWei-Li/docsify/issues/527) ([#544](https://github.com/QingWei-Li/docsify/issues/544)) ([feea7f9](https://github.com/QingWei-Li/docsify/commit/feea7f9))
* path include chinese character cause hilight bug ([#556](https://github.com/QingWei-Li/docsify/issues/556)) ([a5f333a](https://github.com/QingWei-Li/docsify/commit/a5f333a)) - path include chinese character cause hilight bug ([#556](https://github.com/QingWei-Li/docsify/issues/556)) ([a5f333a](https://github.com/QingWei-Li/docsify/commit/a5f333a))
### Features ### Features
* add logo option, [#264](https://github.com/QingWei-Li/docsify/issues/264) ([#541](https://github.com/QingWei-Li/docsify/issues/541)) ([ee72dd0](https://github.com/QingWei-Li/docsify/commit/ee72dd0)) - add logo option, [#264](https://github.com/QingWei-Li/docsify/issues/264) ([#541](https://github.com/QingWei-Li/docsify/issues/541)) ([ee72dd0](https://github.com/QingWei-Li/docsify/commit/ee72dd0))
* add unpkg field, close [#531](https://github.com/QingWei-Li/docsify/issues/531) ([#558](https://github.com/QingWei-Li/docsify/issues/558)) ([5c0de0a](https://github.com/QingWei-Li/docsify/commit/5c0de0a)) - add unpkg field, close [#531](https://github.com/QingWei-Li/docsify/issues/531) ([#558](https://github.com/QingWei-Li/docsify/issues/558)) ([5c0de0a](https://github.com/QingWei-Li/docsify/commit/5c0de0a))
* support image resizing, resolve [#508](https://github.com/QingWei-Li/docsify/issues/508) ([#545](https://github.com/QingWei-Li/docsify/issues/545)) ([3a7ad62](https://github.com/QingWei-Li/docsify/commit/3a7ad62)) - support image resizing, resolve [#508](https://github.com/QingWei-Li/docsify/issues/508) ([#545](https://github.com/QingWei-Li/docsify/issues/545)) ([3a7ad62](https://github.com/QingWei-Li/docsify/commit/3a7ad62))
<a name="4.6.10"></a> <a name="4.6.10"></a>
## [4.6.10](https://github.com/QingWei-Li/docsify/compare/v4.6.9...v4.6.10) (2018-03-25) ## [4.6.10](https://github.com/QingWei-Li/docsify/compare/v4.6.9...v4.6.10) (2018-03-25)
### Bug Fixes ### Bug Fixes
* async install config, fixed [#425](https://github.com/QingWei-Li/docsify/issues/425) ([e4e011c](https://github.com/QingWei-Li/docsify/commit/e4e011c)) - async install config, fixed [#425](https://github.com/QingWei-Li/docsify/issues/425) ([e4e011c](https://github.com/QingWei-Li/docsify/commit/e4e011c))
<a name="4.6.9"></a> <a name="4.6.9"></a>
## [4.6.9](https://github.com/QingWei-Li/docsify/compare/v4.6.8...v4.6.9) (2018-03-10) ## [4.6.9](https://github.com/QingWei-Li/docsify/compare/v4.6.8...v4.6.9) (2018-03-10)
### Bug Fixes ### Bug Fixes
* upgrade medium-zoom, fixed [#417](https://github.com/QingWei-Li/docsify/issues/417) ([6a3d69a](https://github.com/QingWei-Li/docsify/commit/6a3d69a)) - upgrade medium-zoom, fixed [#417](https://github.com/QingWei-Li/docsify/issues/417) ([6a3d69a](https://github.com/QingWei-Li/docsify/commit/6a3d69a))
<a name="4.6.8"></a> <a name="4.6.8"></a>
## [4.6.8](https://github.com/QingWei-Li/docsify/compare/v4.6.7...v4.6.8) (2018-03-06) ## [4.6.8](https://github.com/QingWei-Li/docsify/compare/v4.6.7...v4.6.8) (2018-03-06)
### Bug Fixes ### Bug Fixes
* resolve path of image and embed files, fixed [#412](https://github.com/QingWei-Li/docsify/issues/412) ([bfd0d18](https://github.com/QingWei-Li/docsify/commit/bfd0d18)) - resolve path of image and embed files, fixed [#412](https://github.com/QingWei-Li/docsify/issues/412) ([bfd0d18](https://github.com/QingWei-Li/docsify/commit/bfd0d18))
<a name="4.6.7"></a> <a name="4.6.7"></a>
## [4.6.7](https://github.com/QingWei-Li/docsify/compare/v4.6.6...v4.6.7) (2018-03-03) ## [4.6.7](https://github.com/QingWei-Li/docsify/compare/v4.6.6...v4.6.7) (2018-03-03)
### Bug Fixes ### Bug Fixes
* layout css, fixed [#409](https://github.com/QingWei-Li/docsify/issues/409) ([aeb692e](https://github.com/QingWei-Li/docsify/commit/aeb692e)) - layout css, fixed [#409](https://github.com/QingWei-Li/docsify/issues/409) ([aeb692e](https://github.com/QingWei-Li/docsify/commit/aeb692e))
<a name="4.6.6"></a> <a name="4.6.6"></a>
## [4.6.6](https://github.com/QingWei-Li/docsify/compare/v4.6.5...v4.6.6) (2018-03-03) ## [4.6.6](https://github.com/QingWei-Li/docsify/compare/v4.6.5...v4.6.6) (2018-03-03)
<a name="4.6.5"></a> <a name="4.6.5"></a>
## [4.6.5](https://github.com/QingWei-Li/docsify/compare/v4.6.4...v4.6.5) (2018-03-03) ## [4.6.5](https://github.com/QingWei-Li/docsify/compare/v4.6.4...v4.6.5) (2018-03-03)
### Bug Fixes ### Bug Fixes
* **navbar:** Now Navbar isn't append to DOM when loadNavbar is falsy ([#407](https://github.com/QingWei-Li/docsify/issues/407)) ([0933445](https://github.com/QingWei-Li/docsify/commit/0933445)) - **navbar:** Now Navbar isn't append to DOM when loadNavbar is falsy ([#407](https://github.com/QingWei-Li/docsify/issues/407)) ([0933445](https://github.com/QingWei-Li/docsify/commit/0933445))
### Features ### Features
* **config:** Add 404 page options. ([#406](https://github.com/QingWei-Li/docsify/issues/406)) ([9b3b445](https://github.com/QingWei-Li/docsify/commit/9b3b445)) - **config:** Add 404 page options. ([#406](https://github.com/QingWei-Li/docsify/issues/406)) ([9b3b445](https://github.com/QingWei-Li/docsify/commit/9b3b445))
<a name="4.6.4"></a> <a name="4.6.4"></a>
## [4.6.4](https://github.com/QingWei-Li/docsify/compare/v4.6.3...v4.6.4) (2018-03-01)
## [4.6.4](https://github.com/QingWei-Li/docsify/compare/v4.6.3...v4.6.4) (2018-03-01)
### Bug Fixes ### Bug Fixes
* **render:** Disable markdown parsing when the file is an HTML ([#403](https://github.com/QingWei-Li/docsify/issues/403)) ([278a75e](https://github.com/QingWei-Li/docsify/commit/278a75e)) - **render:** Disable markdown parsing when the file is an HTML ([#403](https://github.com/QingWei-Li/docsify/issues/403)) ([278a75e](https://github.com/QingWei-Li/docsify/commit/278a75e))
### Features ### Features
* **fetch:** Add fallback languages configuration. ([#402](https://github.com/QingWei-Li/docsify/issues/402)) ([ecc0e04](https://github.com/QingWei-Li/docsify/commit/ecc0e04)) - **fetch:** Add fallback languages configuration. ([#402](https://github.com/QingWei-Li/docsify/issues/402)) ([ecc0e04](https://github.com/QingWei-Li/docsify/commit/ecc0e04))
<a name="4.6.3"></a> <a name="4.6.3"></a>
## [4.6.3](https://github.com/QingWei-Li/docsify/compare/v4.6.2...v4.6.3) (2018-02-15) ## [4.6.3](https://github.com/QingWei-Li/docsify/compare/v4.6.2...v4.6.3) (2018-02-15)
### Bug Fixes ### Bug Fixes
* **hook:** beforeEach don\'t work, fixed [#393](https://github.com/QingWei-Li/docsify/issues/393) ([6a09059](https://github.com/QingWei-Li/docsify/commit/6a09059)) - **hook:** beforeEach don\'t work, fixed [#393](https://github.com/QingWei-Li/docsify/issues/393) ([6a09059](https://github.com/QingWei-Li/docsify/commit/6a09059))
<a name="4.6.2"></a> <a name="4.6.2"></a>
## [4.6.2](https://github.com/QingWei-Li/docsify/compare/v4.6.1...v4.6.2) (2018-02-14)
## [4.6.2](https://github.com/QingWei-Li/docsify/compare/v4.6.1...v4.6.2) (2018-02-14)
### Bug Fixes ### Bug Fixes
* **embed:** broken in IE, fixed [#389](https://github.com/QingWei-Li/docsify/issues/389), fixed [#391](https://github.com/QingWei-Li/docsify/issues/391) ([45a7464](https://github.com/QingWei-Li/docsify/commit/45a7464)) - **embed:** broken in IE, fixed [#389](https://github.com/QingWei-Li/docsify/issues/389), fixed [#391](https://github.com/QingWei-Li/docsify/issues/391) ([45a7464](https://github.com/QingWei-Li/docsify/commit/45a7464))
* **embed:** init value ([890a7bf](https://github.com/QingWei-Li/docsify/commit/890a7bf)) - **embed:** init value ([890a7bf](https://github.com/QingWei-Li/docsify/commit/890a7bf))
<a name="4.6.1"></a> <a name="4.6.1"></a>
@@ -184,8 +188,8 @@
### Bug Fixes ### Bug Fixes
* **embed** compatible ssr ([dc0c3ce](https://github.com/QingWei-Li/docsify/commit/dc0c3ce)) - **embed** compatible ssr ([dc0c3ce](https://github.com/QingWei-Li/docsify/commit/dc0c3ce))
* **embed** async fetch embed files, fixed [#387](https://github.com/QingWei-Li/docsify/issues/387) - **embed** async fetch embed files, fixed [#387](https://github.com/QingWei-Li/docsify/issues/387)
<a name="4.6.0"></a> <a name="4.6.0"></a>
@@ -193,26 +197,26 @@
### Bug Fixes ### Bug Fixes
* **search:** custom clear button, fixed [#271](https://github.com/QingWei-Li/docsify/issues/271) ([864aa18](https://github.com/QingWei-Li/docsify/commit/864aa18)) - **search:** custom clear button, fixed [#271](https://github.com/QingWei-Li/docsify/issues/271) ([864aa18](https://github.com/QingWei-Li/docsify/commit/864aa18))
* **search:** escape special characters for search, fixed [#369](https://github.com/QingWei-Li/docsify/issues/369) ([9755439](https://github.com/QingWei-Li/docsify/commit/9755439)) - **search:** escape special characters for search, fixed [#369](https://github.com/QingWei-Li/docsify/issues/369) ([9755439](https://github.com/QingWei-Li/docsify/commit/9755439))
* build config ([342438f](https://github.com/QingWei-Li/docsify/commit/342438f)) - build config ([342438f](https://github.com/QingWei-Li/docsify/commit/342438f))
* button style for coverpage, fixed [#362](https://github.com/QingWei-Li/docsify/issues/362) ([85428ef](https://github.com/QingWei-Li/docsify/commit/85428ef)) - button style for coverpage, fixed [#362](https://github.com/QingWei-Li/docsify/issues/362) ([85428ef](https://github.com/QingWei-Li/docsify/commit/85428ef))
* dropdown scroll style, fixed [#346](https://github.com/QingWei-Li/docsify/issues/346) ([c4d83f2](https://github.com/QingWei-Li/docsify/commit/c4d83f2)) - dropdown scroll style, fixed [#346](https://github.com/QingWei-Li/docsify/issues/346) ([c4d83f2](https://github.com/QingWei-Li/docsify/commit/c4d83f2))
* highlight homepage link, fixed [#304](https://github.com/QingWei-Li/docsify/issues/304) ([f960c19](https://github.com/QingWei-Li/docsify/commit/f960c19)) - highlight homepage link, fixed [#304](https://github.com/QingWei-Li/docsify/issues/304) ([f960c19](https://github.com/QingWei-Li/docsify/commit/f960c19))
* homepage link ([e097f88](https://github.com/QingWei-Li/docsify/commit/e097f88)) - homepage link ([e097f88](https://github.com/QingWei-Li/docsify/commit/e097f88))
* onlyCover ([033be4f](https://github.com/QingWei-Li/docsify/commit/033be4f)) - onlyCover ([033be4f](https://github.com/QingWei-Li/docsify/commit/033be4f))
* ssr compatible embedd ([ebc10c4](https://github.com/QingWei-Li/docsify/commit/ebc10c4)) - ssr compatible embedd ([ebc10c4](https://github.com/QingWei-Li/docsify/commit/ebc10c4))
* ssr coverpage, fixed [#273](https://github.com/QingWei-Li/docsify/issues/273) ([9e824a4](https://github.com/QingWei-Li/docsify/commit/9e824a4)) - ssr coverpage, fixed [#273](https://github.com/QingWei-Li/docsify/issues/273) ([9e824a4](https://github.com/QingWei-Li/docsify/commit/9e824a4))
### Features ### Features
* click sidebar menu add collapse and expand, close [#294](https://github.com/QingWei-Li/docsify/issues/294) ([5e161a1](https://github.com/QingWei-Li/docsify/commit/5e161a1)) - click sidebar menu add collapse and expand, close [#294](https://github.com/QingWei-Li/docsify/issues/294) ([5e161a1](https://github.com/QingWei-Li/docsify/commit/5e161a1))
* **compiler:** support embedded file as code block, close [#134](https://github.com/QingWei-Li/docsify/issues/134) ([761ccc2](https://github.com/QingWei-Li/docsify/commit/761ccc2)) - **compiler:** support embedded file as code block, close [#134](https://github.com/QingWei-Li/docsify/issues/134) ([761ccc2](https://github.com/QingWei-Li/docsify/commit/761ccc2))
* **compiler:** support embedded markdown, html, video, etc files, close [#383](https://github.com/QingWei-Li/docsify/issues/383), close [#333](https://github.com/QingWei-Li/docsify/issues/333) ([524f52f](https://github.com/QingWei-Li/docsify/commit/524f52f)) - **compiler:** support embedded markdown, html, video, etc files, close [#383](https://github.com/QingWei-Li/docsify/issues/383), close [#333](https://github.com/QingWei-Li/docsify/issues/333) ([524f52f](https://github.com/QingWei-Li/docsify/commit/524f52f))
* **cover:** add onlyCover option, close [#382](https://github.com/QingWei-Li/docsify/issues/382) ([b265fdd](https://github.com/QingWei-Li/docsify/commit/b265fdd)) - **cover:** add onlyCover option, close [#382](https://github.com/QingWei-Li/docsify/issues/382) ([b265fdd](https://github.com/QingWei-Li/docsify/commit/b265fdd))
* **fetch:** add requestHeaders option, fixed [#336](https://github.com/QingWei-Li/docsify/issues/336) ([54ab4c9](https://github.com/QingWei-Li/docsify/commit/54ab4c9)) - **fetch:** add requestHeaders option, fixed [#336](https://github.com/QingWei-Li/docsify/issues/336) ([54ab4c9](https://github.com/QingWei-Li/docsify/commit/54ab4c9))
* **render:** add ext option for custom file extenstion, close [#340](https://github.com/QingWei-Li/docsify/issues/340) ([248aa72](https://github.com/QingWei-Li/docsify/commit/248aa72)) - **render:** add ext option for custom file extenstion, close [#340](https://github.com/QingWei-Li/docsify/issues/340) ([248aa72](https://github.com/QingWei-Li/docsify/commit/248aa72))
* **render:** mutilple coverpage, close [#315](https://github.com/QingWei-Li/docsify/issues/315) ([f68ddf5](https://github.com/QingWei-Li/docsify/commit/f68ddf5)) - **render:** mutilple coverpage, close [#315](https://github.com/QingWei-Li/docsify/issues/315) ([f68ddf5](https://github.com/QingWei-Li/docsify/commit/f68ddf5))
<a name="4.5.9"></a> <a name="4.5.9"></a>
@@ -220,7 +224,7 @@
### Bug Fixes ### Bug Fixes
* upgrade marked ([4157173](https://github.com/QingWei-Li/docsify/commit/4157173)) - upgrade marked ([4157173](https://github.com/QingWei-Li/docsify/commit/4157173))
<a name="4.5.8"></a> <a name="4.5.8"></a>
@@ -228,8 +232,8 @@
### Bug Fixes ### Bug Fixes
* cover style, fixed [#381](https://github.com/QingWei-Li/docsify/issues/381) ([368754e](https://github.com/QingWei-Li/docsify/commit/368754e)) - cover style, fixed [#381](https://github.com/QingWei-Li/docsify/issues/381) ([368754e](https://github.com/QingWei-Li/docsify/commit/368754e))
* updated deps ([#337](https://github.com/QingWei-Li/docsify/issues/337)) ([a12d393](https://github.com/QingWei-Li/docsify/commit/a12d393)) - updated deps ([#337](https://github.com/QingWei-Li/docsify/issues/337)) ([a12d393](https://github.com/QingWei-Li/docsify/commit/a12d393))
<a name="4.5.7"></a> <a name="4.5.7"></a>
@@ -237,7 +241,7 @@
### Features ### Features
* add navigation plugin, closed [#180](https://github.com/QingWei-Li/docsify/issues/180) ([f78be4c](https://github.com/QingWei-Li/docsify/commit/f78be4c)) - add navigation plugin, closed [#180](https://github.com/QingWei-Li/docsify/issues/180) ([f78be4c](https://github.com/QingWei-Li/docsify/commit/f78be4c))
<a name="4.5.6"></a> <a name="4.5.6"></a>
@@ -245,7 +249,7 @@
### Bug Fixes ### Bug Fixes
* **style:** increase the tap targets of menu button, fixed [#325](https://github.com/QingWei-Li/docsify/issues/325) ([888f217](https://github.com/QingWei-Li/docsify/commit/888f217)) - **style:** increase the tap targets of menu button, fixed [#325](https://github.com/QingWei-Li/docsify/issues/325) ([888f217](https://github.com/QingWei-Li/docsify/commit/888f217))
<a name="4.5.5"></a> <a name="4.5.5"></a>
@@ -253,7 +257,7 @@
### Bug Fixes ### Bug Fixes
* disqus plugin issue ([#318](https://github.com/QingWei-Li/docsify/issues/318)) ([041b33e](https://github.com/QingWei-Li/docsify/commit/041b33e)), closes [#317](https://github.com/QingWei-Li/docsify/issues/317) - disqus plugin issue ([#318](https://github.com/QingWei-Li/docsify/issues/318)) ([041b33e](https://github.com/QingWei-Li/docsify/commit/041b33e)), closes [#317](https://github.com/QingWei-Li/docsify/issues/317)
<a name="4.5.4"></a> <a name="4.5.4"></a>
@@ -261,11 +265,11 @@
### Bug Fixes ### Bug Fixes
* **compiler:** task lists style, fixed [#215](https://github.com/QingWei-Li/docsify/issues/215) ([e43ded4](https://github.com/QingWei-Li/docsify/commit/e43ded4)) - **compiler:** task lists style, fixed [#215](https://github.com/QingWei-Li/docsify/issues/215) ([e43ded4](https://github.com/QingWei-Li/docsify/commit/e43ded4))
### Features ### Features
* add gitalk plugin ([#306](https://github.com/QingWei-Li/docsify/issues/306)) ([9208e64](https://github.com/QingWei-Li/docsify/commit/9208e64)) - add gitalk plugin ([#306](https://github.com/QingWei-Li/docsify/issues/306)) ([9208e64](https://github.com/QingWei-Li/docsify/commit/9208e64))
<a name="4.5.3"></a> <a name="4.5.3"></a>
@@ -273,7 +277,7 @@
### Features ### Features
* add gitalk plugin ([#306](https://github.com/QingWei-Li/docsify/issues/306)) ([9208e64](https://github.com/QingWei-Li/docsify/commit/9208e64)) - add gitalk plugin ([#306](https://github.com/QingWei-Li/docsify/issues/306)) ([9208e64](https://github.com/QingWei-Li/docsify/commit/9208e64))
<a name="4.5.2"></a> <a name="4.5.2"></a>
@@ -281,7 +285,7 @@
### Features ### Features
* github task lists, close [#215](https://github.com/QingWei-Li/docsify/issues/215) ([#305](https://github.com/QingWei-Li/docsify/issues/305)) ([d486eef](https://github.com/QingWei-Li/docsify/commit/d486eef)) - github task lists, close [#215](https://github.com/QingWei-Li/docsify/issues/215) ([#305](https://github.com/QingWei-Li/docsify/issues/305)) ([d486eef](https://github.com/QingWei-Li/docsify/commit/d486eef))
<a name="4.5.1"></a> <a name="4.5.1"></a>
@@ -289,7 +293,7 @@
### Features ### Features
* fetch files with the query params, fixed [#303](https://github.com/QingWei-Li/docsify/issues/303) ([2a2ed96](https://github.com/QingWei-Li/docsify/commit/2a2ed96)) - fetch files with the query params, fixed [#303](https://github.com/QingWei-Li/docsify/issues/303) ([2a2ed96](https://github.com/QingWei-Li/docsify/commit/2a2ed96))
<a name="4.5.0"></a> <a name="4.5.0"></a>
@@ -297,7 +301,7 @@
### Features ### Features
* add disqus plugin, closed [#123](https://github.com/QingWei-Li/docsify/issues/123) ([fd7d4e0](https://github.com/QingWei-Li/docsify/commit/fd7d4e0)) - add disqus plugin, closed [#123](https://github.com/QingWei-Li/docsify/issues/123) ([fd7d4e0](https://github.com/QingWei-Li/docsify/commit/fd7d4e0))
<a name="4.4.1"></a> <a name="4.4.1"></a>
@@ -305,8 +309,8 @@
### Bug Fixes ### Bug Fixes
* {docsify-ignore-all} and {docsify-ignore} bug ([#299](https://github.com/QingWei-Li/docsify/issues/299)) ([cc98f56](https://github.com/QingWei-Li/docsify/commit/cc98f56)) - {docsify-ignore-all} and {docsify-ignore} bug ([#299](https://github.com/QingWei-Li/docsify/issues/299)) ([cc98f56](https://github.com/QingWei-Li/docsify/commit/cc98f56))
* zoom image plugin issue, fixed [#187](https://github.com/QingWei-Li/docsify/issues/187) ([#300](https://github.com/QingWei-Li/docsify/issues/300)) ([fa772cf](https://github.com/QingWei-Li/docsify/commit/fa772cf)) - zoom image plugin issue, fixed [#187](https://github.com/QingWei-Li/docsify/issues/187) ([#300](https://github.com/QingWei-Li/docsify/issues/300)) ([fa772cf](https://github.com/QingWei-Li/docsify/commit/fa772cf))
<a name="4.4.0"></a> <a name="4.4.0"></a>
@@ -314,11 +318,11 @@
### Bug Fixes ### Bug Fixes
* sidebar style issue on firefox, fixed [#184](https://github.com/QingWei-Li/docsify/issues/184) ([#297](https://github.com/QingWei-Li/docsify/issues/297)) ([36bfc9d](https://github.com/QingWei-Li/docsify/commit/36bfc9d)) - sidebar style issue on firefox, fixed [#184](https://github.com/QingWei-Li/docsify/issues/184) ([#297](https://github.com/QingWei-Li/docsify/issues/297)) ([36bfc9d](https://github.com/QingWei-Li/docsify/commit/36bfc9d))
### Features ### Features
* add helper for disabled link, fixed [#295](https://github.com/QingWei-Li/docsify/issues/295) ([#296](https://github.com/QingWei-Li/docsify/issues/296)) ([4ad96f3](https://github.com/QingWei-Li/docsify/commit/4ad96f3)) - add helper for disabled link, fixed [#295](https://github.com/QingWei-Li/docsify/issues/295) ([#296](https://github.com/QingWei-Li/docsify/issues/296)) ([4ad96f3](https://github.com/QingWei-Li/docsify/commit/4ad96f3))
<a name="4.3.15"></a> <a name="4.3.15"></a>
@@ -326,7 +330,7 @@
### Bug Fixes ### Bug Fixes
* scroll active sidebar ([a2b8eae](https://github.com/QingWei-Li/docsify/commit/a2b8eae)) - scroll active sidebar ([a2b8eae](https://github.com/QingWei-Li/docsify/commit/a2b8eae))
<a name="4.3.14"></a> <a name="4.3.14"></a>
@@ -334,7 +338,7 @@
### Bug Fixes ### Bug Fixes
* codesponsor style ([ab68268](https://github.com/QingWei-Li/docsify/commit/ab68268)) - codesponsor style ([ab68268](https://github.com/QingWei-Li/docsify/commit/ab68268))
<a name="4.3.13"></a> <a name="4.3.13"></a>
@@ -342,11 +346,11 @@
### Bug Fixes ### Bug Fixes
* duplicate results in search fixed [#257](https://github.com/QingWei-Li/docsify/issues/257) ([#284](https://github.com/QingWei-Li/docsify/issues/284)) ([3476f6f](https://github.com/QingWei-Li/docsify/commit/3476f6f)) - duplicate results in search fixed [#257](https://github.com/QingWei-Li/docsify/issues/257) ([#284](https://github.com/QingWei-Li/docsify/issues/284)) ([3476f6f](https://github.com/QingWei-Li/docsify/commit/3476f6f))
### Features ### Features
* make whole search result clickable ([#285](https://github.com/QingWei-Li/docsify/issues/285)) ([1b91227](https://github.com/QingWei-Li/docsify/commit/1b91227)) - make whole search result clickable ([#285](https://github.com/QingWei-Li/docsify/issues/285)) ([1b91227](https://github.com/QingWei-Li/docsify/commit/1b91227))
<a name="4.3.12"></a> <a name="4.3.12"></a>
@@ -354,7 +358,7 @@
### Bug Fixes ### Bug Fixes
* incorrect active link ([#281](https://github.com/QingWei-Li/docsify/issues/281)) ([a3ab379](https://github.com/QingWei-Li/docsify/commit/a3ab379)) - incorrect active link ([#281](https://github.com/QingWei-Li/docsify/issues/281)) ([a3ab379](https://github.com/QingWei-Li/docsify/commit/a3ab379))
<a name="4.3.11"></a> <a name="4.3.11"></a>
@@ -362,7 +366,7 @@
### Bug Fixes ### Bug Fixes
* broken links to same page heading, fix [#278](https://github.com/QingWei-Li/docsify/issues/278), fix [#279](https://github.com/QingWei-Li/docsify/issues/279) ([91d6337](https://github.com/QingWei-Li/docsify/commit/91d6337)) - broken links to same page heading, fix [#278](https://github.com/QingWei-Li/docsify/issues/278), fix [#279](https://github.com/QingWei-Li/docsify/issues/279) ([91d6337](https://github.com/QingWei-Li/docsify/commit/91d6337))
<a name="4.3.10"></a> <a name="4.3.10"></a>
@@ -370,7 +374,7 @@
### Bug Fixes ### Bug Fixes
* link render issue after page refreshing ([#276](https://github.com/QingWei-Li/docsify/issues/276)) ([abd885e](https://github.com/QingWei-Li/docsify/commit/abd885e)) - link render issue after page refreshing ([#276](https://github.com/QingWei-Li/docsify/issues/276)) ([abd885e](https://github.com/QingWei-Li/docsify/commit/abd885e))
<a name="4.3.9"></a> <a name="4.3.9"></a>
@@ -378,7 +382,7 @@
### Bug Fixes ### Bug Fixes
* scroll issue in IE ([#275](https://github.com/QingWei-Li/docsify/issues/275)) ([3e94cb6](https://github.com/QingWei-Li/docsify/commit/3e94cb6)) - scroll issue in IE ([#275](https://github.com/QingWei-Li/docsify/issues/275)) ([3e94cb6](https://github.com/QingWei-Li/docsify/commit/3e94cb6))
<a name="4.3.8"></a> <a name="4.3.8"></a>
@@ -386,7 +390,7 @@
### Bug Fixes ### Bug Fixes
* **slugify:** GitHub compatible heading links, fixed [#272](https://github.com/QingWei-Li/docsify/issues/272) ([9b4e666](https://github.com/QingWei-Li/docsify/commit/9b4e666)) - **slugify:** GitHub compatible heading links, fixed [#272](https://github.com/QingWei-Li/docsify/issues/272) ([9b4e666](https://github.com/QingWei-Li/docsify/commit/9b4e666))
<a name="4.3.7"></a> <a name="4.3.7"></a>
@@ -394,7 +398,7 @@
### Bug Fixes ### Bug Fixes
* **slugify:** GitHub compatible heading links, fixed [#267](https://github.com/QingWei-Li/docsify/issues/267) ([c195d2d](https://github.com/QingWei-Li/docsify/commit/c195d2d)) - **slugify:** GitHub compatible heading links, fixed [#267](https://github.com/QingWei-Li/docsify/issues/267) ([c195d2d](https://github.com/QingWei-Li/docsify/commit/c195d2d))
<a name="4.3.6"></a> <a name="4.3.6"></a>
@@ -402,7 +406,7 @@
### Bug Fixes ### Bug Fixes
* style for codesponsor plugin ([08afec7](https://github.com/QingWei-Li/docsify/commit/08afec7)) - style for codesponsor plugin ([08afec7](https://github.com/QingWei-Li/docsify/commit/08afec7))
<a name="4.3.5"></a> <a name="4.3.5"></a>
@@ -410,11 +414,11 @@
### Bug Fixes ### Bug Fixes
* missed symbol ([#254](https://github.com/QingWei-Li/docsify/issues/254)) ([6c702d3](https://github.com/QingWei-Li/docsify/commit/6c702d3)) - missed symbol ([#254](https://github.com/QingWei-Li/docsify/issues/254)) ([6c702d3](https://github.com/QingWei-Li/docsify/commit/6c702d3))
### Features ### Features
* **plugin:** add codesponsor plugin ([46ac4c3](https://github.com/QingWei-Li/docsify/commit/46ac4c3)) - **plugin:** add codesponsor plugin ([46ac4c3](https://github.com/QingWei-Li/docsify/commit/46ac4c3))
<a name="4.3.4"></a> <a name="4.3.4"></a>
@@ -422,7 +426,7 @@
### Bug Fixes ### Bug Fixes
* scroll position issue, fixed [#234](https://github.com/QingWei-Li/docsify/issues/234) ([388ed3d](https://github.com/QingWei-Li/docsify/commit/388ed3d)) - scroll position issue, fixed [#234](https://github.com/QingWei-Li/docsify/issues/234) ([388ed3d](https://github.com/QingWei-Li/docsify/commit/388ed3d))
<a name="4.3.3"></a> <a name="4.3.3"></a>
@@ -430,11 +434,11 @@
### Bug Fixes ### Bug Fixes
* **buble.css:** tweaks code block style, fixed [#249](https://github.com/QingWei-Li/docsify/issues/249) ([9d43051](https://github.com/QingWei-Li/docsify/commit/9d43051)) - **buble.css:** tweaks code block style, fixed [#249](https://github.com/QingWei-Li/docsify/issues/249) ([9d43051](https://github.com/QingWei-Li/docsify/commit/9d43051))
### Features ### Features
* add doc for react and vue demo box plugin ([#247](https://github.com/QingWei-Li/docsify/issues/247)) ([f0aca19](https://github.com/QingWei-Li/docsify/commit/f0aca19)) - add doc for react and vue demo box plugin ([#247](https://github.com/QingWei-Li/docsify/issues/247)) ([f0aca19](https://github.com/QingWei-Li/docsify/commit/f0aca19))
<a name="4.3.2"></a> <a name="4.3.2"></a>
@@ -442,11 +446,11 @@
### Bug Fixes ### Bug Fixes
* sidebar highlight ([f82f419](https://github.com/QingWei-Li/docsify/commit/f82f419)) - sidebar highlight ([f82f419](https://github.com/QingWei-Li/docsify/commit/f82f419))
### Features ### Features
* add Edit on github plugin (thanks [@njleonzhang](https://github.com/njleonzhang)) ([a0e1ea8](https://github.com/QingWei-Li/docsify/commit/a0e1ea8)) - add Edit on github plugin (thanks [@njleonzhang](https://github.com/njleonzhang)) ([a0e1ea8](https://github.com/QingWei-Li/docsify/commit/a0e1ea8))
<a name="4.3.1"></a> <a name="4.3.1"></a>
@@ -454,7 +458,7 @@
### Features ### Features
* **markdown:** supports mermaid [#137](https://github.com/QingWei-Li/docsify/issues/137) ([f4800e0](https://github.com/QingWei-Li/docsify/commit/f4800e0)) - **markdown:** supports mermaid [#137](https://github.com/QingWei-Li/docsify/issues/137) ([f4800e0](https://github.com/QingWei-Li/docsify/commit/f4800e0))
<a name="4.3.0"></a> <a name="4.3.0"></a>
@@ -462,7 +466,7 @@
### Features ### Features
* **markdown:** supports mermaid [#137](https://github.com/QingWei-Li/docsify/issues/137) ([f4800e0](https://github.com/QingWei-Li/docsify/commit/f4800e0)) - **markdown:** supports mermaid [#137](https://github.com/QingWei-Li/docsify/issues/137) ([f4800e0](https://github.com/QingWei-Li/docsify/commit/f4800e0))
<a name="4.2.9"></a> <a name="4.2.9"></a>
@@ -470,7 +474,7 @@
### Bug Fixes ### Bug Fixes
* ensure document ready before init Docsify [#233](https://github.com/QingWei-Li/docsify/issues/233) - ensure document ready before init Docsify [#233](https://github.com/QingWei-Li/docsify/issues/233)
<a name="4.2.8"></a> <a name="4.2.8"></a>
@@ -478,7 +482,7 @@
### Features ### Features
* **compiler:** support for setting target attribute for link, fixed [#230](https://github.com/QingWei-Li/docsify/issues/230) ([7f270f9](https://github.com/QingWei-Li/docsify/commit/7f270f9)) - **compiler:** support for setting target attribute for link, fixed [#230](https://github.com/QingWei-Li/docsify/issues/230) ([7f270f9](https://github.com/QingWei-Li/docsify/commit/7f270f9))
<a name="4.2.7"></a> <a name="4.2.7"></a>
@@ -486,8 +490,8 @@
### Bug Fixes ### Bug Fixes
* **release:** release shell ([628e211](https://github.com/QingWei-Li/docsify/commit/628e211)) - **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)) - **style:** nowrap => pre-wrap, fixed [#228](https://github.com/QingWei-Li/docsify/issues/228) ([a88252c](https://github.com/QingWei-Li/docsify/commit/a88252c))
<a name="4.2.6"></a> <a name="4.2.6"></a>
@@ -495,8 +499,8 @@
### Bug Fixes ### Bug Fixes
* **css:** hide the nav when the content has not yet been loaded ([1fa1619](https://github.com/QingWei-Li/docsify/commit/1fa1619)) - **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)) - **release:** release shell ([628e211](https://github.com/QingWei-Li/docsify/commit/628e211))
<a name="4.2.4"></a> <a name="4.2.4"></a>
@@ -504,7 +508,7 @@
### Bug Fixes ### Bug Fixes
* **render:** Remove getRootNode to be compatible with the lower version of Chrome, fixed [#225](https://github.com/QingWei-Li/docsify/issues/225) ([b8dd346](https://github.com/QingWei-Li/docsify/commit/b8dd346)) - **render:** Remove getRootNode to be compatible with the lower version of Chrome, fixed [#225](https://github.com/QingWei-Li/docsify/issues/225) ([b8dd346](https://github.com/QingWei-Li/docsify/commit/b8dd346))
<a name="4.2.3"></a> <a name="4.2.3"></a>
@@ -512,7 +516,7 @@
### Features ### Features
* **search:** Supports the max depth of the search headline, fixed [#223](https://github.com/QingWei-Li/docsify/issues/223), resolve [#129](https://github.com/QingWei-Li/docsify/issues/129) ([b7b589b](https://github.com/QingWei-Li/docsify/commit/b7b589b)) - **search:** Supports the max depth of the search headline, fixed [#223](https://github.com/QingWei-Li/docsify/issues/223), resolve [#129](https://github.com/QingWei-Li/docsify/issues/129) ([b7b589b](https://github.com/QingWei-Li/docsify/commit/b7b589b))
<a name="4.2.2"></a> <a name="4.2.2"></a>
@@ -520,14 +524,14 @@
### Bug Fixes ### Bug Fixes
* style rerender due to setting themeColor ([17ff3d1](https://github.com/QingWei-Li/docsify/commit/17ff3d1)) - style rerender due to setting themeColor ([17ff3d1](https://github.com/QingWei-Li/docsify/commit/17ff3d1))
<a name="4.2.1"></a> <a name="4.2.1"></a>
## [4.2.1](https://github.com/QingWei-Li/docsify/compare/v4.2.0...v4.2.1) (2017-07-19) ## [4.2.1](https://github.com/QingWei-Li/docsify/compare/v4.2.0...v4.2.1) (2017-07-19)
* give the navbar some line-height (#216) - give the navbar some line-height (#216)
* Remove unnecessary moduleName option from rollup config for plugins (#209) - Remove unnecessary moduleName option from rollup config for plugins (#209)
<a name="4.2.0"></a> <a name="4.2.0"></a>
@@ -535,12 +539,12 @@
### Bug Fixes ### Bug Fixes
* not found page ([9af8559](https://github.com/QingWei-Li/docsify/commit/9af8559)) - not found page ([9af8559](https://github.com/QingWei-Li/docsify/commit/9af8559))
### Features ### Features
* alias option supports regexp, resolve [#183](https://github.com/QingWei-Li/docsify/issues/183) ([c4aa22c](https://github.com/QingWei-Li/docsify/commit/c4aa22c)) - 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)) - ignore to compiled link, fixed [#203](https://github.com/QingWei-Li/docsify/issues/203) ([#204](https://github.com/QingWei-Li/docsify/issues/204)) ([2e00f4c](https://github.com/QingWei-Li/docsify/commit/2e00f4c))
<a name="4.1.14"></a> <a name="4.1.14"></a>
@@ -548,11 +552,11 @@
### Bug Fixes ### Bug Fixes
* get file path, fixed jrappen/sublime-distractionless/commit/81bfadd391428823191cc03eca956a2312e04d13#commitcomment-22427070 ([e8117e5](https://github.com/QingWei-Li/docsify/commit/e8117e5)), closes [jrappen/sublime-distractionless/commit/81bfadd391428823191cc03eca956a2312e04d13#commitcomment-22427070](https://github.com/jrappen/sublime-distractionless/commit/81bfadd391428823191cc03eca956a2312e04d13/issues/commitcomment-22427070) - get file path, fixed jrappen/sublime-distractionless/commit/81bfadd391428823191cc03eca956a2312e04d13#commitcomment-22427070 ([e8117e5](https://github.com/QingWei-Li/docsify/commit/e8117e5)), closes [jrappen/sublime-distractionless/commit/81bfadd391428823191cc03eca956a2312e04d13#commitcomment-22427070](https://github.com/jrappen/sublime-distractionless/commit/81bfadd391428823191cc03eca956a2312e04d13/issues/commitcomment-22427070)
### Features ### Features
* add context attribute, fixed [#191](https://github.com/QingWei-Li/docsify/issues/191) ([ce0e9ac](https://github.com/QingWei-Li/docsify/commit/ce0e9ac)) - add context attribute, fixed [#191](https://github.com/QingWei-Li/docsify/issues/191) ([ce0e9ac](https://github.com/QingWei-Li/docsify/commit/ce0e9ac))
<a name="4.1.13"></a> <a name="4.1.13"></a>
@@ -564,7 +568,7 @@
### Bug Fixes ### Bug Fixes
* **render:** subtitle in side bar shows undefined, fixed [#182](https://github.com/QingWei-Li/docsify/issues/182) ([d087d57](https://github.com/QingWei-Li/docsify/commit/d087d57)) - **render:** subtitle in side bar shows undefined, fixed [#182](https://github.com/QingWei-Li/docsify/issues/182) ([d087d57](https://github.com/QingWei-Li/docsify/commit/d087d57))
<a name="4.1.11"></a> <a name="4.1.11"></a>
@@ -572,8 +576,8 @@
### Bug Fixes ### 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)) - **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)) - **render:** autoHeader does not work ([1304d2e](https://github.com/QingWei-Li/docsify/commit/1304d2e))
<a name="4.1.10"></a> <a name="4.1.10"></a>
@@ -581,7 +585,7 @@
### Bug Fixes ### Bug Fixes
* **hash:** hash routing crashes when url has querystring ([6d48ce1](https://github.com/QingWei-Li/docsify/commit/6d48ce1)) - **hash:** hash routing crashes when url has querystring ([6d48ce1](https://github.com/QingWei-Li/docsify/commit/6d48ce1))
<a name="4.1.9"></a> <a name="4.1.9"></a>
@@ -589,9 +593,9 @@
### Bug Fixes ### Bug Fixes
* can't render toc on first load ([d9b487e](https://github.com/QingWei-Li/docsify/commit/d9b487e)) - 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)) - **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)) - **render:** broken name link, fixed [#167](https://github.com/QingWei-Li/docsify/issues/167) ([91b66a5](https://github.com/QingWei-Li/docsify/commit/91b66a5))
<a name="4.1.8"></a> <a name="4.1.8"></a>
@@ -599,13 +603,13 @@
### Bug Fixes ### Bug Fixes
* auto replace version ([22b50f0](https://github.com/QingWei-Li/docsify/commit/22b50f0)) - 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)) - update edit button demo ([ec887c1](https://github.com/QingWei-Li/docsify/commit/ec887c1))
### Features ### Features
* add edit button demo ([a64cee1](https://github.com/QingWei-Li/docsify/commit/a64cee1)) - 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)) - add edit button demo, close [#162](https://github.com/QingWei-Li/docsify/issues/162) ([036fdac](https://github.com/QingWei-Li/docsify/commit/036fdac))
<a name="4.1.7"></a> <a name="4.1.7"></a>
@@ -613,7 +617,7 @@
### Bug Fixes ### Bug Fixes
* **ssr:** clean files ([0014895](https://github.com/QingWei-Li/docsify/commit/0014895)) - **ssr:** clean files ([0014895](https://github.com/QingWei-Li/docsify/commit/0014895))
<a name="4.1.6"></a> <a name="4.1.6"></a>
@@ -621,7 +625,7 @@
### Bug Fixes ### Bug Fixes
* **ssr:** add debug ([6b9e092](https://github.com/QingWei-Li/docsify/commit/6b9e092)) - **ssr:** add debug ([6b9e092](https://github.com/QingWei-Li/docsify/commit/6b9e092))
<a name="4.1.5"></a> <a name="4.1.5"></a>
@@ -629,7 +633,7 @@
### Bug Fixes ### Bug Fixes
* **ssr:** missing package ([6db8c9e](https://github.com/QingWei-Li/docsify/commit/6db8c9e)) - **ssr:** missing package ([6db8c9e](https://github.com/QingWei-Li/docsify/commit/6db8c9e))
<a name="4.1.4"></a> <a name="4.1.4"></a>
@@ -637,7 +641,7 @@
### Bug Fixes ### Bug Fixes
* **ssr:** file path ([79a83bc](https://github.com/QingWei-Li/docsify/commit/79a83bc)) - **ssr:** file path ([79a83bc](https://github.com/QingWei-Li/docsify/commit/79a83bc))
<a name="4.1.3"></a> <a name="4.1.3"></a>
@@ -645,7 +649,7 @@
### Bug Fixes ### Bug Fixes
* update babel config ([9825db4](https://github.com/QingWei-Li/docsify/commit/9825db4)) - update babel config ([9825db4](https://github.com/QingWei-Li/docsify/commit/9825db4))
<a name="4.1.2"></a> <a name="4.1.2"></a>
@@ -653,7 +657,7 @@
### Bug Fixes ### Bug Fixes
* update babel config ([80dba19](https://github.com/QingWei-Li/docsify/commit/80dba19)) - update babel config ([80dba19](https://github.com/QingWei-Li/docsify/commit/80dba19))
<a name="4.1.1"></a> <a name="4.1.1"></a>
@@ -661,8 +665,8 @@
### Bug Fixes ### Bug Fixes
* build for ssr package ([4cb20a5](https://github.com/QingWei-Li/docsify/commit/4cb20a5)) - 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)) - remove history mode ([0e74e6c](https://github.com/QingWei-Li/docsify/commit/0e74e6c))
<a name="4.1.0"></a> <a name="4.1.0"></a>
@@ -674,7 +678,7 @@
### Bug Fixes ### Bug Fixes
* basePath for history mode ([fc1cd3f](https://github.com/QingWei-Li/docsify/commit/fc1cd3f)) - basePath for history mode ([fc1cd3f](https://github.com/QingWei-Li/docsify/commit/fc1cd3f))
<a name="4.0.1"></a> <a name="4.0.1"></a>
@@ -682,8 +686,8 @@
### Bug Fixes ### Bug Fixes
* **ssr:** remove context ([4626157](https://github.com/QingWei-Li/docsify/commit/4626157)) - **ssr:** remove context ([4626157](https://github.com/QingWei-Li/docsify/commit/4626157))
* lint ([b764b6e](https://github.com/QingWei-Li/docsify/commit/b764b6e)) - lint ([b764b6e](https://github.com/QingWei-Li/docsify/commit/b764b6e))
<a name="4.0.0"></a> <a name="4.0.0"></a>
@@ -691,11 +695,11 @@
### Bug Fixes ### Bug Fixes
* **render:** init event in ssr ([eba1c98](https://github.com/QingWei-Li/docsify/commit/eba1c98)) - **render:** init event in ssr ([eba1c98](https://github.com/QingWei-Li/docsify/commit/eba1c98))
* lint ([1f4514d](https://github.com/QingWei-Li/docsify/commit/1f4514d)) - lint ([1f4514d](https://github.com/QingWei-Li/docsify/commit/1f4514d))
### Features ### Features
* finish ssr ([3444884](https://github.com/QingWei-Li/docsify/commit/3444884)) - finish ssr ([3444884](https://github.com/QingWei-Li/docsify/commit/3444884))
* init ocsify-server-renderer ([6dea685](https://github.com/QingWei-Li/docsify/commit/6dea685)) - 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)) - support history mode ([f095eb8](https://github.com/QingWei-Li/docsify/commit/f095eb8))
+3 -1
View File
@@ -46,7 +46,9 @@
## Quick start ## Quick start
Look at [this tutorial](https://docsify.js.org/#/quickstart) or [online demo](https://jsfiddle.net/7ztb8qsr/1/). Look at [this tutorial](https://docsify.js.org/#/quickstart)
[![Edit 307qqv236](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/s/307qqv236)
## Showcase ## Showcase
+1 -1
View File
@@ -1,6 +1,6 @@
![logo](_media/icon.svg) ![logo](_media/icon.svg)
# docsify <small>4.8.2</small> # docsify <small>4.8.6</small>
> A magical documentation site generator. > A magical documentation site generator.
+43
View File
@@ -88,6 +88,7 @@ You will get `<a href="/demo/">link</a>`html. Do not worry, you can still set ti
![logo](https://docsify.js.org/_media/icon.svg ':size=100') ![logo](https://docsify.js.org/_media/icon.svg ':size=100')
<!-- Support percentage --> <!-- Support percentage -->
![logo](https://docsify.js.org/_media/icon.svg ':size=10%') ![logo](https://docsify.js.org/_media/icon.svg ':size=10%')
``` ```
@@ -100,3 +101,45 @@ You will get `<a href="/demo/">link</a>`html. Do not worry, you can still set ti
```md ```md
### 你好,世界! :id=hello-world ### 你好,世界! :id=hello-world
``` ```
## Markdown in html tag
You need to insert a space between the html and markdown content.
This is useful for rendering markdown content in the details element.
```markdown
<details>
<summary>Self-assessment (Click to expand)</summary>
- Abc
- Abc
</details>
```
<details>
<summary>Self-assessment (Click to expand)</summary>
- Abc
- Abc
</details>
Or markdown content can be wrapped in html tag.
```markdown
<div style='color: red'>
- listitem
- listitem
- listitem
</div>
```
<div style='color: red'>
- Abc
- Abc
</div>
+2 -1
View File
@@ -36,6 +36,7 @@ window.$docsify = {
// <link rel="stylesheet" href="//cdn.jsdelivr.net/npm/mermaid/dist/mermaid.min.css"> // <link rel="stylesheet" href="//cdn.jsdelivr.net/npm/mermaid/dist/mermaid.min.css">
// <script src="//cdn.jsdelivr.net/npm/mermaid/dist/mermaid.min.js"></script> // <script src="//cdn.jsdelivr.net/npm/mermaid/dist/mermaid.min.js"></script>
var num = 0;
mermaid.initialize({ startOnLoad: false }); mermaid.initialize({ startOnLoad: false });
window.$docsify = { window.$docsify = {
@@ -44,7 +45,7 @@ window.$docsify = {
code: function(code, lang) { code: function(code, lang) {
if (lang === "mermaid") { if (lang === "mermaid") {
return ( return (
'<div class="mermaid">' + mermaid.render(lang, code) + "</div>" '<div class="mermaid">' + mermaid.render('mermaid-svg-' + num++, code) + "</div>"
); );
} }
return this.origin.code.apply(this, arguments); return this.origin.code.apply(this, arguments);
+10 -2
View File
@@ -40,6 +40,10 @@ By default, the hyperlink on the current page is recognized and the content is s
depth: 2, depth: 2,
hideOtherSidebarContent: false, // whether or not to hide other sidebar content hideOtherSidebarContent: false, // whether or not to hide other sidebar content
// To avoid search index collision
// between multiple websites under the same domain
namespace: 'website-1',
} }
} }
</script> </script>
@@ -95,7 +99,7 @@ Medium's image zoom. Based on [medium-zoom](https://github.com/francoischalifour
Exclude the special image Exclude the special image
```markdown ```markdown
![](image.png ':no-zoom') ![](image.png ":no-zoom")
``` ```
## Edit on github ## Edit on github
@@ -184,6 +188,10 @@ window.$docsify = {
A docsify.js plugin for displaying tabbed content from markdown. A docsify.js plugin for displaying tabbed content from markdown.
* [Documentation & Demos](https://jhildenbiddle.github.io/docsify-tabs) - [Documentation & Demos](https://jhildenbiddle.github.io/docsify-tabs)
Provided by [@jhildenbiddle](https://github.com/jhildenbiddle/docsify-tabs). Provided by [@jhildenbiddle](https://github.com/jhildenbiddle/docsify-tabs).
## More plugins
See [awesome-docsify](awesome?id=plugins)
+64 -46
View File
@@ -6,41 +6,41 @@ A plugin is simply a function that takes `hook` as an argument. The hook support
```js ```js
window.$docsify = { window.$docsify = {
plugins: [ plugins: [
function (hook, vm) { function(hook, vm) {
hook.init(function() { hook.init(function() {
// Called when the script starts running, only trigger once, no arguments, // Called when the script starts running, only trigger once, no arguments,
}) });
hook.beforeEach(function(content) { hook.beforeEach(function(content) {
// Invoked each time before parsing the Markdown file. // Invoked each time before parsing the Markdown file.
// ... // ...
return content return content;
}) });
hook.afterEach(function(html, next) { hook.afterEach(function(html, next) {
// Invoked each time after the Markdown file is parsed. // Invoked each time after the Markdown file is parsed.
// beforeEach and afterEach support asynchronous。 // beforeEach and afterEach support asynchronous。
// ... // ...
// call `next(html)` when task is done. // call `next(html)` when task is done.
next(html) next(html);
}) });
hook.doneEach(function() { hook.doneEach(function() {
// Invoked each time after the data is fully loaded, no arguments, // Invoked each time after the data is fully loaded, no arguments,
// ... // ...
}) });
hook.mounted(function() { hook.mounted(function() {
// Called after initial completion. Only trigger once, no arguments. // Called after initial completion. Only trigger once, no arguments.
}) });
hook.ready(function() { hook.ready(function() {
// Called after initial completion, no arguments. // Called after initial completion, no arguments.
}) });
} }
] ]
} };
``` ```
!> You can get internal methods through `window.Docsify`. Get the current instance through the second argument. !> You can get internal methods through `window.Docsify`. Get the current instance through the second argument.
@@ -54,21 +54,21 @@ Add footer component in each pages.
```js ```js
window.$docsify = { window.$docsify = {
plugins: [ plugins: [
function (hook) { function(hook) {
var footer = [ var footer = [
'<hr/>', '<hr/>',
'<footer>', '<footer>',
'<span><a href="https://github.com/QingWei-Li">cinwell</a> &copy;2017.</span>', '<span><a href="https://github.com/QingWei-Li">cinwell</a> &copy;2017.</span>',
'<span>Proudly published with <a href="https://github.com/docsifyjs/docsify" target="_blank">docsify</a>.</span>', '<span>Proudly published with <a href="https://github.com/docsifyjs/docsify" target="_blank">docsify</a>.</span>',
'</footer>' '</footer>'
].join('') ].join('');
hook.afterEach(function (html) { hook.afterEach(function(html) {
return html + footer return html + footer;
}) });
} }
] ]
} };
``` ```
### Edit Button ### Edit Button
@@ -77,17 +77,35 @@ window.$docsify = {
window.$docsify = { window.$docsify = {
plugins: [ plugins: [
function(hook, vm) { function(hook, vm) {
hook.beforeEach(function (html) { hook.beforeEach(function(html) {
var url = 'https://github.com/docsifyjs/docsify/blob/master/docs' + vm.route.file var url =
var editHtml = '[📝 EDIT DOCUMENT](' + url + ')\n' 'https://github.com/docsifyjs/docsify/blob/master/docs' +
vm.route.file;
var editHtml = '[📝 EDIT DOCUMENT](' + url + ')\n';
return editHtml return (
+ html editHtml +
+ '\n----\n' html +
+ 'Last modified {docsify-updated} ' '\n----\n' +
+ editHtml 'Last modified {docsify-updated} ' +
}) editHtml
);
});
} }
] ]
} };
``` ```
## Tips
### Get docsify version
```
console.log(window.Docsify.version)
```
Current version: <span id='tip-version'>loading</span>
<script>
document.getElementById('tip-version').innerText = Docsify.version
</script>
+390 -186
View File
@@ -608,7 +608,7 @@ function createCommonjsModule(fn, module) {
var marked = createCommonjsModule(function (module, exports) { var marked = createCommonjsModule(function (module, exports) {
/** /**
* marked - a markdown parser * marked - a markdown parser
* Copyright (c) 2011-2014, Christopher Jeffrey. (MIT Licensed) * Copyright (c) 2011-2018, Christopher Jeffrey. (MIT Licensed)
* https://github.com/markedjs/marked * https://github.com/markedjs/marked
*/ */
@@ -618,20 +618,29 @@ var block = {
code: /^( {4}[^\n]+\n*)+/, code: /^( {4}[^\n]+\n*)+/,
fences: noop, fences: noop,
hr: /^ {0,3}((?:- *){3,}|(?:_ *){3,}|(?:\* *){3,})(?:\n+|$)/, hr: /^ {0,3}((?:- *){3,}|(?:_ *){3,}|(?:\* *){3,})(?:\n+|$)/,
heading: /^ *(#{1,6}) *([^\n]+?) *#* *(?:\n+|$)/, heading: /^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/,
nptable: noop, nptable: noop,
blockquote: /^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/, blockquote: /^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,
list: /^( *)(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?!\1bull )\n*|\s*$)/, list: /^( *)(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,
html: /^ *(?:comment *(?:\n|\s*$)|closed *(?:\n{2,}|\s*$)|closing *(?:\n{2,}|\s*$))/, html: '^ {0,3}(?:' // optional indentation
+ '<(script|pre|style)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)' // (1)
+ '|comment[^\\n]*(\\n+|$)' // (2)
+ '|<\\?[\\s\\S]*?\\?>\\n*' // (3)
+ '|<![A-Z][\\s\\S]*?>\\n*' // (4)
+ '|<!\\[CDATA\\[[\\s\\S]*?\\]\\]>\\n*' // (5)
+ '|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:\\n{2,}|$)' // (6)
+ '|<(?!script|pre|style)([a-z][\\w-]*)(?:attribute)*? */?>(?=\\h*\\n)[\\s\\S]*?(?:\\n{2,}|$)' // (7) open tag
+ '|</(?!script|pre|style)[a-z][\\w-]*\\s*>(?=\\h*\\n)[\\s\\S]*?(?:\\n{2,}|$)' // (7) closing tag
+ ')',
def: /^ {0,3}\[(label)\]: *\n? *<?([^\s>]+)>?(?:(?: +\n? *| *\n *)(title))? *(?:\n+|$)/, def: /^ {0,3}\[(label)\]: *\n? *<?([^\s>]+)>?(?:(?: +\n? *| *\n *)(title))? *(?:\n+|$)/,
table: noop, table: noop,
lheading: /^([^\n]+)\n *(=|-){2,} *(?:\n+|$)/, lheading: /^([^\n]+)\n *(=|-){2,} *(?:\n+|$)/,
paragraph: /^([^\n]+(?:\n?(?!hr|heading|lheading| {0,3}>|tag)[^\n]+)+)/, paragraph: /^([^\n]+(?:\n(?!hr|heading|lheading| {0,3}>|<\/?(?:tag)(?: +|\n|\/?>)|<(?:script|pre|style|!--))[^\n]+)*)/,
text: /^[^\n]+/ text: /^[^\n]+/
}; };
block._label = /(?:\\[\[\]]|[^\[\]])+/; block._label = /(?!\s*\])(?:\\[\[\]]|[^\[\]])+/;
block._title = /(?:"(?:\\"|[^"]|"[^"\n]*")*"|'\n?(?:[^'\n]+\n?)*'|\([^()]*\))/; block._title = /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/;
block.def = edit(block.def) block.def = edit(block.def)
.replace('label', block._label) .replace('label', block._label)
.replace('title', block._title) .replace('title', block._title)
@@ -649,23 +658,24 @@ block.list = edit(block.list)
.replace('def', '\\n+(?=' + block.def.source + ')') .replace('def', '\\n+(?=' + block.def.source + ')')
.getRegex(); .getRegex();
block._tag = '(?!(?:' block._tag = 'address|article|aside|base|basefont|blockquote|body|caption'
+ 'a|em|strong|small|s|cite|q|dfn|abbr|data|time|code' + '|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption'
+ '|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo' + '|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe'
+ '|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b'; + '|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option'
+ '|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr'
block.html = edit(block.html) + '|track|ul';
.replace('comment', /<!--[\s\S]*?-->/) block._comment = /<!--(?!-?>)[\s\S]*?-->/;
.replace('closed', /<(tag)[\s\S]+?<\/\1>/) block.html = edit(block.html, 'i')
.replace('closing', /<tag(?:"[^"]*"|'[^']*'|\s[^'"\/>\s]*)*?\/?>/) .replace('comment', block._comment)
.replace(/tag/g, block._tag) .replace('tag', block._tag)
.replace('attribute', / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/)
.getRegex(); .getRegex();
block.paragraph = edit(block.paragraph) block.paragraph = edit(block.paragraph)
.replace('hr', block.hr) .replace('hr', block.hr)
.replace('heading', block.heading) .replace('heading', block.heading)
.replace('lheading', block.lheading) .replace('lheading', block.lheading)
.replace('tag', '<' + block._tag) .replace('tag', block._tag) // pars can be interrupted by type (6) html blocks
.getRegex(); .getRegex();
block.blockquote = edit(block.blockquote) block.blockquote = edit(block.blockquote)
@@ -699,8 +709,26 @@ block.gfm.paragraph = edit(block.paragraph)
*/ */
block.tables = merge({}, block.gfm, { block.tables = merge({}, block.gfm, {
nptable: /^ *(\S.*\|.*)\n *([-:]+ *\|[-| :]*)\n((?:.*\|.*(?:\n|$))*)\n*/, nptable: /^ *([^|\n ].*\|.*)\n *([-:]+ *\|[-| :]*)(?:\n((?:.*[^>\n ].*(?:\n|$))*)\n*|$)/,
table: /^ *\|(.+)\n *\|( *[-:]+[-| :]*)\n((?: *\|.*(?:\n|$))*)\n*/ table: /^ *\|(.+)\n *\|?( *[-:]+[-| :]*)(?:\n((?: *[^>\n ].*(?:\n|$))*)\n*|$)/
});
/**
* Pedantic grammar
*/
block.pedantic = merge({}, block.normal, {
html: edit(
'^ *(?:comment *(?:\\n|\\s*$)'
+ '|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)' // closed tag
+ '|<tag(?:"[^"]*"|\'[^\']*\'|\\s[^\'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))')
.replace('comment', block._comment)
.replace(/tag/g, '(?!(?:'
+ 'a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub'
+ '|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)'
+ '\\b)\\w+(?!:|[^\\w\\s@]*@)\\b')
.getRegex(),
def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/
}); });
/** /**
@@ -709,11 +737,13 @@ block.tables = merge({}, block.gfm, {
function Lexer(options) { function Lexer(options) {
this.tokens = []; this.tokens = [];
this.tokens.links = {}; this.tokens.links = Object.create(null);
this.options = options || marked.defaults; this.options = options || marked.defaults;
this.rules = block.normal; this.rules = block.normal;
if (this.options.gfm) { if (this.options.pedantic) {
this.rules = block.pedantic;
} else if (this.options.gfm) {
if (this.options.tables) { if (this.options.tables) {
this.rules = block.tables; this.rules = block.tables;
} else { } else {
@@ -765,11 +795,16 @@ Lexer.prototype.token = function(src, top) {
bull, bull,
b, b,
item, item,
listStart,
listItems,
t,
space, space,
i, i,
tag, tag,
l, l,
isordered; isordered,
istask,
ischecked;
while (src) { while (src) {
// newline // newline
@@ -789,7 +824,7 @@ Lexer.prototype.token = function(src, top) {
this$1.tokens.push({ this$1.tokens.push({
type: 'code', type: 'code',
text: !this$1.options.pedantic text: !this$1.options.pedantic
? cap.replace(/\n+$/, '') ? rtrim(cap, '\n')
: cap : cap
}); });
continue; continue;
@@ -819,34 +854,36 @@ Lexer.prototype.token = function(src, top) {
// table no leading pipe (gfm) // table no leading pipe (gfm)
if (top && (cap = this$1.rules.nptable.exec(src))) { if (top && (cap = this$1.rules.nptable.exec(src))) {
src = src.substring(cap[0].length);
item = { item = {
type: 'table', type: 'table',
header: cap[1].replace(/^ *| *\| *$/g, '').split(/ *\| */), header: splitCells(cap[1].replace(/^ *| *\| *$/g, '')),
align: cap[2].replace(/^ *|\| *$/g, '').split(/ *\| */), align: cap[2].replace(/^ *|\| *$/g, '').split(/ *\| */),
cells: cap[3].replace(/\n$/, '').split('\n') cells: cap[3] ? cap[3].replace(/\n$/, '').split('\n') : []
}; };
for (i = 0; i < item.align.length; i++) { if (item.header.length === item.align.length) {
if (/^ *-+: *$/.test(item.align[i])) { src = src.substring(cap[0].length);
item.align[i] = 'right';
} else if (/^ *:-+: *$/.test(item.align[i])) { for (i = 0; i < item.align.length; i++) {
item.align[i] = 'center'; if (/^ *-+: *$/.test(item.align[i])) {
} else if (/^ *:-+ *$/.test(item.align[i])) { item.align[i] = 'right';
item.align[i] = 'left'; } else if (/^ *:-+: *$/.test(item.align[i])) {
} else { item.align[i] = 'center';
item.align[i] = null; } else if (/^ *:-+ *$/.test(item.align[i])) {
item.align[i] = 'left';
} else {
item.align[i] = null;
}
} }
for (i = 0; i < item.cells.length; i++) {
item.cells[i] = splitCells(item.cells[i], item.header.length);
}
this$1.tokens.push(item);
continue;
} }
for (i = 0; i < item.cells.length; i++) {
item.cells[i] = item.cells[i].split(/ *\| */);
}
this$1.tokens.push(item);
continue;
} }
// hr // hr
@@ -886,15 +923,19 @@ Lexer.prototype.token = function(src, top) {
bull = cap[2]; bull = cap[2];
isordered = bull.length > 1; isordered = bull.length > 1;
this$1.tokens.push({ listStart = {
type: 'list_start', type: 'list_start',
ordered: isordered, ordered: isordered,
start: isordered ? +bull : '' start: isordered ? +bull : '',
}); loose: false
};
this$1.tokens.push(listStart);
// Get each top-level item. // Get each top-level item.
cap = cap[0].match(this$1.rules.item); cap = cap[0].match(this$1.rules.item);
listItems = [];
next = false; next = false;
l = cap.length; l = cap.length;
i = 0; i = 0;
@@ -935,11 +976,27 @@ Lexer.prototype.token = function(src, top) {
if (!loose) { loose = next; } if (!loose) { loose = next; }
} }
this$1.tokens.push({ if (loose) {
type: loose listStart.loose = true;
? 'loose_item_start' }
: 'list_item_start'
}); // Check for task list items
istask = /^\[[ xX]\] /.test(item);
ischecked = undefined;
if (istask) {
ischecked = item[1] !== ' ';
item = item.replace(/^\[[ xX]\] +/, '');
}
t = {
type: 'list_item_start',
task: istask,
checked: ischecked,
loose: loose
};
listItems.push(t);
this$1.tokens.push(t);
// Recurse. // Recurse.
this$1.token(item, false); this$1.token(item, false);
@@ -949,6 +1006,14 @@ Lexer.prototype.token = function(src, top) {
}); });
} }
if (listStart.loose) {
l = listItems.length;
i = 0;
for (; i < l; i++) {
listItems[i].loose = true;
}
}
this$1.tokens.push({ this$1.tokens.push({
type: 'list_end' type: 'list_end'
}); });
@@ -974,7 +1039,7 @@ Lexer.prototype.token = function(src, top) {
if (top && (cap = this$1.rules.def.exec(src))) { if (top && (cap = this$1.rules.def.exec(src))) {
src = src.substring(cap[0].length); src = src.substring(cap[0].length);
if (cap[3]) { cap[3] = cap[3].substring(1, cap[3].length - 1); } if (cap[3]) { cap[3] = cap[3].substring(1, cap[3].length - 1); }
tag = cap[1].toLowerCase(); tag = cap[1].toLowerCase().replace(/\s+/g, ' ');
if (!this$1.tokens.links[tag]) { if (!this$1.tokens.links[tag]) {
this$1.tokens.links[tag] = { this$1.tokens.links[tag] = {
href: cap[2], href: cap[2],
@@ -986,36 +1051,38 @@ Lexer.prototype.token = function(src, top) {
// table (gfm) // table (gfm)
if (top && (cap = this$1.rules.table.exec(src))) { if (top && (cap = this$1.rules.table.exec(src))) {
src = src.substring(cap[0].length);
item = { item = {
type: 'table', type: 'table',
header: cap[1].replace(/^ *| *\| *$/g, '').split(/ *\| */), header: splitCells(cap[1].replace(/^ *| *\| *$/g, '')),
align: cap[2].replace(/^ *|\| *$/g, '').split(/ *\| */), align: cap[2].replace(/^ *|\| *$/g, '').split(/ *\| */),
cells: cap[3].replace(/(?: *\| *)?\n$/, '').split('\n') cells: cap[3] ? cap[3].replace(/(?: *\| *)?\n$/, '').split('\n') : []
}; };
for (i = 0; i < item.align.length; i++) { if (item.header.length === item.align.length) {
if (/^ *-+: *$/.test(item.align[i])) { src = src.substring(cap[0].length);
item.align[i] = 'right';
} else if (/^ *:-+: *$/.test(item.align[i])) { for (i = 0; i < item.align.length; i++) {
item.align[i] = 'center'; if (/^ *-+: *$/.test(item.align[i])) {
} else if (/^ *:-+ *$/.test(item.align[i])) { item.align[i] = 'right';
item.align[i] = 'left'; } else if (/^ *:-+: *$/.test(item.align[i])) {
} else { item.align[i] = 'center';
item.align[i] = null; } else if (/^ *:-+ *$/.test(item.align[i])) {
item.align[i] = 'left';
} else {
item.align[i] = null;
}
} }
for (i = 0; i < item.cells.length; i++) {
item.cells[i] = splitCells(
item.cells[i].replace(/^ *\| *| *\| *$/g, ''),
item.header.length);
}
this$1.tokens.push(item);
continue;
} }
for (i = 0; i < item.cells.length; i++) {
item.cells[i] = item.cells[i]
.replace(/^ *\| *| *\| *$/g, '')
.split(/ *\| */);
}
this$1.tokens.push(item);
continue;
} }
// lheading // lheading
@@ -1065,39 +1132,54 @@ Lexer.prototype.token = function(src, top) {
*/ */
var inline = { var inline = {
escape: /^\\([\\`*{}\[\]()#+\-.!_>])/, escape: /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,
autolink: /^<(scheme:[^\s\x00-\x1f<>]*|email)>/, autolink: /^<(scheme:[^\s\x00-\x1f<>]*|email)>/,
url: noop, url: noop,
tag: /^<!--[\s\S]*?-->|^<\/?[a-zA-Z0-9\-]+(?:"[^"]*"|'[^']*'|\s[^<'">\/\s]*)*?\/?>/, tag: '^comment'
link: /^!?\[(inside)\]\(href\)/, + '|^</[a-zA-Z][\\w:-]*\\s*>' // self-closing tag
reflink: /^!?\[(inside)\]\s*\[([^\]]*)\]/, + '|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>' // open tag
nolink: /^!?\[((?:\[[^\[\]]*\]|\\[\[\]]|[^\[\]])*)\]/, + '|^<\\?[\\s\\S]*?\\?>' // processing instruction, e.g. <?php ?>
strong: /^__([\s\S]+?)__(?!_)|^\*\*([\s\S]+?)\*\*(?!\*)/, + '|^<![a-zA-Z]+\\s[\\s\\S]*?>' // declaration, e.g. <!DOCTYPE html>
em: /^_([^\s_](?:[^_]|__)+?[^\s_])_\b|^\*((?:\*\*|[^*])+?)\*(?!\*)/, + '|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>', // CDATA section
code: /^(`+)\s*([\s\S]*?[^`]?)\s*\1(?!`)/, link: /^!?\[(label)\]\(href(?:\s+(title))?\s*\)/,
br: /^ {2,}\n(?!\s*$)/, reflink: /^!?\[(label)\]\[(?!\s*\])((?:\\[\[\]]?|[^\[\]\\])+)\]/,
nolink: /^!?\[(?!\s*\])((?:\[[^\[\]]*\]|\\[\[\]]|[^\[\]])*)\](?:\[\])?/,
strong: /^__([^\s])__(?!_)|^\*\*([^\s])\*\*(?!\*)|^__([^\s][\s\S]*?[^\s])__(?!_)|^\*\*([^\s][\s\S]*?[^\s])\*\*(?!\*)/,
em: /^_([^\s_])_(?!_)|^\*([^\s*"<\[])\*(?!\*)|^_([^\s][\s\S]*?[^\s_])_(?!_)|^_([^\s_][\s\S]*?[^\s])_(?!_)|^\*([^\s"<\[][\s\S]*?[^\s*])\*(?!\*)|^\*([^\s*"<\[][\s\S]*?[^\s])\*(?!\*)/,
code: /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,
br: /^( {2,}|\\)\n(?!\s*$)/,
del: noop, del: noop,
text: /^[\s\S]+?(?=[\\<!\[`*]|\b_| {2,}\n|$)/ text: /^(`+|[^`])[\s\S]*?(?=[\\<!\[`*]|\b_| {2,}\n|$)/
}; };
inline._escapes = /\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g;
inline._scheme = /[a-zA-Z][a-zA-Z0-9+.-]{1,31}/; inline._scheme = /[a-zA-Z][a-zA-Z0-9+.-]{1,31}/;
inline._email = /[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/; inline._email = /[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/;
inline.autolink = edit(inline.autolink) inline.autolink = edit(inline.autolink)
.replace('scheme', inline._scheme) .replace('scheme', inline._scheme)
.replace('email', inline._email) .replace('email', inline._email)
.getRegex(); .getRegex();
inline._inside = /(?:\[[^\[\]]*\]|\\[\[\]]|[^\[\]]|\](?=[^\[]*\]))*/; inline._attribute = /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/;
inline._href = /\s*<?([\s\S]*?)>?(?:\s+['"]([\s\S]*?)['"])?\s*/;
inline.tag = edit(inline.tag)
.replace('comment', block._comment)
.replace('attribute', inline._attribute)
.getRegex();
inline._label = /(?:\[[^\[\]]*\]|\\[\[\]]?|`[^`]*`|[^\[\]\\])*?/;
inline._href = /\s*(<(?:\\[<>]?|[^\s<>\\])*>|(?:\\[()]?|\([^\s\x00-\x1f\\]*\)|[^\s\x00-\x1f()\\])*?)/;
inline._title = /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/;
inline.link = edit(inline.link) inline.link = edit(inline.link)
.replace('inside', inline._inside) .replace('label', inline._label)
.replace('href', inline._href) .replace('href', inline._href)
.replace('title', inline._title)
.getRegex(); .getRegex();
inline.reflink = edit(inline.reflink) inline.reflink = edit(inline.reflink)
.replace('inside', inline._inside) .replace('label', inline._label)
.getRegex(); .getRegex();
/** /**
@@ -1112,7 +1194,13 @@ inline.normal = merge({}, inline);
inline.pedantic = merge({}, inline.normal, { inline.pedantic = merge({}, inline.normal, {
strong: /^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/, strong: /^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,
em: /^_(?=\S)([\s\S]*?\S)_(?!_)|^\*(?=\S)([\s\S]*?\S)\*(?!\*)/ em: /^_(?=\S)([\s\S]*?\S)_(?!_)|^\*(?=\S)([\s\S]*?\S)\*(?!\*)/,
link: edit(/^!?\[(label)\]\((.*?)\)/)
.replace('label', inline._label)
.getRegex(),
reflink: edit(/^!?\[(label)\]\s*\[([^\]]*)\]/)
.replace('label', inline._label)
.getRegex()
}); });
/** /**
@@ -1121,17 +1209,19 @@ inline.pedantic = merge({}, inline.normal, {
inline.gfm = merge({}, inline.normal, { inline.gfm = merge({}, inline.normal, {
escape: edit(inline.escape).replace('])', '~|])').getRegex(), escape: edit(inline.escape).replace('])', '~|])').getRegex(),
url: edit(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/) _extended_email: /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,
.replace('email', inline._email) url: /^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,
.getRegex(),
_backpedal: /(?:[^?!.,:;*_~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_~)]+(?!$))+/, _backpedal: /(?:[^?!.,:;*_~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_~)]+(?!$))+/,
del: /^~~(?=\S)([\s\S]*?\S)~~/, del: /^~+(?=\S)([\s\S]*?\S)~+/,
text: edit(inline.text) text: edit(inline.text)
.replace(']|', '~]|') .replace(']|', '~]|')
.replace('|', '|https?://|ftp://|www\\.|[a-zA-Z0-9.!#$%&\'*+/=?^_`{\\|}~-]+@|') .replace('|$', '|https?://|ftp://|www\\.|[a-zA-Z0-9.!#$%&\'*+/=?^_`{\\|}~-]+@|$')
.getRegex() .getRegex()
}); });
inline.gfm.url = edit(inline.gfm.url)
.replace('email', inline.gfm._extended_email)
.getRegex();
/** /**
* GFM + Line Breaks Inline Grammar * GFM + Line Breaks Inline Grammar
*/ */
@@ -1156,14 +1246,14 @@ function InlineLexer(links, options) {
throw new Error('Tokens array requires a `links` property.'); throw new Error('Tokens array requires a `links` property.');
} }
if (this.options.gfm) { if (this.options.pedantic) {
this.rules = inline.pedantic;
} else if (this.options.gfm) {
if (this.options.breaks) { if (this.options.breaks) {
this.rules = inline.breaks; this.rules = inline.breaks;
} else { } else {
this.rules = inline.gfm; this.rules = inline.gfm;
} }
} else if (this.options.pedantic) {
this.rules = inline.pedantic;
} }
} }
@@ -1193,7 +1283,9 @@ InlineLexer.prototype.output = function(src) {
link, link,
text, text,
href, href,
cap; title,
cap,
prevCapZero;
while (src) { while (src) {
// escape // escape
@@ -1219,12 +1311,15 @@ InlineLexer.prototype.output = function(src) {
// url (gfm) // url (gfm)
if (!this$1.inLink && (cap = this$1.rules.url.exec(src))) { if (!this$1.inLink && (cap = this$1.rules.url.exec(src))) {
cap[0] = this$1.rules._backpedal.exec(cap[0])[0];
src = src.substring(cap[0].length);
if (cap[2] === '@') { if (cap[2] === '@') {
text = escape(cap[0]); text = escape(cap[0]);
href = 'mailto:' + text; href = 'mailto:' + text;
} else { } else {
// do extended autolink path validation
do {
prevCapZero = cap[0];
cap[0] = this$1.rules._backpedal.exec(cap[0])[0];
} while (prevCapZero !== cap[0]);
text = escape(cap[0]); text = escape(cap[0]);
if (cap[1] === 'www.') { if (cap[1] === 'www.') {
href = 'http://' + text; href = 'http://' + text;
@@ -1232,6 +1327,7 @@ InlineLexer.prototype.output = function(src) {
href = text; href = text;
} }
} }
src = src.substring(cap[0].length);
out += this$1.renderer.link(href, null, text); out += this$1.renderer.link(href, null, text);
continue; continue;
} }
@@ -1243,6 +1339,12 @@ InlineLexer.prototype.output = function(src) {
} else if (this$1.inLink && /^<\/a>/i.test(cap[0])) { } else if (this$1.inLink && /^<\/a>/i.test(cap[0])) {
this$1.inLink = false; this$1.inLink = false;
} }
if (!this$1.inRawBlock && /^<(pre|code|kbd|script)(\s|>)/i.test(cap[0])) {
this$1.inRawBlock = true;
} else if (this$1.inRawBlock && /^<\/(pre|code|kbd|script)(\s|>)/i.test(cap[0])) {
this$1.inRawBlock = false;
}
src = src.substring(cap[0].length); src = src.substring(cap[0].length);
out += this$1.options.sanitize out += this$1.options.sanitize
? this$1.options.sanitizer ? this$1.options.sanitizer
@@ -1256,9 +1358,23 @@ InlineLexer.prototype.output = function(src) {
if (cap = this$1.rules.link.exec(src)) { if (cap = this$1.rules.link.exec(src)) {
src = src.substring(cap[0].length); src = src.substring(cap[0].length);
this$1.inLink = true; this$1.inLink = true;
href = cap[2];
if (this$1.options.pedantic) {
link = /^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(href);
if (link) {
href = link[1];
title = link[3];
} else {
title = '';
}
} else {
title = cap[3] ? cap[3].slice(1, -1) : '';
}
href = href.trim().replace(/^<([\s\S]*)>$/, '$1');
out += this$1.outputLink(cap, { out += this$1.outputLink(cap, {
href: cap[2], href: InlineLexer.escapes(href),
title: cap[3] title: InlineLexer.escapes(title)
}); });
this$1.inLink = false; this$1.inLink = false;
continue; continue;
@@ -1284,14 +1400,14 @@ InlineLexer.prototype.output = function(src) {
// strong // strong
if (cap = this$1.rules.strong.exec(src)) { if (cap = this$1.rules.strong.exec(src)) {
src = src.substring(cap[0].length); src = src.substring(cap[0].length);
out += this$1.renderer.strong(this$1.output(cap[2] || cap[1])); out += this$1.renderer.strong(this$1.output(cap[4] || cap[3] || cap[2] || cap[1]));
continue; continue;
} }
// em // em
if (cap = this$1.rules.em.exec(src)) { if (cap = this$1.rules.em.exec(src)) {
src = src.substring(cap[0].length); src = src.substring(cap[0].length);
out += this$1.renderer.em(this$1.output(cap[2] || cap[1])); out += this$1.renderer.em(this$1.output(cap[6] || cap[5] || cap[4] || cap[3] || cap[2] || cap[1]));
continue; continue;
} }
@@ -1319,7 +1435,11 @@ InlineLexer.prototype.output = function(src) {
// text // text
if (cap = this$1.rules.text.exec(src)) { if (cap = this$1.rules.text.exec(src)) {
src = src.substring(cap[0].length); src = src.substring(cap[0].length);
out += this$1.renderer.text(escape(this$1.smartypants(cap[0]))); if (this$1.inRawBlock) {
out += this$1.renderer.text(cap[0]);
} else {
out += this$1.renderer.text(escape(this$1.smartypants(cap[0])));
}
continue; continue;
} }
@@ -1331,12 +1451,16 @@ InlineLexer.prototype.output = function(src) {
return out; return out;
}; };
InlineLexer.escapes = function(text) {
return text ? text.replace(InlineLexer.rules._escapes, '$1') : text;
};
/** /**
* Compile Link * Compile Link
*/ */
InlineLexer.prototype.outputLink = function(cap, link) { InlineLexer.prototype.outputLink = function(cap, link) {
var href = escape(link.href), var href = link.href,
title = link.title ? escape(link.title) : null; title = link.title ? escape(link.title) : null;
return cap[0].charAt(0) !== '!' return cap[0].charAt(0) !== '!'
@@ -1394,7 +1518,7 @@ InlineLexer.prototype.mangle = function(text) {
*/ */
function Renderer(options) { function Renderer(options) {
this.options = options || {}; this.options = options || marked.defaults;
} }
Renderer.prototype.code = function(code, lang, escaped) { Renderer.prototype.code = function(code, lang, escaped) {
@@ -1409,7 +1533,7 @@ Renderer.prototype.code = function(code, lang, escaped) {
if (!lang) { if (!lang) {
return '<pre><code>' return '<pre><code>'
+ (escaped ? code : escape(code, true)) + (escaped ? code : escape(code, true))
+ '\n</code></pre>'; + '</code></pre>';
} }
return '<pre><code class="' return '<pre><code class="'
@@ -1417,7 +1541,7 @@ Renderer.prototype.code = function(code, lang, escaped) {
+ escape(lang, true) + escape(lang, true)
+ '">' + '">'
+ (escaped ? code : escape(code, true)) + (escaped ? code : escape(code, true))
+ '\n</code></pre>\n'; + '</code></pre>\n';
}; };
Renderer.prototype.blockquote = function(quote) { Renderer.prototype.blockquote = function(quote) {
@@ -1429,16 +1553,20 @@ Renderer.prototype.html = function(html) {
}; };
Renderer.prototype.heading = function(text, level, raw) { Renderer.prototype.heading = function(text, level, raw) {
return '<h' if (this.options.headerIds) {
+ level return '<h'
+ ' id="' + level
+ this.options.headerPrefix + ' id="'
+ raw.toLowerCase().replace(/[^\w]+/g, '-') + this.options.headerPrefix
+ '">' + raw.toLowerCase().replace(/[^\w]+/g, '-')
+ text + '">'
+ '</h' + text
+ level + '</h'
+ '>\n'; + level
+ '>\n';
}
// ignore IDs
return '<h' + level + '>' + text + '</h' + level + '>\n';
}; };
Renderer.prototype.hr = function() { Renderer.prototype.hr = function() {
@@ -1455,18 +1583,26 @@ Renderer.prototype.listitem = function(text) {
return '<li>' + text + '</li>\n'; return '<li>' + text + '</li>\n';
}; };
Renderer.prototype.checkbox = function(checked) {
return '<input '
+ (checked ? 'checked="" ' : '')
+ 'disabled="" type="checkbox"'
+ (this.options.xhtml ? ' /' : '')
+ '> ';
};
Renderer.prototype.paragraph = function(text) { Renderer.prototype.paragraph = function(text) {
return '<p>' + text + '</p>\n'; return '<p>' + text + '</p>\n';
}; };
Renderer.prototype.table = function(header, body) { Renderer.prototype.table = function(header, body) {
if (body) { body = '<tbody>' + body + '</tbody>'; }
return '<table>\n' return '<table>\n'
+ '<thead>\n' + '<thead>\n'
+ header + header
+ '</thead>\n' + '</thead>\n'
+ '<tbody>\n'
+ body + body
+ '</tbody>\n'
+ '</table>\n'; + '</table>\n';
}; };
@@ -1477,7 +1613,7 @@ Renderer.prototype.tablerow = function(content) {
Renderer.prototype.tablecell = function(content, flags) { Renderer.prototype.tablecell = function(content, flags) {
var type = flags.header ? 'th' : 'td'; var type = flags.header ? 'th' : 'td';
var tag = flags.align var tag = flags.align
? '<' + type + ' style="text-align:' + flags.align + '">' ? '<' + type + ' align="' + flags.align + '">'
: '<' + type + '>'; : '<' + type + '>';
return tag + content + '</' + type + '>\n'; return tag + content + '</' + type + '>\n';
}; };
@@ -1519,7 +1655,12 @@ Renderer.prototype.link = function(href, title, text) {
if (this.options.baseUrl && !originIndependentUrl.test(href)) { if (this.options.baseUrl && !originIndependentUrl.test(href)) {
href = resolveUrl(this.options.baseUrl, href); href = resolveUrl(this.options.baseUrl, href);
} }
var out = '<a href="' + href + '"'; try {
href = encodeURI(href).replace(/%25/g, '%');
} catch (e) {
return text;
}
var out = '<a href="' + escape(href) + '"';
if (title) { if (title) {
out += ' title="' + title + '"'; out += ' title="' + title + '"';
} }
@@ -1726,29 +1867,23 @@ Parser.prototype.tok = function() {
} }
case 'list_item_start': { case 'list_item_start': {
body = ''; body = '';
var loose = this.token.loose;
if (this.token.task) {
body += this.renderer.checkbox(this.token.checked);
}
while (this.next().type !== 'list_item_end') { while (this.next().type !== 'list_item_end') {
body += this$1.token.type === 'text' body += !loose && this$1.token.type === 'text'
? this$1.parseText() ? this$1.parseText()
: this$1.tok(); : this$1.tok();
} }
return this.renderer.listitem(body); return this.renderer.listitem(body);
} }
case 'loose_item_start': {
body = '';
while (this.next().type !== 'list_item_end') {
body += this$1.tok();
}
return this.renderer.listitem(body);
}
case 'html': { case 'html': {
var html = !this.token.pre && !this.options.pedantic // TODO parse inline content if parameter markdown=1
? this.inline.output(this.token.text) return this.renderer.html(this.token.text);
: this.token.text;
return this.renderer.html(html);
} }
case 'paragraph': { case 'paragraph': {
return this.renderer.paragraph(this.inline.output(this.token.text)); return this.renderer.paragraph(this.inline.output(this.token.text));
@@ -1764,14 +1899,32 @@ Parser.prototype.tok = function() {
*/ */
function escape(html, encode) { function escape(html, encode) {
return html if (encode) {
.replace(!encode ? /&(?!#?\w+;)/g : /&/g, '&amp;') if (escape.escapeTest.test(html)) {
.replace(/</g, '&lt;') return html.replace(escape.escapeReplace, function (ch) { return escape.replacements[ch] });
.replace(/>/g, '&gt;') }
.replace(/"/g, '&quot;') } else {
.replace(/'/g, '&#39;'); if (escape.escapeTestNoEncode.test(html)) {
return html.replace(escape.escapeReplaceNoEncode, function (ch) { return escape.replacements[ch] });
}
}
return html;
} }
escape.escapeTest = /[&<>"']/;
escape.escapeReplace = /[&<>"']/g;
escape.replacements = {
'&': '&amp;',
'<': '&lt;',
'>': '&gt;',
'"': '&quot;',
"'": '&#39;'
};
escape.escapeTestNoEncode = /[<>"']|&(?!#?\w+;)/;
escape.escapeReplaceNoEncode = /[<>"']|&(?!#?\w+;)/g;
function unescape(html) { function unescape(html) {
// explicitly match decimal, hex, and named HTML entities // explicitly match decimal, hex, and named HTML entities
return html.replace(/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig, function(_, n) { return html.replace(/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig, function(_, n) {
@@ -1787,7 +1940,7 @@ function unescape(html) {
} }
function edit(regex, opt) { function edit(regex, opt) {
regex = regex.source; regex = regex.source || regex;
opt = opt || ''; opt = opt || '';
return { return {
replace: function(name, val) { replace: function(name, val) {
@@ -1810,7 +1963,7 @@ function resolveUrl(base, href) {
if (/^[^:]+:\/*[^/]*$/.test(base)) { if (/^[^:]+:\/*[^/]*$/.test(base)) {
baseUrls[' ' + base] = base + '/'; baseUrls[' ' + base] = base + '/';
} else { } else {
baseUrls[' ' + base] = base.replace(/[^/]*$/, ''); baseUrls[' ' + base] = rtrim(base, '/', true);
} }
} }
base = baseUrls[' ' + base]; base = baseUrls[' ' + base];
@@ -1848,6 +2001,64 @@ function merge(obj) {
return obj; return obj;
} }
function splitCells(tableRow, count) {
// ensure that every cell-delimiting pipe has a space
// before it to distinguish it from an escaped pipe
var row = tableRow.replace(/\|/g, function (match, offset, str) {
var escaped = false,
curr = offset;
while (--curr >= 0 && str[curr] === '\\') { escaped = !escaped; }
if (escaped) {
// odd number of slashes means | is escaped
// so we leave it alone
return '|';
} else {
// add space before unescaped |
return ' |';
}
}),
cells = row.split(/ \|/),
i = 0;
if (cells.length > count) {
cells.splice(count);
} else {
while (cells.length < count) { cells.push(''); }
}
for (; i < cells.length; i++) {
// leading or trailing whitespace is ignored per the gfm spec
cells[i] = cells[i].trim().replace(/\\\|/g, '|');
}
return cells;
}
// Remove trailing 'c's. Equivalent to str.replace(/c*$/, '').
// /c*$/ is vulnerable to REDOS.
// invert: Remove suffix of non-c chars instead. Default falsey.
function rtrim(str, c, invert) {
if (str.length === 0) {
return '';
}
// Length of suffix matching the invert condition.
var suffLen = 0;
// Step left until we fail to match the invert condition.
while (suffLen < str.length) {
var currChar = str.charAt(str.length - suffLen - 1);
if (currChar === c && !invert) {
suffLen++;
} else if (currChar !== c && invert) {
suffLen++;
} else {
break;
}
}
return str.substr(0, str.length - suffLen);
}
/** /**
* Marked * Marked
*/ */
@@ -1955,25 +2166,30 @@ marked.setOptions = function(opt) {
return marked; return marked;
}; };
marked.defaults = { marked.getDefaults = function () {
gfm: true, return {
tables: true, baseUrl: null,
breaks: false, breaks: false,
pedantic: false, gfm: true,
sanitize: false, headerIds: true,
sanitizer: null, headerPrefix: '',
mangle: true, highlight: null,
smartLists: false, langPrefix: 'language-',
silent: false, mangle: true,
highlight: null, pedantic: false,
langPrefix: 'lang-', renderer: new Renderer(),
smartypants: false, sanitize: false,
headerPrefix: '', sanitizer: null,
renderer: new Renderer(), silent: false,
xhtml: false, smartLists: false,
baseUrl: null smartypants: false,
tables: true,
xhtml: false
};
}; };
marked.defaults = marked.getDefaults();
/** /**
* Expose * Expose
*/ */
@@ -3355,7 +3571,7 @@ Compiler.prototype._initRenderer = function _initRenderer () {
} }
href = router.toURL(href, null, router.getCurrentPath()); href = router.toURL(href, null, router.getCurrentPath());
} else { } else {
attrs += href.startsWith('mailto:') ? '' : (" target=\"" + linkTarget + "\""); attrs += href.indexOf('mailto:') === 0 ? '' : (" target=\"" + linkTarget + "\"");
} }
if (config.target) { if (config.target) {
@@ -3379,8 +3595,6 @@ Compiler.prototype._initRenderer = function _initRenderer () {
result = helper('tip', text); result = helper('tip', text);
} else if (/^\?&gt;/.test(text)) { } else if (/^\?&gt;/.test(text)) {
result = helper('warn', text); result = helper('warn', text);
} else if (/^</.test(text)) {
return text
} else { } else {
result = "<p>" + text + "</p>"; result = "<p>" + text + "</p>";
} }
@@ -4104,7 +4318,7 @@ function renderMixin(proto) {
var m = html var m = html
.trim() .trim()
.match('<img.*?data-origin="(.*?)"[^a]+alt="(.*?)">([^<]*?)$'); .match('<p><img.*?data-origin="(.*?)"[^a]+alt="(.*?)">([^<]*?)</p>$');
if (m) { if (m) {
if (m[2] === 'color') { if (m[2] === 'color') {
@@ -4123,17 +4337,6 @@ function renderMixin(proto) {
html = html.replace(m[0], ''); html = html.replace(m[0], '');
} }
// XXX: A Workaround
html = html
.split('\n')
.map(function (part) {
if (/^<a/.test(part)) {
return part.replace('<a', '<a data-button')
}
return part
})
.join('\n');
this._renderTo('.cover-main', html); this._renderTo('.cover-main', html);
sticky(); sticky();
}; };
@@ -4805,7 +5008,13 @@ var util = Object.freeze({
}); });
function initGlobalAPI () { function initGlobalAPI () {
window.Docsify = {util: util, dom: dom, get: get, slugify: slugify}; window.Docsify = {
util: util,
dom: dom,
get: get,
slugify: slugify,
version: '4.8.6'
};
window.DocsifyCompiler = Compiler; window.DocsifyCompiler = Compiler;
window.marked = marked; window.marked = marked;
window.Prism = prism; window.Prism = prism;
@@ -4841,11 +5050,6 @@ eventMixin(proto);
*/ */
initGlobalAPI(); initGlobalAPI();
/**
* Version
*/
Docsify.version = '4.8.2';
/** /**
* Run Docsify * Run Docsify
*/ */
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -17,7 +17,7 @@ function escapeHtml(string) {
function getAllPaths(router) { function getAllPaths(router) {
var paths = []; var paths = [];
document.querySelectorAll('.sidebar-nav a:not(.section-link):not([data-nosearch])').forEach(function (node) { Docsify.dom.findAll('.sidebar-nav a:not(.section-link):not([data-nosearch])').forEach(function (node) {
var href = node.href; var href = node.href;
var originHref = node.getAttribute('href'); var originHref = node.getAttribute('href');
var path = router.parse(href).path; var path = router.parse(href).path;
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
+88 -262
View File
@@ -1,6 +1,6 @@
{ {
"name": "docsify", "name": "docsify",
"version": "4.8.2", "version": "4.8.6",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {
@@ -940,32 +940,15 @@
} }
}, },
"connect": { "connect": {
"version": "3.5.1", "version": "3.6.6",
"resolved": "https://registry.npmjs.org/connect/-/connect-3.5.1.tgz", "resolved": "https://registry.npmjs.org/connect/-/connect-3.6.6.tgz",
"integrity": "sha1-bTDXpjx/FwhXprOqazY9lz3KWI4=", "integrity": "sha1-Ce/2xVr3I24TcTWnJXSFi2eG9SQ=",
"dev": true, "dev": true,
"requires": { "requires": {
"debug": "~2.2.0", "debug": "2.6.9",
"finalhandler": "0.5.1", "finalhandler": "1.1.0",
"parseurl": "~1.3.1", "parseurl": "~1.3.2",
"utils-merge": "1.0.0" "utils-merge": "1.0.1"
},
"dependencies": {
"debug": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/debug/-/debug-2.2.0.tgz",
"integrity": "sha1-+HBX6ZWxofauaklgZkE3vFbwOdo=",
"dev": true,
"requires": {
"ms": "0.7.1"
}
},
"ms": {
"version": "0.7.1",
"resolved": "https://registry.npmjs.org/ms/-/ms-0.7.1.tgz",
"integrity": "sha1-nNE8A62/8ltl7/3nzoZO6VIBcJg=",
"dev": true
}
} }
}, },
"console-control-strings": { "console-control-strings": {
@@ -1268,9 +1251,9 @@
"dev": true "dev": true
}, },
"cors": { "cors": {
"version": "2.8.4", "version": "2.8.5",
"resolved": "https://registry.npmjs.org/cors/-/cors-2.8.4.tgz", "resolved": "https://registry.npmjs.org/cors/-/cors-2.8.5.tgz",
"integrity": "sha1-K9OB8usgECAQXNUOpZ2mMJBpRoY=", "integrity": "sha512-KIHbLJqu73RGr/hnbrO9uBeixNGuvSQjul/jdFvS/KFSIH1hWVd1ng7zOHx+YrEfInLG7q4n6GHQ9cDtxv/P6g==",
"dev": true, "dev": true,
"requires": { "requires": {
"object-assign": "^4", "object-assign": "^4",
@@ -1947,18 +1930,44 @@
"dev": true "dev": true
}, },
"event-stream": { "event-stream": {
"version": "4.0.1", "version": "3.3.4",
"resolved": "https://registry.npmjs.org/event-stream/-/event-stream-4.0.1.tgz", "resolved": "http://registry.npmjs.org/event-stream/-/event-stream-3.3.4.tgz",
"integrity": "sha512-qACXdu/9VHPBzcyhdOWR5/IahhGMf0roTeZJfzz077GwylcDd90yOHLouhmv7GJ5XzPi6ekaQWd8AvPP2nOvpA==", "integrity": "sha1-SrTJoPWlTbkzi0w02Gv86PSzVXE=",
"dev": true, "dev": true,
"requires": { "requires": {
"duplexer": "^0.1.1", "duplexer": "~0.1.1",
"from": "^0.1.7", "from": "~0",
"map-stream": "0.0.7", "map-stream": "~0.1.0",
"pause-stream": "^0.0.11", "pause-stream": "0.0.11",
"split": "^1.0.1", "split": "0.3",
"stream-combiner": "^0.2.2", "stream-combiner": "~0.0.4",
"through": "^2.3.8" "through": "~2.3.1"
},
"dependencies": {
"map-stream": {
"version": "0.1.0",
"resolved": "http://registry.npmjs.org/map-stream/-/map-stream-0.1.0.tgz",
"integrity": "sha1-5WqpTEyAVaFkBKBnS3jyFffI4ZQ=",
"dev": true
},
"split": {
"version": "0.3.3",
"resolved": "http://registry.npmjs.org/split/-/split-0.3.3.tgz",
"integrity": "sha1-zQ7qXmOiEd//frDwkcQTPi0N0o8=",
"dev": true,
"requires": {
"through": "2"
}
},
"stream-combiner": {
"version": "0.0.4",
"resolved": "http://registry.npmjs.org/stream-combiner/-/stream-combiner-0.0.4.tgz",
"integrity": "sha1-TV5DPBhSYd3mI8o/RMWGvPXErRQ=",
"dev": true,
"requires": {
"duplexer": "~0.1.1"
}
}
} }
}, },
"execa": { "execa": {
@@ -2246,33 +2255,18 @@
} }
}, },
"finalhandler": { "finalhandler": {
"version": "0.5.1", "version": "1.1.0",
"resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-0.5.1.tgz", "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.1.0.tgz",
"integrity": "sha1-LEANjUUwk1vCMlScX6OF7Afeb80=", "integrity": "sha1-zgtoVbRYU+eRsvzGgARtiCU91/U=",
"dev": true, "dev": true,
"requires": { "requires": {
"debug": "~2.2.0", "debug": "2.6.9",
"encodeurl": "~1.0.1",
"escape-html": "~1.0.3", "escape-html": "~1.0.3",
"on-finished": "~2.3.0", "on-finished": "~2.3.0",
"parseurl": "~1.3.2",
"statuses": "~1.3.1", "statuses": "~1.3.1",
"unpipe": "~1.0.0" "unpipe": "~1.0.0"
},
"dependencies": {
"debug": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/debug/-/debug-2.2.0.tgz",
"integrity": "sha1-+HBX6ZWxofauaklgZkE3vFbwOdo=",
"dev": true,
"requires": {
"ms": "0.7.1"
}
},
"ms": {
"version": "0.7.1",
"resolved": "https://registry.npmjs.org/ms/-/ms-0.7.1.tgz",
"integrity": "sha1-nNE8A62/8ltl7/3nzoZO6VIBcJg=",
"dev": true
}
} }
}, },
"find-up": { "find-up": {
@@ -2296,12 +2290,6 @@
"write": "^0.2.1" "write": "^0.2.1"
} }
}, },
"flatmap-stream": {
"version": "0.1.1",
"resolved": "https://registry.npmjs.org/flatmap-stream/-/flatmap-stream-0.1.1.tgz",
"integrity": "sha512-lAq4tLbm3sidmdCN8G3ExaxH7cUCtP5mgDvrYowsx84dcYkJJ4I28N7gkxA6+YlSXzaGLJYIDEi9WGfXzMiXdw==",
"dev": true
},
"flatten": { "flatten": {
"version": "1.0.2", "version": "1.0.2",
"resolved": "https://registry.npmjs.org/flatten/-/flatten-1.0.2.tgz", "resolved": "https://registry.npmjs.org/flatten/-/flatten-1.0.2.tgz",
@@ -3382,9 +3370,9 @@
} }
}, },
"http-parser-js": { "http-parser-js": {
"version": "0.4.13", "version": "0.5.0",
"resolved": "https://registry.npmjs.org/http-parser-js/-/http-parser-js-0.4.13.tgz", "resolved": "https://registry.npmjs.org/http-parser-js/-/http-parser-js-0.5.0.tgz",
"integrity": "sha1-O9bW/ebjFyyTNMOzO2wZPYD+ETc=", "integrity": "sha512-cZdEF7r4gfRIq7ezX9J0T+kQmJNOub71dWbgAXVHDct80TKP4MCETtZQ31xyv38UwgzkWPYF/Xc0ge55dW9Z9w==",
"dev": true "dev": true
}, },
"iconv-lite": { "iconv-lite": {
@@ -4078,157 +4066,32 @@
} }
}, },
"live-server": { "live-server": {
"version": "1.2.0", "version": "1.2.1",
"resolved": "https://registry.npmjs.org/live-server/-/live-server-1.2.0.tgz", "resolved": "https://registry.npmjs.org/live-server/-/live-server-1.2.1.tgz",
"integrity": "sha1-RJhkS7+Bpm8Y3Y3/3vYcTBw3TKM=", "integrity": "sha512-Yn2XCVjErTkqnM3FfTmM7/kWy3zP7+cEtC7x6u+wUzlQ+1UW3zEYbbyJrc0jNDwiMDZI0m4a0i3dxlGHVyXczw==",
"dev": true, "dev": true,
"requires": { "requires": {
"chokidar": "^1.6.0", "chokidar": "^2.0.4",
"colors": "^1.3.2", "colors": "^1.3.2",
"connect": "3.5.x", "connect": "^3.6.6",
"cors": "^2.8.4", "cors": "^2.8.5",
"event-stream": "^4.0.1", "event-stream": "3.3.4",
"faye-websocket": "0.11.x", "faye-websocket": "0.11.x",
"http-auth": "3.1.x", "http-auth": "3.1.x",
"morgan": "^1.6.1", "morgan": "^1.9.1",
"object-assign": "^4.1.1", "object-assign": "^4.1.1",
"opn": "^5.4.0", "opn": "^5.4.0",
"proxy-middleware": "^0.15.0", "proxy-middleware": "^0.15.0",
"send": "^0.16.2", "send": "^0.16.2",
"serve-index": "^1.7.2" "serve-index": "^1.9.1"
}, },
"dependencies": { "dependencies": {
"anymatch": {
"version": "1.3.2",
"resolved": "https://registry.npmjs.org/anymatch/-/anymatch-1.3.2.tgz",
"integrity": "sha512-0XNayC8lTHQ2OI8aljNCN3sSx6hsr/1+rlcDAotXJR7C1oZZHCNsfpbKwMjRA3Uqb5tF1Rae2oloTr4xpq+WjA==",
"dev": true,
"requires": {
"micromatch": "^2.1.5",
"normalize-path": "^2.0.0"
}
},
"arr-diff": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-2.0.0.tgz",
"integrity": "sha1-jzuCf5Vai9ZpaX5KQlasPOrjVs8=",
"dev": true,
"requires": {
"arr-flatten": "^1.0.1"
}
},
"array-unique": {
"version": "0.2.1",
"resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.2.1.tgz",
"integrity": "sha1-odl8yvy8JiXMcPrc6zalDFiwGlM=",
"dev": true
},
"braces": {
"version": "1.8.5",
"resolved": "https://registry.npmjs.org/braces/-/braces-1.8.5.tgz",
"integrity": "sha1-uneWLhLf+WnWt2cR6RS3N4V79qc=",
"dev": true,
"requires": {
"expand-range": "^1.8.1",
"preserve": "^0.2.0",
"repeat-element": "^1.1.2"
}
},
"chokidar": {
"version": "1.7.0",
"resolved": "https://registry.npmjs.org/chokidar/-/chokidar-1.7.0.tgz",
"integrity": "sha1-eY5ol3gVHIB2tLNg5e3SjNortGg=",
"dev": true,
"requires": {
"anymatch": "^1.3.0",
"async-each": "^1.0.0",
"fsevents": "^1.0.0",
"glob-parent": "^2.0.0",
"inherits": "^2.0.1",
"is-binary-path": "^1.0.0",
"is-glob": "^2.0.0",
"path-is-absolute": "^1.0.0",
"readdirp": "^2.0.0"
}
},
"colors": { "colors": {
"version": "1.3.2", "version": "1.3.2",
"resolved": "https://registry.npmjs.org/colors/-/colors-1.3.2.tgz", "resolved": "https://registry.npmjs.org/colors/-/colors-1.3.2.tgz",
"integrity": "sha512-rhP0JSBGYvpcNQj4s5AdShMeE5ahMop96cTeDl/v9qQQm2fYClE2QXZRi8wLzc+GmXSxdIqqbOIAhyObEXDbfQ==", "integrity": "sha512-rhP0JSBGYvpcNQj4s5AdShMeE5ahMop96cTeDl/v9qQQm2fYClE2QXZRi8wLzc+GmXSxdIqqbOIAhyObEXDbfQ==",
"dev": true "dev": true
}, },
"expand-brackets": {
"version": "0.1.5",
"resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-0.1.5.tgz",
"integrity": "sha1-3wcoTjQqgHzXM6xa9yQR5YHRF3s=",
"dev": true,
"requires": {
"is-posix-bracket": "^0.1.0"
}
},
"extglob": {
"version": "0.3.2",
"resolved": "https://registry.npmjs.org/extglob/-/extglob-0.3.2.tgz",
"integrity": "sha1-Lhj/PS9JqydlzskCPwEdqo2DSaE=",
"dev": true,
"requires": {
"is-extglob": "^1.0.0"
}
},
"glob-parent": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-2.0.0.tgz",
"integrity": "sha1-gTg9ctsFT8zPUzbaqQLxgvbtuyg=",
"dev": true,
"requires": {
"is-glob": "^2.0.0"
}
},
"is-extglob": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-1.0.0.tgz",
"integrity": "sha1-rEaBd8SUNAWgkvyPKXYMb/xiBsA=",
"dev": true
},
"is-glob": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/is-glob/-/is-glob-2.0.1.tgz",
"integrity": "sha1-0Jb5JqPe1WAPP9/ZEZjLCIjC2GM=",
"dev": true,
"requires": {
"is-extglob": "^1.0.0"
}
},
"kind-of": {
"version": "3.2.2",
"resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz",
"integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=",
"dev": true,
"requires": {
"is-buffer": "^1.1.5"
}
},
"micromatch": {
"version": "2.3.11",
"resolved": "https://registry.npmjs.org/micromatch/-/micromatch-2.3.11.tgz",
"integrity": "sha1-hmd8l9FyCzY0MdBNDRUpO9OMFWU=",
"dev": true,
"requires": {
"arr-diff": "^2.0.0",
"array-unique": "^0.2.1",
"braces": "^1.8.2",
"expand-brackets": "^0.1.4",
"extglob": "^0.3.1",
"filename-regex": "^2.0.0",
"is-extglob": "^1.0.0",
"is-glob": "^2.0.1",
"kind-of": "^3.0.2",
"normalize-path": "^2.0.1",
"object.omit": "^2.0.0",
"parse-glob": "^3.0.4",
"regex-cache": "^0.4.2"
}
},
"object-assign": { "object-assign": {
"version": "4.1.1", "version": "4.1.1",
"resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz",
@@ -4372,12 +4235,6 @@
"integrity": "sha1-plzSkIepJZi4eRJXpSPgISIqwfk=", "integrity": "sha1-plzSkIepJZi4eRJXpSPgISIqwfk=",
"dev": true "dev": true
}, },
"map-stream": {
"version": "0.0.7",
"resolved": "https://registry.npmjs.org/map-stream/-/map-stream-0.0.7.tgz",
"integrity": "sha1-ih8HiW2CsQkmvTdEokIACfiJdKg=",
"dev": true
},
"map-visit": { "map-visit": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/map-visit/-/map-visit-1.0.0.tgz", "resolved": "https://registry.npmjs.org/map-visit/-/map-visit-1.0.0.tgz",
@@ -4492,18 +4349,18 @@
"dev": true "dev": true
}, },
"mime-db": { "mime-db": {
"version": "1.36.0", "version": "1.37.0",
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.36.0.tgz", "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.37.0.tgz",
"integrity": "sha512-L+xvyD9MkoYMXb1jAmzI/lWYAxAMCPvIBSWur0PZ5nOf5euahRLVqH//FKW9mWp2lkqUgYiXPgkzfMUFi4zVDw==", "integrity": "sha512-R3C4db6bgQhlIhPU48fUtdVmKnflq+hRdad7IyKhtFj06VPNVdk2RhiYL3UjQIlso8L+YxAtFkobT0VK+S/ybg==",
"dev": true "dev": true
}, },
"mime-types": { "mime-types": {
"version": "2.1.20", "version": "2.1.21",
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.20.tgz", "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.21.tgz",
"integrity": "sha512-HrkrPaP9vGuWbLK1B1FfgAkbqNjIuy4eHlIYnFi7kamZyLLrGlo2mpcx0bBmNpKqBtYtAfGbodDddIgddSJC2A==", "integrity": "sha512-3iL6DbwpyLzjR3xHSFNFeb9Nz/M8WDkX33t1GFQnFOllWk8pOrh/LSrB5OXlnlW5P9LH73X6loW/eogc+F5lJg==",
"dev": true, "dev": true,
"requires": { "requires": {
"mime-db": "~1.36.0" "mime-db": "~1.37.0"
} }
}, },
"mimic-fn": { "mimic-fn": {
@@ -4728,17 +4585,17 @@
} }
}, },
"npm-run-all": { "npm-run-all": {
"version": "4.1.3", "version": "4.1.5",
"resolved": "https://registry.npmjs.org/npm-run-all/-/npm-run-all-4.1.3.tgz", "resolved": "https://registry.npmjs.org/npm-run-all/-/npm-run-all-4.1.5.tgz",
"integrity": "sha512-aOG0N3Eo/WW+q6sUIdzcV2COS8VnTZCmdji0VQIAZF3b+a3YWb0AD0vFIyjKec18A7beLGbaQ5jFTNI2bPt9Cg==", "integrity": "sha512-Oo82gJDAVcaMdi3nuoKFavkIHBRVqQ1qvMb+9LHk/cF4P6B2m8aP04hGf7oL6wZ9BuGwX1onlLhpuoofSyoQDQ==",
"dev": true, "dev": true,
"requires": { "requires": {
"ansi-styles": "^3.2.0", "ansi-styles": "^3.2.1",
"chalk": "^2.1.0", "chalk": "^2.4.1",
"cross-spawn": "^6.0.4", "cross-spawn": "^6.0.5",
"memorystream": "^0.3.1", "memorystream": "^0.3.1",
"minimatch": "^3.0.4", "minimatch": "^3.0.4",
"ps-tree": "^1.1.0", "pidtree": "^0.3.0",
"read-pkg": "^3.0.0", "read-pkg": "^3.0.0",
"shell-quote": "^1.6.1", "shell-quote": "^1.6.1",
"string.prototype.padend": "^3.0.0" "string.prototype.padend": "^3.0.0"
@@ -5192,6 +5049,12 @@
"through": "~2.3" "through": "~2.3"
} }
}, },
"pidtree": {
"version": "0.3.0",
"resolved": "https://registry.npmjs.org/pidtree/-/pidtree-0.3.0.tgz",
"integrity": "sha512-9CT4NFlDcosssyg8KVFltgokyKZIFjoBxw8CTGy+5F38Y1eQWrt8tRayiUOXE+zVKQnYu5BR8JjCtvK3BcnBhg==",
"dev": true
},
"pify": { "pify": {
"version": "3.0.0", "version": "3.0.0",
"resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz",
@@ -6166,33 +6029,6 @@
"integrity": "sha1-o/3xvvtzD5UZZYcqwvYHTGFHelY=", "integrity": "sha1-o/3xvvtzD5UZZYcqwvYHTGFHelY=",
"dev": true "dev": true
}, },
"ps-tree": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/ps-tree/-/ps-tree-1.1.0.tgz",
"integrity": "sha1-tCGyQUDWID8e08dplrRCewjowBQ=",
"dev": true,
"requires": {
"event-stream": "~3.3.0"
},
"dependencies": {
"event-stream": {
"version": "3.3.6",
"resolved": "https://registry.npmjs.org/event-stream/-/event-stream-3.3.6.tgz",
"integrity": "sha512-dGXNg4F/FgVzlApjzItL+7naHutA3fDqbV/zAZqDDlXTjiMnQmZKu+prImWKszeBM5UQeGvAl3u1wBiKeDh61g==",
"dev": true,
"requires": {
"duplexer": "^0.1.1",
"flatmap-stream": "^0.1.0",
"from": "^0.1.7",
"map-stream": "0.0.7",
"pause-stream": "^0.0.11",
"split": "^1.0.1",
"stream-combiner": "^0.2.2",
"through": "^2.3.8"
}
}
}
},
"pseudomap": { "pseudomap": {
"version": "1.0.2", "version": "1.0.2",
"resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz", "resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz",
@@ -7407,16 +7243,6 @@
"integrity": "sha1-+vUbnrdKrvOzrPStX2Gr8ky3uT4=", "integrity": "sha1-+vUbnrdKrvOzrPStX2Gr8ky3uT4=",
"dev": true "dev": true
}, },
"stream-combiner": {
"version": "0.2.2",
"resolved": "http://registry.npmjs.org/stream-combiner/-/stream-combiner-0.2.2.tgz",
"integrity": "sha1-rsjLrBd7Vrb0+kec7YwZEs7lKFg=",
"dev": true,
"requires": {
"duplexer": "~0.1.1",
"through": "~2.3.4"
}
},
"strict-uri-encode": { "strict-uri-encode": {
"version": "1.1.0", "version": "1.1.0",
"resolved": "https://registry.npmjs.org/strict-uri-encode/-/strict-uri-encode-1.1.0.tgz", "resolved": "https://registry.npmjs.org/strict-uri-encode/-/strict-uri-encode-1.1.0.tgz",
@@ -7963,9 +7789,9 @@
"dev": true "dev": true
}, },
"utils-merge": { "utils-merge": {
"version": "1.0.0", "version": "1.0.1",
"resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.0.tgz", "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz",
"integrity": "sha1-ApT7kiu5N1FTVBxPcJYjHyh8ivg=", "integrity": "sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM=",
"dev": true "dev": true
}, },
"uuid": { "uuid": {
+3 -3
View File
@@ -1,6 +1,6 @@
{ {
"name": "docsify", "name": "docsify",
"version": "4.8.2", "version": "4.8.6",
"description": "A magical documentation generator.", "description": "A magical documentation generator.",
"author": { "author": {
"name": "qingwei-li", "name": "qingwei-li",
@@ -58,8 +58,8 @@
"eslint": "^4.14.0", "eslint": "^4.14.0",
"eslint-config-xo-space": "^0.18.0", "eslint-config-xo-space": "^0.18.0",
"lerna": "^2.5.1", "lerna": "^2.5.1",
"live-server": "^1.2.0", "live-server": "^1.2.1",
"npm-run-all": "^4.1.2", "npm-run-all": "^4.1.5",
"rimraf": "^2.6.2", "rimraf": "^2.6.2",
"rollup": "^0.53.3", "rollup": "^0.53.3",
"rollup-plugin-async": "^1.2.0", "rollup-plugin-async": "^1.2.0",
+1 -1
View File
@@ -37,5 +37,5 @@
"integrity": "sha1-6DWIAbhrg7F1YNTjw4LXrvIQCUQ=" "integrity": "sha1-6DWIAbhrg7F1YNTjw4LXrvIQCUQ="
} }
}, },
"version": "4.8.2" "version": "4.8.6"
} }
@@ -1,6 +1,6 @@
{ {
"name": "docsify-server-renderer", "name": "docsify-server-renderer",
"version": "4.8.2", "version": "4.8.6",
"description": "docsify server renderer", "description": "docsify server renderer",
"author": { "author": {
"name": "qingwei-li", "name": "qingwei-li",
+24
View File
@@ -1,5 +1,6 @@
import {isMobile} from '../util/env' import {isMobile} from '../util/env'
import * as dom from '../util/dom' import * as dom from '../util/dom'
import image from '../util/image'
import Tweezer from 'tweezer.js' import Tweezer from 'tweezer.js'
const nav = {} const nav = {}
@@ -123,11 +124,34 @@ export function scrollActiveSidebar(router) {
}) })
} }
export let pausedScrollToView
export function proceedScrollToView() {
if (pausedScrollToView) {
const copy = pausedScrollToView.slice()
pausedScrollToView = undefined
scrollIntoView(...copy)
}
image.unsubscribe(proceedScrollToView)
}
export function scrollIntoView(path, id) { export function scrollIntoView(path, id) {
if (!id) { if (!id) {
return return
} }
if (pausedScrollToView) {
pausedScrollToView = [path, id]
return
}
if (!image.isAllImagesComplete()) {
pausedScrollToView = [path, id]
image.subscribe(proceedScrollToView)
return
}
const section = dom.find('#' + id) const section = dom.find('#' + id)
section && scrollTo(section) section && scrollTo(section)
+7 -1
View File
@@ -7,7 +7,13 @@ import marked from 'marked'
import prism from 'prismjs' import prism from 'prismjs'
export default function () { export default function () {
window.Docsify = {util, dom, get, slugify} window.Docsify = {
util,
dom,
get,
slugify,
version: '__VERSION__'
}
window.DocsifyCompiler = Compiler window.DocsifyCompiler = Compiler
window.marked = marked window.marked = marked
window.Prism = prism window.Prism = prism
-5
View File
@@ -35,11 +35,6 @@ eventMixin(proto)
*/ */
initGlobalAPI() initGlobalAPI()
/**
* Version
*/
Docsify.version = '__VERSION__'
/** /**
* Run Docsify * Run Docsify
*/ */
+6 -5
View File
@@ -6,6 +6,7 @@ import {slugify} from './slugify'
import {emojify} from './emojify' import {emojify} from './emojify'
import {isAbsolutePath, getPath, getParentPath} from '../router/util' import {isAbsolutePath, getPath, getParentPath} from '../router/util'
import {isFn, merge, cached, isPrimitive} from '../util/core' import {isFn, merge, cached, isPrimitive} from '../util/core'
import image from '../util/image'
// See https://github.com/PrismJS/prism/pull/1367 // See https://github.com/PrismJS/prism/pull/1367
import 'prismjs/components/prism-markup-templating' import 'prismjs/components/prism-markup-templating'
@@ -19,7 +20,7 @@ export function getAndRemoveConfig(str = '') {
str = str str = str
.replace(/^'/, '') .replace(/^'/, '')
.replace(/'$/, '') .replace(/'$/, '')
.replace(/:([\w-]+)=?([\w-]+)?/g, (m, key, value) => { .replace(/(?:^|\s):([\w-]+)=?([\w-]+)?/g, (m, key, value) => {
config[key] = (value && value.replace(/&quot;/g, '')) || true config[key] = (value && value.replace(/&quot;/g, '')) || true
return '' return ''
}) })
@@ -241,7 +242,7 @@ export class Compiler {
} }
href = router.toURL(href, null, router.getCurrentPath()) href = router.toURL(href, null, router.getCurrentPath())
} else { } else {
attrs += href.startsWith('mailto:') ? '' : ` target="${linkTarget}"` attrs += href.indexOf('mailto:') === 0 ? '' : ` target="${linkTarget}"`
} }
if (config.target) { if (config.target) {
@@ -265,8 +266,6 @@ export class Compiler {
result = helperTpl('tip', text) result = helperTpl('tip', text)
} else if (/^\?&gt;/.test(text)) { } else if (/^\?&gt;/.test(text)) {
result = helperTpl('warn', text) result = helperTpl('warn', text)
} else if (/^</.test(text)) {
return text
} else { } else {
result = `<p>${text}</p>` result = `<p>${text}</p>`
} }
@@ -301,7 +300,9 @@ export class Compiler {
url = getPath(contentBase, getParentPath(router.getCurrentPath()), href) url = getPath(contentBase, getParentPath(router.getCurrentPath()), href)
} }
return `<img src="${url}"data-origin="${href}" alt="${text}"${attrs}>` image.increaseLoadingImageCount()
return `<img src="${url}" data-origin="${href}" alt="${text}" onload="javascript:Docsify.util.image.onLoad(this)" onerror="javascript:Docsify.util.image.onError(this)"${attrs}>`
} }
renderer.origin = origin renderer.origin = origin
+1 -12
View File
@@ -179,7 +179,7 @@ export function renderMixin(proto) {
const m = html const m = html
.trim() .trim()
.match('<img.*?data-origin="(.*?)"[^a]+alt="(.*?)">([^<]*?)$') .match('<p><img.*?data-origin="(.*?)"[^a]+alt="(.*?)">([^<]*?)</p>$')
if (m) { if (m) {
if (m[2] === 'color') { if (m[2] === 'color') {
@@ -198,17 +198,6 @@ export function renderMixin(proto) {
html = html.replace(m[0], '') html = html.replace(m[0], '')
} }
// XXX: A Workaround
html = html
.split('\n')
.map(part => {
if (/^<a/.test(part)) {
return part.replace('<a', '<a data-button')
}
return part
})
.join('\n')
this._renderTo('.cover-main', html) this._renderTo('.cover-main', html)
sticky() sticky()
} }
+62
View File
@@ -0,0 +1,62 @@
export default (function () {
let loadingImageCount = 0
const subscribers = []
function subscribe(cb) {
subscribers.push(cb)
}
function unsubscribe(cb) {
const index = subscribers.indexOf(cb)
if (index !== -1) {
subscribers.splice(index, 1)
}
}
function notifyAllImagesComplete() {
for (let i = 0; i < subscribers.length; i++) {
subscribers[i]()
}
}
function increaseLoadingImageCount() {
loadingImageCount += 1
}
function decreaseLoadingImageCount() {
loadingImageCount -= 1
if (loadingImageCount === 0) {
notifyAllImagesComplete()
}
}
function cleanElement(ele) {
ele.removeAttribute('onload')
ele.removeAttribute('onerror')
}
function onLoad(ele) {
cleanElement(ele)
decreaseLoadingImageCount()
}
function onError(ele) {
cleanElement(ele)
decreaseLoadingImageCount()
}
function isAllImagesComplete() {
return loadingImageCount === 0
}
return {
subscribe,
unsubscribe,
increaseLoadingImageCount,
onLoad,
onError,
isAllImagesComplete
}
})()
+1
View File
@@ -1,3 +1,4 @@
export * from './core' export * from './core'
export * from './env' export * from './env'
export * from '../router/util' export * from '../router/util'
export {default as image} from './image'
+3 -1
View File
@@ -7,7 +7,8 @@ const CONFIG = {
paths: 'auto', paths: 'auto',
depth: 2, depth: 2,
maxAge: 86400000, // 1 day maxAge: 86400000, // 1 day
hideOtherSidebarContent: false hideOtherSidebarContent: false,
namespace: undefined
} }
const install = function (hook, vm) { const install = function (hook, vm) {
@@ -23,6 +24,7 @@ const install = function (hook, vm) {
CONFIG.noData = opts.noData || CONFIG.noData CONFIG.noData = opts.noData || CONFIG.noData
CONFIG.depth = opts.depth || CONFIG.depth CONFIG.depth = opts.depth || CONFIG.depth
CONFIG.hideOtherSidebarContent = opts.hideOtherSidebarContent || CONFIG.hideOtherSidebarContent CONFIG.hideOtherSidebarContent = opts.hideOtherSidebarContent || CONFIG.hideOtherSidebarContent
CONFIG.namespace = opts.namespace || CONFIG.namespace
} }
const isAuto = CONFIG.paths === 'auto' const isAuto = CONFIG.paths === 'auto'
+23 -7
View File
@@ -1,5 +1,17 @@
let INDEXS = {} let INDEXS = {}
const LOCAL_STORAGE = {
EXPIRE_KEY: 'docsify.search.expires',
INDEX_KEY: 'docsify.search.index'
}
function resolveExpireKey(namespace) {
return namespace ? `${LOCAL_STORAGE.EXPIRE_KEY}/${namespace}` : LOCAL_STORAGE.EXPIRE_KEY
}
function resolveIndexKey(namespace) {
return namespace ? `${LOCAL_STORAGE.INDEX_KEY}/${namespace}` : LOCAL_STORAGE.INDEX_KEY
}
function escapeHtml(string) { function escapeHtml(string) {
const entityMap = { const entityMap = {
'&': '&amp;', '&': '&amp;',
@@ -16,7 +28,7 @@ function escapeHtml(string) {
function getAllPaths(router) { function getAllPaths(router) {
const paths = [] const paths = []
document.querySelectorAll('.sidebar-nav a:not(.section-link):not([data-nosearch])').forEach(node => { Docsify.dom.findAll('.sidebar-nav a:not(.section-link):not([data-nosearch])').forEach(node => {
const href = node.href const href = node.href
const originHref = node.getAttribute('href') const originHref = node.getAttribute('href')
const path = router.parse(href).path const path = router.parse(href).path
@@ -33,9 +45,9 @@ function getAllPaths(router) {
return paths return paths
} }
function saveData(maxAge) { function saveData(maxAge, expireKey, indexKey) {
localStorage.setItem('docsify.search.expires', Date.now() + maxAge) localStorage.setItem(expireKey, Date.now() + maxAge)
localStorage.setItem('docsify.search.index', JSON.stringify(INDEXS)) localStorage.setItem(indexKey, JSON.stringify(INDEXS))
} }
export function genIndex(path, content = '', router, depth) { export function genIndex(path, content = '', router, depth) {
@@ -149,9 +161,13 @@ export function search(query) {
export function init(config, vm) { export function init(config, vm) {
const isAuto = config.paths === 'auto' const isAuto = config.paths === 'auto'
const isExpired = localStorage.getItem('docsify.search.expires') < Date.now()
INDEXS = JSON.parse(localStorage.getItem('docsify.search.index')) const expireKey = resolveExpireKey(config.namespace)
const indexKey = resolveIndexKey(config.namespace)
const isExpired = localStorage.getItem(expireKey) < Date.now()
INDEXS = JSON.parse(localStorage.getItem(indexKey))
if (isExpired) { if (isExpired) {
INDEXS = {} INDEXS = {}
@@ -172,7 +188,7 @@ export function init(config, vm) {
.get(vm.router.getFile(path), false, vm.config.requestHeaders) .get(vm.router.getFile(path), false, vm.config.requestHeaders)
.then(result => { .then(result => {
INDEXS[path] = genIndex(path, result, vm.router, config.depth) INDEXS[path] = genIndex(path, result, vm.router, config.depth)
len === ++count && saveData(config.maxAge) len === ++count && saveData(config.maxAge, expireKey, indexKey)
}) })
}) })
} }
+1 -1
View File
@@ -61,7 +61,7 @@ section.cover
max-width 500px max-width 500px
padding 0 padding 0
.cover-main > a[data-button] .cover-main > p:last-child a
border-color var(--theme-color, $color-primary) border-color var(--theme-color, $color-primary)
border-radius 2rem border-radius 2rem
border-style solid border-style solid