Compare commits

..
144 Commits
Author SHA1 Message Date
qingwei.li 25ccc79e56 -> v3.6.4 2017-04-28 08:03:56 +08:00
qingwei.li 890d29f982 bump: 3.6.4 2017-04-28 08:03:49 +08:00
qingwei.li 76c041ad48 fix(util): correctly clean up duplicate slashes, fixed #153 2017-04-28 08:02:54 +08:00
qingwei.li 2c277b8f79 -> v3.6.3 2017-04-25 12:41:29 +08:00
qingwei.li a5f6ccd1d1 bump: 3.6.3 2017-04-25 12:41:16 +08:00
qingwei.li 11c94b2149 changelog 3.6.3 2017-04-25 12:41:02 +08:00
qingwei.li 2653849a3e fix(external-script): script attrs 2017-04-25 12:39:58 +08:00
qingwei.li d7b0d1b949 docs: update cdn 2017-04-25 12:13:56 +08:00
Frances Coronelandcinwell.li 6911fb879b Add hire-me to showcase section 2017-04-21 08:14:22 +08:00
Kiko Beatsandcinwell.li 137a93c7b2 Add JS MythBusters to showcase (#148) 2017-04-17 20:32:38 +08:00
qingwei.li 5d5caa1f89 -> v3.6.2 2017-04-12 23:53:18 +08:00
qingwei.li 1dfd6cdcfe docs: add changelog 2017-04-12 23:53:11 +08:00
qingwei.li 91c6db2902 bump: 3.6.2 2017-04-12 23:52:25 +08:00
qingwei.li 94d6603c06 feat(external-script): detect more than one script dom, fixed #146 2017-04-12 23:51:16 +08:00
qingwei.li 920f624b5c -> v3.6.1 2017-04-12 23:46:46 +08:00
qingwei.li 8fb1350728 bump: 3.6.1 2017-04-12 23:46:46 +08:00
Mehdy Daraandcinwell.li c1df94662a GA: Send hash instead of complete href (#147)
On https://docsify.js.org/#/quickstart

send "#/quickstart" instead of "https://docsify.js.org/#/quickstart"
2017-04-12 23:45:58 +08:00
qingwei.li 9b7e5f5814 feat(event): Collapse the sidebar when click outside element in the small screen 2017-04-09 12:44:23 +08:00
qingwei.li 432bcfb54b -> v3.6.0 2017-04-09 12:12:32 +08:00
qingwei.li 4f98497284 bump: 3.6.0 2017-04-09 12:12:21 +08:00
cinwell.liandGitHub 9220523a40 feat(render): add mergeNavbar option, close #125, #124 (#145) 2017-04-09 12:10:37 +08:00
qingwei.li b8100c0755 -> v3.5.2 2017-04-05 21:31:27 +08:00
qingwei.li be0230ebe9 bump: 3.5.2 2017-04-05 21:31:22 +08:00
cinwell.liandGitHub aa6d2afce8 Merge pull request #143 from bojand/master
Properly handle anchor links local within a file. Fix #142
2017-04-01 10:26:36 +08:00
Bojan Djurkovic a706203879 add optional current route param to toURL and use it to properly compose local anchor links 2017-03-31 09:08:05 -03:00
Bojan Djurkovic fbc75bdb95 fix code style by removing semicolons 2017-03-30 20:37:26 -03:00
Bojan Djurkovic 5af174bd20 in toURL test for anchor links and if so prepend the currentPath to the generated path. fixes #142 2017-03-30 20:26:53 -03:00
qingwei.li e70327ab2b -> v3.5.1 2017-03-25 16:26:11 +08:00
qingwei.li 7209b82982 bump: 3.5.1 2017-03-25 16:26:07 +08:00
qingwei.li 594299ffbd fix: .md file extension regex 2017-03-25 16:25:03 +08:00
qingwei.li e9bbfd4c53 -> v3.5.0 2017-03-25 15:53:32 +08:00
qingwei.li 96bc09211e bump: 3.5.0 2017-03-25 15:53:23 +08:00
qingwei.li 8f11653b41 feat(route): auto remove .md extension 2017-03-25 15:52:21 +08:00
cinwell.liandGitHub 6aae64fd54 Merge pull request #138 from jrappen/master
Fixing some minor issues
2017-03-19 18:45:43 +08:00
Johannes Rappen 33b7c512bb fix QingWei-Li/docsify#126 2017-03-18 23:22:25 +01:00
Johannes Rappen bf35471a2b fix: adjust display on small screens 2017-03-18 19:09:24 +01:00
Johannes Rappen b022aaf14e fix: navbar labels for German 2017-03-18 18:01:44 +01:00
Johannes Rappen 03d8281868 update helper files 2017-03-18 17:21:59 +01:00
Johannes Rappen 4a0cfa799e move settings into a single object 2017-03-18 17:11:07 +01:00
qingwei.li 2c2ac5f461 -> v3.4.4 2017-03-17 17:12:47 +08:00
qingwei.li 1edcd63cdb bump: 3.4.4 2017-03-17 17:12:41 +08:00
qingwei.li 2d6a51b057 fix(search): fix input style 2017-03-17 17:11:46 +08:00
cinwell.liandGitHub bf1ae7802d Merge pull request #135 from xsdlr/master
fix search plugin match bug
2017-03-17 16:45:49 +08:00
xsdlr cf9b7c99e4 fix search plugin match bug 2017-03-16 18:29:02 +08:00
qingwei.li c20f3298d8 -> v3.4.3 2017-03-16 08:51:01 +08:00
qingwei.li dd7d9aa4ad bump: 3.4.3 2017-03-16 08:50:51 +08:00
qingwei.li bba957d3bc docs: add docsify-ignore 2017-03-16 08:48:21 +08:00
cinwell.liandGitHub 28b3cb4249 Merge pull request #133 from jrappen/master
fix erroneously removal of "themes" from files, fix #132
2017-03-16 07:06:26 +08:00
Johannes Rappen 97e730d7e3 fix erroneously removal of "themes" from files, fix QingWei-Li/docsify#132 2017-03-16 00:00:02 +01:00
cinwell.liandGitHub 65a6b3c659 Merge pull request #132 from jrappen/master
fix some minor issues
2017-03-16 06:37:26 +08:00
Johannes Rappen f6b827f7bc fix some links 2017-03-15 22:32:33 +01:00
Johannes Rappen 24d1b0feb6 use rem instead of em, fix QingWei-Li/docsify#116 2017-03-15 22:23:48 +01:00
Johannes Rappen 54da5fb6c8 update package.json
* remove "themes" from "files" as it is a subfolder of "src"
* reorder elements
* update dependencies
* update devDependencies
* make author a dictionary
2017-03-15 22:07:28 +01:00
Chris Anselmoandcinwell.li d57b80e224 Add ability to ignore headers when generating toc (#127)
* Added ability to ignore some or all headings when generating toc in sidebar

* Added documentation for ignoring sub headers

* Fixed minor test issues
2017-03-15 15:50:26 +08:00
cinwell.liandGitHub 788bbb36b4 Merge pull request #122 from Leopoldthecoder/master
fix external-script not inserting script at right place
2017-03-12 20:54:17 +08:00
Leopoldthecoder 92070e3099 fix external-script not inserting script at right place 2017-03-12 20:18:46 +08:00
qingwei.li de0ad0f04c docs(index.html): update languages 2017-03-12 08:44:52 +08:00
qingwei.li ceafc37bb3 docs(index.html): update config 2017-03-12 08:27:29 +08:00
cinwell.liandGitHub 1f19cb2ade Merge pull request #121 from jrappen/master
add German docs
2017-03-12 08:10:42 +08:00
Johannes Rappen 33393ef0f6 add German docs 2017-03-11 22:13:25 +01:00
qingwei.li 4ff8fb2c60 -> v3.4.2 2017-03-11 19:33:03 +08:00
qingwei.li 9b858fc4c4 bump: 3.4.2 2017-03-11 19:31:57 +08:00
qingwei.li 3aef37a445 feat(emojify): add no-emoji option 2017-03-11 19:30:38 +08:00
qingwei.li 37daa7ef9c docs(vue): fix typo 2017-03-11 18:27:43 +08:00
qingwei.li b0da9f23d3 docs(vue): fix typo 2017-03-11 18:16:34 +08:00
qingwei.li 1f66e61f63 -> v3.4.1 2017-03-10 12:02:32 +08:00
qingwei.li 5f07d5a9f3 bump: 3.4.1 2017-03-10 12:02:23 +08:00
qingwei.li d1d8f88a1a add changelog 2017-03-10 12:00:47 +08:00
qingwei.li b9a7275c8f fix(dom): Disable the dom cache when vue is present, fixed #119 2017-03-10 11:58:27 +08:00
cinwell.liandGitHub 0fddd1ced4 Merge pull request #118 from jrappen/master
Update English docs and sort css
2017-03-10 11:57:59 +08:00
Johannes Rappen 262bf13964 order css source alphabetically 2017-03-09 22:22:35 +01:00
Johannes Rappen 0b1fc2343f update main markdown files 2017-03-09 22:19:57 +01:00
Johannes Rappen 6eada5a2f7 update english docs 2017-03-09 22:19:07 +01:00
qingwei.li 86923d03d3 -> v3.4.0 2017-03-09 20:30:44 +08:00
qingwei.li 8b696cd99d bump: 3.4.0 2017-03-09 20:30:38 +08:00
qingwei.li 3b30d42e9a add changelog 2017-03-09 20:29:01 +08:00
qingwei.li 50fa6fcb89 feat(zoom-image): add plugin 2017-03-09 20:26:33 +08:00
qingwei.li 8463f4d5c5 -> v3.3.0 2017-03-07 12:00:47 +08:00
qingwei.li 9e7d365872 bump: 3.3.0 2017-03-07 12:00:23 +08:00
cinwell.liandGitHub 9e9ad57540 Merge pull request #115 from Leopoldthecoder/master
add external-script plugin
2017-03-07 11:57:13 +08:00
Leopoldthecoder 9c54bafae4 switch to doneEach and cache #main dom 2017-03-07 11:30:09 +08:00
Leopoldthecoder 1aa6636ba8 add external-script plugin 2017-03-06 23:57:28 +08:00
qingwei.li 723a6040f2 docs: fix typo, fixed #114 2017-03-05 10:26:59 +08:00
gpreslandandcinwell.li d6b5403982 Update dictory structure in more-pages.md (#113)
Cleaner unicode structure.
2017-03-04 14:53:22 +08:00
杨奕andcinwell.li 9f0fc83b54 Fix nav showing while loading (#112) 2017-03-03 10:43:36 +08:00
Prayag Vermaandcinwell.li b02e1f1409 Fix a typo (#111)
ture → true
2017-03-02 14:05:03 +08:00
qingwei.li bca7b00c94 Update changelog 2017-02-28 22:06:17 +08:00
qingwei.li 0ae14e8ddc -> v3.2.0 2017-02-28 22:03:53 +08:00
qingwei.li 61e0aacb43 bump: 3.2 2017-02-28 22:03:47 +08:00
qingwei.li b927a30cc6 docs(changelog): 3.2 2017-02-28 22:03:09 +08:00
qingwei.li 0d59ee939f fix(render): Toc rendering error, fixed #106 2017-02-28 22:03:09 +08:00
qingwei.li 0aead898eb docs: updates 2017-02-28 22:03:09 +08:00
qingwei.li d3c9fbd124 feat(search): Localization for no data tip, close #103 2017-02-28 22:03:09 +08:00
qingwei.li f3fc596951 fix(fetch): load sidebar and navbar for parent path, fixed #100 2017-02-28 22:03:09 +08:00
qingwei.li 07a2a91296 docs(configuration): nameLink 2017-02-28 22:03:09 +08:00
qingwei.li 8ad835ca26 feat(render) nameLink for each route, fixed #99 2017-02-28 22:03:09 +08:00
qingwei.li 0994663c5a -> v3.1.2 2017-02-27 11:47:26 +08:00
qingwei.li 5067769a65 bump: 3.1.2 2017-02-27 11:47:22 +08:00
woshiguabiandcinwell.li 92d6e8a1ee Update search.js 2017-02-27 11:45:14 +08:00
qingwei.li 0dd9feffe5 -> v3.1.1 2017-02-24 20:19:40 +08:00
qingwei.li 82173627e5 bump: 3.1.1 2017-02-24 20:19:34 +08:00
qingwei.li 507d9e834c fix(search): dont search nameLink, fixed #102 2017-02-24 20:18:17 +08:00
qingwei.li 83ae93cae0 docs: update package size 2017-02-24 20:18:17 +08:00
qingwei.li 8f9bf29ee5 fix(render): custom cover background image 2017-02-24 20:18:17 +08:00
qingwei.li d67d25fed4 fix(tpl): extra character, fixed #101 2017-02-24 20:18:17 +08:00
qingwei.li 95a324c7e0 docs: update changelog 2017-02-22 22:32:51 +08:00
qingwei.li 5712c1f59d -> v3.1.0 2017-02-22 22:31:25 +08:00
qingwei.li 490a2cd64e bump: 3.1 2017-02-22 22:31:16 +08:00
qingwei.li b8a3d8f380 fix(search): incorrect anchor link, fixed #90 2017-02-22 22:30:07 +08:00
qingwei.li 855c450a97 feat(emoji): add emoji plugin 2017-02-22 22:30:07 +08:00
qingwei.li 2521c58c73 docs: tweaks 2017-02-22 22:11:05 +08:00
sokamalandcinwell.li 8df746e9d1 add emojis (#93)
* 更新 emoji 支持,增加 github emoji 列表,防止 “2017-02-22 15:13:22” 中的 :13: 被转义。

* 修正代码格式。
2017-02-22 16:40:48 +08:00
Le Liuandcinwell.li 2945e94e3c fix the extra character when github corner is enabled (#91) 2017-02-22 14:02:16 +08:00
qingwei.li 083cc4af56 docs(sw): cache unpkg.com 2017-02-22 09:39:17 +08:00
qingwei.li 5cab56cc92 docs(pwa): fix typo 2017-02-21 23:00:22 +08:00
qingwei.li d8ad679e2c docs(pwa): add pwa 2017-02-21 22:16:10 +08:00
qingwei.li f2975a5e5e fix(sw): update white list 2017-02-21 21:30:35 +08:00
qingwei.li 58789bfec7 -> v3.0.5 2017-02-21 21:22:36 +08:00
qingwei.li e7e519bad2 bump: 3.0.5 2017-02-21 21:22:25 +08:00
qingwei.li f7111b5903 feat(pwa): add sw.js 2017-02-21 21:21:24 +08:00
qingwei.li 42b2dba589 fix(layout.css): loading style 2017-02-21 21:21:24 +08:00
qingwei.li 2a1157a706 fix(event): highlight sidebar when clicked, fixed #86 2017-02-21 21:21:24 +08:00
qingwei.li 3394ebb9a5 fix(gen-tree): cache toc list, fixed #88 2017-02-21 21:21:24 +08:00
qingwei.li b4fc6a9d72 fix typo 2017-02-21 14:05:58 +08:00
Jintzoandcinwell.li feb4b89461 Update docs: Getting started (#85)
* fixed look of links in blockquote

* updated main README

* updated getting started

* updated more-pages

* make custom sidebar loading clear

* updated custom navbar

* added markdown comments

* updated cover documentation

* updated cover page

* updated sidebar
2017-02-21 14:04:16 +08:00
qingwei.li 83d7862505 -> v3.0.4 2017-02-20 08:59:43 +08:00
qingwei.li 75686f1624 bump: 3.0.4 2017-02-20 08:59:38 +08:00
qingwei.li 780c1e580e fix(render): execute script 2017-02-20 08:57:09 +08:00
qingwei.li 35dd2e16fa fix(render): disable rendering sub list when loadSidebar is false 2017-02-19 23:23:43 +08:00
qingwei.li be6dcacde7 -> v3.0.3 2017-02-19 22:53:05 +08:00
qingwei.li 066fff4beb bump: 3.0.3 2017-02-19 22:52:59 +08:00
Le Liuandcinwell.li 42fb331079 Change description for Snipaste (#84) 2017-02-19 22:50:05 +08:00
Jintzoandcinwell.li f15e45c693 fixed look of links in blockquote 2017-02-19 22:49:44 +08:00
qingwei.li 6b08546654 fix(scroll) highlight bug 2017-02-19 22:29:35 +08:00
qingwei.li 46ff5e14bf tweaks code 2017-02-19 20:11:27 +08:00
qingwei.li b51d714d3c -> v3.0.2 2017-02-19 15:27:49 +08:00
qingwei.li 2c9fdbe7f9 bump: 3.0.2 2017-02-19 15:27:39 +08:00
qingwei.li bf593a77ad fix(search): add lazy input 2017-02-19 15:25:36 +08:00
qingwei.li 3b127a161c fix(compiler): link 2017-02-19 15:06:21 +08:00
qingwei.li 20a83808f3 -> v3.0.1 2017-02-19 14:55:28 +08:00
qingwei.li 4419b2119e bump: 3.0.1 2017-02-19 14:55:20 +08:00
qingwei.li cd99b522e7 fix(route): empty alias 2017-02-19 14:54:22 +08:00
qingwei.li 787656a1ee docs(index): enable execute script 2017-02-19 14:44:37 +08:00
qingwei.li f573caa3c6 docs(cover): update version number 2017-02-19 14:41:27 +08:00
109 changed files with 4518 additions and 1050 deletions
+1
View File
@@ -0,0 +1 @@
.git/
+3 -1
View File
@@ -1,5 +1,7 @@
{
"extends": ["vue"],
"extends": [
"vue"
],
"env": {
"browser": true
},
+5
View File
@@ -0,0 +1,5 @@
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.
+2 -2
View File
@@ -1,4 +1,4 @@
.DS_Store
*.log
.DS_Store
/themes
node_modules
/themes
+5
View File
@@ -0,0 +1,5 @@
.eslintignore
.eslintrc
.github/
.gitignore
.travis.yml
+4 -1
View File
@@ -1,6 +1,9 @@
sudo: false
cache:
directories:
- $HOME/.yarn-cache
- $HOME/.yarn-cache
language: node_js
node_js: stable
os:
- linux
- osx
+130 -12
View File
@@ -1,15 +1,133 @@
# Changelog
3.0.0 / 2017-02-19
==================
## 3.6.4 / 2017-04-28
#### Breaking change
- Not support IE9
- The route becomes: `/#/page?id=slug`. The previous route will be redirected
#### Features
- Faster rendering
- Clearer source code
- More powerful API
- Auto header for each page [#78](https://github.com/QingWei-Li/docsify/issues/78)
- Localization for search plugin [#80](https://github.com/QingWei-Li/docsify/issues/80)
- Execute the script in markdown (see `executeScript`)
* fix(util): correctly clean up duplicate slashes, fixed ([#153](https://github.com/QingWei-Li/docsify/issues/153)
## 3.6.3 / 2017-04-25
* fix(external-script): script attrs
## 3.6.2/ 2017-04-12
* feat(external-script): detect more than one script dom, fixed ([#146](https://github.com/QingWei-Li/docsify/issues/146)
* GA: Send hash instead of complete href (#147)
## 3.6.1 / 2017-04-09
* feat(event): Collapse the sidebar when click outside element in the small screen
## 3.6.0 / 2017-04-09
* feat(render): add mergeNavbar option, close ([#125](https://github.com/QingWei-Li/docsify/issues/125)
## 3.5.2/ 2017-04-05
* add optional current route param to toURL and use it to properly compose local anchor links
* fix code style by removing semicolons
* in toURL test for anchor links and if so prepend the currentPath to the generated path. fixes ([#142](https://github.com/QingWei-Li/docsify/issues/142))
## 3.5.1 / 2017-03-25
* fix: .md file extension regex
## 3.5.0 / 2017-03-25
* feat(route): auto remove .md extension
* fix: adjust display on small screens [@jrappen](https://github.com/jrappen)
* fix: navbar labels for German [@jrappen](https://github.com/jrappen)
## 3.4.4 / 2017-03-17
* fix(search): fix input style
* fix search plugin match bug
## 3.4.3 / 2017-03-16
* Add ability to ignore headers when generating toc ([#127](https://github.com/QingWei-Li/docsify/issues/127) [@christopherwk210](https://github.com/christopherwk210))
* fix external-script not inserting script at right place [@Leopoldthecoder](https://github.com/Leopoldthecoder)
* add German docs [@jrappen](https://github.com/jrappen)
## 3.4.2 / 2017-03-11
* feat(emojify): add no-emoji option
## 3.4.1 / 2017-03-10
* fix(dom): Disable the dom cache when vue is present, fixed [#119](https://github.com/QingWei-Li/docsify/issues/119)
* update english docs, [@jrappen](https://github.com/jrappen)
## 3.4.0 / 2017-03-09
* feat(zoom-image): add plugin
## 3.3.0 / 2017-03-07
* add front-matter plugin
* add external-script plugin, [@Leopoldthecoder](https://github.com/Leopoldthecoder)
* Fix nav showing while loading ([#112](https://github.com/QingWei-Li/docsify/issues/112))
## 3.2.0 / 2017-02-28
* fix(render): Toc rendering error, fixed [#106](https://github.com/QingWei-Li/docsify/issues/106)
* feat(search): Localization for no data tip, close [#103](https://github.com/QingWei-Li/docsify/issues/103)
* fix(fetch): load sidebar and navbar for parent path, fixed [#100](https://github.com/QingWei-Li/docsify/issues/100)
* feat(render) nameLink for each route, fixed [#99](https://github.com/QingWei-Li/docsify/issues/99)
## 3.1.2 / 2017-02-27
* fix(search): dont search nameLink, fixed [#102](https://github.com/QingWei-Li/docsify/issues/102)
## 3.1.1 / 2017-02-24
* fix(search): dont search nameLink, fixed [#102](https://github.com/QingWei-Li/docsify/issues/102)
* fix(render): custom cover background image
* fix(tpl): extra character, fixed [#101](https://github.com/QingWei-Li/docsify/issues/101)
## 3.1.0 / 2017-02-22
* fix(search): incorrect anchor link, fixed [#90](https://github.com/QingWei-Li/docsify/issues/90)
* feat(emoji): add emoji plugin
## 3.0.5 / 2017-02-21
* feat(pwa): add sw.js
* fix(layout.css): loading style
* fix(event): highlight sidebar when clicked, fixed [#86](https://github.com/QingWei-Li/docsify/issues/86)
* fix(gen-tree): cache toc list, fixed [#88](https://github.com/QingWei-Li/docsify/issues/88)
## 3.0.4 / 2017-02-20
* fix(render): execute script
* fix(render): disable rendering sub list when loadSidebar is false
## 3.0.3 / 2017-02-19
* fixed look of links in blockquote
* fix(scroll) highlight bug
## 3.0.2 / 2017-02-19
* fix(search): add lazy input
* fix(compiler): link
## 3.0.1 / 2017-02-19
* fix(route): empty alias
## 3.0.0 / 2017-02-19
##### Breaking change
* Not support IE9
* The route becomes: `/#/page?id=slug`. The previous route will be redirected
##### Features
* Faster rendering
* Clearer source code
* More powerful API
* Auto header for each page [#78](https://github.com/QingWei-Li/docsify/issues/78)
* Localization for search plugin [#80](https://github.com/QingWei-Li/docsify/issues/80)
* Execute the script in markdown (see `executeScript`)
+247 -121
View File
@@ -3,22 +3,24 @@
> 2017-02-15
#### Bug fixes
* fix emoji replacing error (#76)
* fix emoji replacing error ([#76](https://github.com/QingWei-Li/docsify/issues/76))
### 2.4.2
> 2017-02-14
#### Bug fixes
- fix(index): load file path error
* fix(index): load file path error
### 2.4.1
> 2017-02-13
#### Bug fixes
- fix(index): cover page
* fix(index): cover page
### 2.4.0
@@ -26,8 +28,7 @@
#### Features
- feat(hook): add `doneEach`
* feat(hook): add `doneEach`
### 2.3.0
@@ -35,352 +36,477 @@
#### Features
- feat(src): add alias feature
- docs: update all documents
- feat(src): dynamic title
- feat(hook): support custom plugin
- feat(themes): add dark theme
* feat(src): add alias feature
* docs: update all documents
* feat(src): dynamic title
* feat(hook): support custom plugin
* feat(themes): add dark theme
#### Bug fixes
- fix(event): `auto2top` has no effect on a FF mobile browser, fixed #67
- fix: sidebar style
- fix(render): fix render link
* fix(event): `auto2top` has no effect on a FF mobile browser, fixed #67
* fix: sidebar style
* fix(render): fix render link
### 2.2.1
> 2017-02-11
#### Bug fixes
- fix(search): crash when not content, fixed #68
- fix(event): scroll active sidebar
- fix(search): not work in mobile
* fix(search): crash when not content, fixed [#68](https://github.com/QingWei-Li/docsify/issues/68)
* fix(event): scroll active sidebar
* fix(search): not work in mobile
### 2.2.0
#### Features
- Add `Google Analytics` plugin.
```html
<script src="//unpkg.com/docsify" data-ga="UA-XXXXX-Y"></script>
<script src="//unpkg.com/docsify/lib/plugins/ga.js"></script>
```
* Add `Google Analytics` plugin.
```html
<script src="//unpkg.com/docsify" data-ga="UA-XXXXX-Y"></script>
<script src="//unpkg.com/docsify/lib/plugins/ga.js"></script>
```
### 2.1.0
#### Features
- Add search plugin
```html
<script src="//unpkg.com/docsify"></script>
<script src="//unpkg.com/docsify/lib/plugins/search.js"></script>
```
* Add search plugin
```html
<script src="//unpkg.com/docsify"></script>
<script src="//unpkg.com/docsify/lib/plugins/search.js"></script>
```
#### Bug fixes
- fix sidebar style
* fix sidebar style
### 2.0.3
#### Bug fixes
- fix: rendering emojis
- fix: css var polyfill
* fix: rendering emojis
* fix: css var polyfill
### 2.0.2
#### Bug fixes
- fix button style in cover page.
* fix button style in cover page.
### 2.0.1
#### Bug fixes
- border style.
* border style.
### 2.0.0
#### Features
- Customize the theme color
* Customize the theme color
#### Break change
- Remove `data-router`, `data-sidebar`, `data-sidebar-toggle` APIs
* Remove `data-router`, `data-sidebar`, `data-sidebar-toggle` APIs
### 1.10.5
#### Bug fixes
- fix initialize the Vue instance
* fix initialize the Vue instance
### 1.10.4
#### Bug fixes
- fix execute script
* fix execute script
### 1.10.3
#### Bug fixes
- compatible vuep QingWei-Li/vuep/issues/2
- fix sidebar scroll, fixed #63
* compatible vuep ([#2](https://github.com/QingWei-Li/vuep/issues/2))
* fix sidebar scroll, fixed [#63](https://github.com/QingWei-Li/docsify/issues/63)
### 1.10.2
#### Bug fixes
- Fix render emojis again
* Fix render emojis again
### 1.10.1
#### Bug fixes
- Fix render emojis
* Fix render emojis
### 1.10.0
#### Features
- Support emoji :laughing:
* Support emoji :laughing:
### 1.9.0
#### Bug fixes
- Destroys the vue instance when the route is changed
* Destroys the vue instance when the route is changed
#### Features
- Add `!>` and `?>` doc helper.
* Add `!>` and `?>` doc helper.
#### Break change
- Remove `!` doc helper.
* Remove `!` doc helper.
### 1.8.0
#### Bug fixes
- Using `v-pre` skip compilation.
* Using `v-pre` skip compilation.
### Features
- Execute script when vue exists.
* Execute script when vue exists.
### 1.7.4
#### Bug fixes
- Fix bugs caused by the previous version
* Fix bugs caused by the previous version
### 1.7.3
#### Bug fixes
- Add `hr` style
- Fixed option is an empty string
* Add `hr` style
* Fixed option is an empty string
### 1.7.2
#### Bug fixes
- Fix sidebar click event in mobile browser.
* Fix sidebar click event in mobile browser.
### 1.7.1
#### Bug fixes
- Fix sidebar style in mobile browser.
* Fix sidebar style in mobile browser.
### 1.7.0
#### Bug fixes
- Fixed custom cover background, fixed #52
- Fixed sticky sidebar
* Fixed custom cover background, fixed [#52](https://github.com/QingWei-Li/docsify/issues/52)
* Fixed sticky sidebar
### Features
- Add `name` and `nameLink`
* Add `name` and `nameLink`
### 1.6.1
#### Bug fixes
- Fixed sidebar bug when the coverpage exist
* Fixed sidebar bug when the coverpage exist
### 1.6.0
#### Features
- Improve sidebar performance. The active item is automatically scrolled in the visible view.
- New doc helper: `! `. e.g. `! content` will be rendered as `<p class="tip">content</p>`
* Improve sidebar performance. The active item is automatically scrolled in the visible view.
* New doc helper: `! `. e.g. `! content` will be rendered as `<p class="tip">content</p>`
### 1.5.2
#### Bug fixes
- Fixed number at the beginning of the slug
* Fixed number at the beginning of the slug
### 1.5.1
#### Bug fixes
- Remove HTML tag when handling slug
* Remove HTML tag when handling slug
### 1.5.0
#### Bug fixes
- Fix slugify.
- Fix nav highlight.
* Fix slugify.
* Fix nav highlight.
#### Features
- Initialize the configuration by `window.$docsify`.
- Markdown parser is configurable.
* Initialize the configuration by `window.$docsify`.
* Markdown parser is configurable.
### 1.4.3
#### Bug fixes
- Tweak style.
* Tweak style.
### 1.4.2
#### Bug fixes
- Fix toggle button style.
- Support `mailto`, `tel`, etc. href type
- Fix scroll to top.
* Fix toggle button style.
* Support `mailto`, `tel`, etc. href type
* Fix scroll to top.
### 1.4.1
#### Bug fixes
- Fix generate slug.
* Fix generate slug.
### 1.4.0 Happly new year 🎉
#### Features
- Display TOC in the custom sidebar, `data-sub-max-level`.
- Custom background in coverpage.
* Display TOC in the custom sidebar, `data-sub-max-level`.
* Custom background in coverpage.
#### Bug fixes
- Fix scroll highlight when Vue exist.
* Fix scroll highlight when Vue exist.
### 1.3.5
#### Bug fixes
- Fix vue
* Fix vue
### 1.3.4
#### Bug fixes
- Supports [vuep](https://github.com/QingWei-Li/vuep)
* Supports [vuep](https://github.com/QingWei-Li/vuep)
### 1.3.3
#### Bug fixes
- Fixed cover rendering timing
* Fixed cover rendering timing
### 1.3.2
#### Bug fixes
- Fixed render link
* Fixed render link
### 1.3.1
#### Bug fixes
- Fixed cover page style
- Generate the correct link when rendering the article
* Fixed cover page style
* Generate the correct link when rendering the article
### 1.3.0
#### Features
- Add cover page
- add `<kbd>` style
- headling can be cliked
* Add cover page
* add `<kbd>` style
* headling can be cliked
#### Bug fixes
- sidebar highlight
* sidebar highlight
#### break change
- Navbar no longer fixed at the top
* Navbar no longer fixed at the top
### 1.2.0
#### Features
- custom basePath
- custom homepage
* custom basePath
* custom homepage
### 1.1.7
#### Bug fixes
- Optimize progress bar
* Optimize progress bar
### 1.1.6
#### Features
- Add logo 😂
* Add logo 😂
#### Bug fixes
- Remove table background color
- Fixed highlight sidebar using chinese ids
* Remove table background color
* Fixed highlight sidebar using chinese ids
### 1.1.5
#### Features
- Add table style
#### Bug fixes
- Not fixed position of hte navbar in the mobile browser
- Correct calculation of whether the mobile browser
* Not fixed position of hte navbar in the mobile browser
* Correct calculation of whether the mobile browser
### 1.1.4
#### Bug fixes
- Fixed chinese auchor link
* Fixed chinese auchor link
### 1.1.3
#### Bug fixes
- Optimize progress bar again
* Optimize progress bar again
### 1.1.2
#### Bug fixes
- fix failed `auto2top` in mobile
* fix failed `auto2top` in mobile
### 1.1.1
#### Bug fixes
- Optimize progress bar
### 1.1.0
#### Features
- Add progress bar
- Add `auto2top` option for hash router
* Add progress bar
* Add `auto2top` option for hash router
### 1.0.3
#### Bug fixes
- Fix cache
### 1.0.2
#### Bug fixes
- Fix binding events bug, fixed #24
- Fix regular expression, fixed #23
* Fix binding events bug, fixed [#24](https://github.com/QingWei-Li/docsify/issues/24)
* Fix regular expression, fixed [#23](https://github.com/QingWei-Li/docsify/issues/23)
### 1.0.1
#### Bug fixes
- `img` style
* `img` style
### 1.0.0
#### Features
- Support hash router
* Support hash router
#### Bug fixes
- Improved scrolling on mobile
* Improved scrolling on mobile
### 0.7.0
#### Breaking change
- `themes/` was removed, only exists in the npm package.
* `themes/` was removed, only exists in the npm package.
#### Bug fixes
- Fix style.
- Fix sidebar animation again.
* Fix style.
* Fix sidebar animation again.
### 0.6.1
#### Bug fixes
- In the mobile, it should collapse the sidebar when toggle is clicked.
- Fix the dropdown list style.
- Fix sidebar animation.
* In the mobile, it should collapse the sidebar when toggle is clicked.
* Fix the dropdown list style.
* Fix sidebar animation.
### 0.6.0
#### Features
- Navbar support dropdown list, #6
- Sidebar with toggle
* Navbar support dropdown list, [#6](https://github.com/QingWei-Li/docsify/issues/6)
* Sidebar with toggle
#### Bug fixes
- Fix ineffective option, fixed #10
* Fix ineffective option, fixed [#10](https://github.com/QingWei-Li/docsify/issues/10)
### 0.5.0
#### Features
- Custom sidebars and navbars by markdown file
* Custom sidebars and navbars by markdown file
### 0.4.2
#### Bug fixes
- Correct catch ajax error
* Correct catch ajax error
### 0.4.1
#### Bug fixes
- catch ajax error
* catch ajax error
### 0.4.0
#### Features
- Custom sidebar
* Custom sidebar
#### Bug fixes
- Fix undefined language
* Fix undefined language
### 0.3.1
#### Bug fixes
- Strip HTML tag when rendering the headings
* Strip HTML tag when rendering the headings
### 0.3.0
#### Features
- Add minified css files
- Add max level option
- Add pure.css
* Add minified css files
* Add max level option
* Add pure.css
### 0.2.1
#### Bug fixes
- Fix vue.css
* Fix vue.css
### 0.2.0
#### Bug fixes
- Fix route
- Remove dynamic title
* Fix route
* Remove dynamic title
### 0.1.0
#### Features
- Add buble.css
* Add buble.css
+30 -18
View File
@@ -9,59 +9,70 @@
</p>
<p align="center">
<a href="https://travis-ci.org/QingWei-Li/docsify"><img alt="Travis Status" src="https://img.shields.io/travis/rust-lang/rust/master.svg?style=flat-square"></a>
<a href="https://travis-ci.org/QingWei-Li/docsify"><img alt="Travis Status" src="https://img.shields.io/travis/QingWei-Li/docsify/master.svg?style=flat-square"></a>
<a href="https://www.npmjs.com/package/docsify"><img alt="npm" src="https://img.shields.io/npm/v/docsify.svg?style=flat-square"></a>
<a href="https://github.com/QingWei-Li/donate"><img alt="donate" src="https://img.shields.io/badge/%24-donate-ff69b4.svg?style=flat-square"></a>
</p>
## Links
- [Documentation](https://docsify.js.org)
- [CLI](https://github.com/QingWei-Li/docsify-cli)
## Features
- Not build static html files
- Simple and lightweight (~14kB gzipped)
- No statically built html files
- Simple and lightweight (~16kB gzipped)
- Smart full-text search plugin
- Multiple themes
- Useful plugin API
- Compatible with IE10+
## Quick start
Create a `index.html`.
index.html
Create an `index.html`.
```html
<!-- index.html -->
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="//unpkg.com/docsify/themes/vue.css">
<link rel="stylesheet" href="//unpkg.com/docsify/lib/themes/vue.css">
</head>
<body>
<div id="app"></div>
</body>
<script src="//unpkg.com/docsify"></script>
<script src="//unpkg.com/docsify/lib/docsify.min.js"></script>
</html>
```
## Browser Support
Modern browsers and Internet Explorer 9+.
Modern browsers and Internet Explorer 10+.
## Showcase
These open-source projects are using docsify to generate their sites. Pull requests welcome : )
- [Snipaste](https://docs.snipaste.com/) - A new way to boost your productivity.
- [puck](https://puck.zz173.com/) - A small & magical php framework.
- [Samaritan](http://samaritan.stockdb.org) - An Algorithmic Trading Framework for Digital Currency.
- [Vudash](http://vudash.github.io/vudash/) - Powerful, Flexible, Open Source dashboards for anything
- [Trilogy](http://trilogy.js.org) - No-hassle SQLite with a Promise-based, document store style API.
- [Mybatis-Plus](http://mp.baomidou.com/) - An enhanced toolkit of Mybatis to simplify development
These open-source projects are using docsify to generate their sites. Pull requests welcome :blush:
| Project | Description |
|---|---|
| [Snipaste](https://docs.snipaste.com/) | Snip & Paste |
| [puck](https://puck.zz173.com/) | A small & magical php framework. |
| [Samaritan](http://samaritan.stockdb.org) | An Algorithmic Trading Framework for Digital Currency. |
| [Vudash](http://vudash.github.io/vudash/) | Powerful, Flexible, Open Source dashboards for anything |
| [Trilogy](http://trilogy.js.org) | No-hassle SQLite with a Promise-based, document store style API. |
| [Mybatis-Plus](http://mp.baomidou.com/) | An enhanced toolkit of Mybatis to simplify development |
| [JS MythBusters](https://mythbusters.js.org) | An optimization handbook from a high level point of view. |
| [hire-me](https://fvcproductions.github.io/hire-me) | A path to getting an awesome tech gig. |
## Similar projects
- [docute](https://github.com/egoist/docute) - 📜 Effortlessly documentation done right
- [docpress](https://github.com/docpress/docpress) - Documentation website generator
| Project | Description |
|---|---|
| [docute](https://github.com/egoist/docute) | 📜 Effortlessly documentation done right |
| [docpress](https://github.com/docpress/docpress) | Documentation website generator |
## Contributing
@@ -69,7 +80,7 @@ These open-source projects are using docsify to generate their sites. Pull reque
- Create your feature branch: `git checkout -b my-new-feature`
- Commit your changes: `git commit -am 'Add some feature'`
- Push to the branch: `git push origin my-new-feature`
- Submit a pull request :D
- Submit a pull request
## Development
@@ -80,4 +91,5 @@ open http://localhost:3000
```
## License
MIT
+12 -3
View File
@@ -2,6 +2,7 @@ var rollup = require('rollup')
var buble = require('rollup-plugin-buble')
var commonjs = require('rollup-plugin-commonjs')
var nodeResolve = require('rollup-plugin-node-resolve')
var string = require('rollup-plugin-string')
var uglify = require('rollup-plugin-uglify')
var isProd = process.argv[process.argv.length - 1] !== '--dev'
@@ -9,7 +10,12 @@ var build = function (opts) {
rollup
.rollup({
entry: 'src/' + opts.entry,
plugins: [buble(), commonjs(), nodeResolve()].concat(opts.plugins || [])
plugins: (opts.plugins || []).concat([
string({ include: '**/*.css' }),
buble(),
commonjs(),
nodeResolve()
])
})
.then(function (bundle) {
var dest = 'lib/' + (opts.output || opts.entry)
@@ -33,8 +39,11 @@ build({
var plugins = [
{ name: 'search', entry: 'search/index.js', moduleName: 'Search' },
{ name: 'ga', entry: 'ga.js', moduleName: 'GA' }
// { name: 'front-matter', entry: 'front-matter/index.js', moduleName: 'FrontMatter' }
{ name: 'ga', entry: 'ga.js', moduleName: 'GA' },
{ name: 'emoji', entry: 'emoji.js', moduleName: 'Emoji' },
{ name: 'external-script', entry: 'external-script.js', moduleName: 'ExternalScript' },
{ name: 'front-matter', entry: 'front-matter/index.js', moduleName: 'FrontMatter' },
{ name: 'zoom-image', entry: 'zoom-image.js', moduleName: 'ZoomImage' }
]
plugins.forEach(item => {
+15 -13
View File
@@ -7,29 +7,31 @@
<link rel="stylesheet" href="/themes/vue.css" title="vue">
<link rel="stylesheet" href="/themes/dark.css" title="dark" disabled>
<link rel="stylesheet" href="/themes/buble.css" title="buble" disabled>
<style>
nav.app-nav li ul {
min-width: 100px;
}
</style>
</head>
<body>
<nav data-cloak>
<a href="#/">EN</a>
<a href="#/zh-cn/">中文</a>
</nav>
<div id="app"></div>
</body>
<script>
window.$docsify = {
alias: {
'/de-de/changelog': '/changelog',
'/zh-cn/changelog': '/changelog',
'/changelog': 'https://raw.githubusercontent.com/QingWei-Li/docsify/master/CHANGELOG'
},
executeScript: true
auto2top: true,
basePath: '/docs/',
executeScript: true,
loadNavbar: true,
loadSidebar: true,
name: 'docsify',
subMaxLevel: 2,
mergeNavbar: true
}
</script>
<script
src="/lib/docsify.js"
data-name="sdfsdf"
data-name-link="//www.baidu.com"
data-base-path="/docs/"
data-load-sidebar
data-sub-max-level="2"
data-auto2top></script>
<script src="/lib/docsify.js"></script>
</html>
+11 -11
View File
@@ -4,24 +4,24 @@
## What is it
docsify generates your documentation website on the fly. Unlike GitBook, it does not generate static html files. It smartly loads and parses your Markdown files and displays them in website. All you need to do is create an `index.html` to start and [deploy it on GitHub Pages](/deploy).
docsify generates your documentation website on the fly. Unlike GitBook, it does not generate static html files. Instead, it smartly loads and parses your Markdown files and displays them as website. All you need to do is create an `index.html` to start and [deploy it on GitHub Pages](deploy.md).
See the [Quick start](/quickstart) for more details.
See the [Quick start](quickstart.md) for more details.
## Features
- Not build static html files
- Simple and lightweight (~14kB gzipped)
- Smart full-text search plugin
- Multiple themes
- Useful plugin API
- Compatible with IE10+
* No statically built html files
* Simple and lightweight (~16kB gzipped)
* Smart full-text search plugin
* Multiple themes
* Useful plugin API
* Emoji support
* Compatible with IE10+
## Examples
Check out the [Showcase](https://github.com/QingWei-Li/docsify/#showcase) to see use the docsify generated website.
Check out the [Showcase](https://github.com/QingWei-Li/docsify/#showcase) to docsify in use.
## Donate
If you think docsify is helpful to you or that my work is valuable. I am happy if you can help me [buy a cup of coffee](https://github.com/QingWei-Li/donate). :heart:
Please consider donating if you think docsify is helpful to you or that my work is valuable. I am happy if you can help me [buy a cup of coffee](https://github.com/QingWei-Li/donate). :heart:
+3 -3
View File
@@ -1,11 +1,11 @@
![logo](_media/icon.svg)
# docsify <small>2.4.3</small>
# docsify <small>3.6</small>
> A magical documentation site generator.
- Simple and lightweight (~14kB gzipped)
- Not build static html files
- Simple and lightweight (~16kB gzipped)
- No statically built html files
- Multiple themes
+4
View File
@@ -0,0 +1,4 @@
- Translations
- [:cn: 中文](/zh-cn/)
- [:de: Deutsch](/de-de/)
- [:uk: English](/)
+16 -14
View File
@@ -1,20 +1,22 @@
- Getting started
- [Quick start](/quickstart)
- [Writing more pages](/more-pages)
- [Custom navbar](/custom-navbar)
- [Cover page](/cover)
- [Quick start](quickstart.md)
- [Writing more pages](more-pages.md)
- [Custom navbar](custom-navbar.md)
- [Cover page](cover.md)
- Customization
- [Configuration](/configuration)
- [Themes](/themes)
- [Using plugins](/plugins)
- [Markdown configuration](/markdown)
- [Lanuage highlight](/language-highlight)
- [Configuration](configuration.md)
- [Themes](themes.md)
- [List of Plugins](plugins.md)
- [Write a Plugin](write-a-plugin.md)
- [Markdown configuration](markdown.md)
- [Language highlighting](language-highlight.md)
- Guide
- [Deploy](/deploy)
- [Doc helper](/helpers)
- [Compatible Vue](/vue)
- [CDN](/cdn)
- [Deploy](deploy.md)
- [Helpers](helpers.md)
- [Vue compatibility](vue.md)
- [CDN](cdn.md)
- [Offline Mode(PWA)](pwa.md)
- [Changelog](/changelog)
- [Changelog](changelog.md)
+13 -5
View File
@@ -2,10 +2,8 @@
Recommended: [unpkg](//unpkg.com), which will reflect the latest version as soon as it is published to npm. You can also browse the source of the npm package at [unpkg.com/docsify/](//unpkg.com/docsify/).
## Latest version
```html
<!-- load css -->
<link rel="stylesheet" href="//unpkg.com/docsify/themes/vue.css">
@@ -14,8 +12,9 @@ Recommended: [unpkg](//unpkg.com), which will reflect the latest version as soon
<script src="//unpkg.com/docsify/lib/docsify.js"></script>
```
## Specific version
Alternatively, use [compressed files](#compressed-files).
## Specific version
```html
<!-- load css -->
@@ -27,7 +26,6 @@ Recommended: [unpkg](//unpkg.com), which will reflect the latest version as soon
## Compressed file
```html
<!-- load css -->
<link rel="stylesheet" href="//unpkg.com/docsify/lib/themes/vue.css">
@@ -36,7 +34,17 @@ Recommended: [unpkg](//unpkg.com), which will reflect the latest version as soon
<script src="//unpkg.com/docsify/lib/docsify.min.js"></script>
```
```html
<!-- load css -->
<link rel="stylesheet" href="//unpkg.com/docsify@2.0.0/lib/themes/vue.css">
<!-- load script -->
<script src="//unpkg.com/docsify@2.0.0/lib/docsify.min.js"></script>
```
## Other CDN
[jsDelivr](http://www.jsdelivr.com/projects/docsify) is available.
- http://www.bootcdn.cn/docsify
- http://www.jsdelivr.com/projects/docsify
- https://cdnjs.com/libraries/docsify
+37 -22
View File
@@ -1,6 +1,6 @@
# Configuration
docsify supports two ways to configure. You can configure the `window.$docsify` or write configuration on the script tag via `data-*` attributes.
**docsify** supports two different ways of configuration. You can configure the `window.$docsify` or write configuration on the script tag via `data-*` attributes.
```html
<!-- by $docsify -->
@@ -53,7 +53,6 @@ window.$docsify = {
}
```
## max-level
- Type: `Number`
@@ -72,7 +71,7 @@ window.$docsify = {
- Type: `Boolean|String`
- Default: `false`
Load navbar from Markdown file. If **true** it will be loaded from `_navbar.md`.
Loads navbar from the Markdown file `_navbar.md` if **true**, or else from the path specified.
```js
window.$docsify = {
@@ -89,8 +88,7 @@ window.$docsify = {
- Type: `Boolean|String`
- Default: `false`
Load sidebar from Markdown file. If **true** it will be loaded from `_sidebar.md`.
Loads sidebar from the Markdown file `_sidebar.md` if **true**, or else from the path specified.
```js
window.$docsify = {
@@ -107,7 +105,7 @@ window.$docsify = {
- Type: `Number`
- Default: `0`
Add TOC in custom sidebar.
Add table of contents (TOC) in custom sidebar.
```js
window.$docsify = {
@@ -115,13 +113,11 @@ window.$docsify = {
}
```
## auto2top
- Type: `Boolean`
- Default: `false`
Scrolls to the top of the screen when the route is changed.
```js
@@ -130,13 +126,11 @@ window.$docsify = {
}
```
## homepage
- Type: `String`
- Default: `README.md`
`README.md` in your docs folder will be treated as homepage for your website, but sometimes you may need to serve another file as your homepage.
```js
@@ -167,13 +161,12 @@ window.$docsify = {
}
```
## coverpage
- Type: `Boolean|String`
- Default: `false`
Activate the [cover feature](/cover). If ture, it will load from `_coverpage.md`.
Activate the [cover feature](cover.md). If true, it will load from `_coverpage.md`.
```js
window.$docsify = {
@@ -188,8 +181,7 @@ window.$docsify = {
- Type: `String`
Website name appears in the sidebar.
Website name as it appears in the sidebar.
```js
window.$docsify = {
@@ -206,7 +198,13 @@ The name of the link.
```js
window.$docsify = {
nameLink: '/'
nameLink: '/',
// For each route
nameLink: {
'/zh-cn/': '/zh-cn/',
'/': '/'
}
}
```
@@ -214,8 +212,7 @@ window.$docsify = {
- Type: `Function`
See [Markdown configuration](/markdown).
See [Markdown configuration](markdown.md).
```js
window.$docsify = {
@@ -241,8 +238,7 @@ window.$docsify = {
- Type: `String`
Customize the theme color.
Use [CSS3 variables](https://developer.mozilla.org/en-US/docs/Web/CSS/Using_CSS_variables) feature and polyfill in old browser.
Customize the theme color. Use [CSS3 variables](https://developer.mozilla.org/en-US/docs/Web/CSS/Using_CSS_variables) feature and polyfill in old browser.
```js
window.$docsify = {
@@ -254,7 +250,6 @@ window.$docsify = {
- Type: `Object`
Set the route alias. You can freely manage routing rules.
```js
@@ -270,7 +265,7 @@ window.$docsify = {
- type: `Boolean`
If `loadSidebar` and `autoHeader` are both enabled, for each link in _sidebar.md, prepend a header to the page before converting it to html. [#78](https://github.com/QingWei-Li/docsify/issues/78)
If `loadSidebar` and `autoHeader` are both enabled, for each link in `_sidebar.md`, prepend a header to the page before converting it to html. Compare [#78](https://github.com/QingWei-Li/docsify/issues/78).
```js
window.$docsify = {
@@ -297,6 +292,26 @@ window.$docsify = {
<script>
console.log(2333)
</script>
```
Note that if you are running an external script, e.g. an embedded jsfiddle demo, make sure to include the [external-script](plugins.md?id=external-script) plugin.
## no-emoji
Disabled emoji parse.
```js
window.$docsify = {
noEmoji: true
}
```
## merge-navbar
Navbar will be merged with the sidebar on smaller screens.
```js
window.$docsify = {
mergeNavbar: true
}
```
+17 -18
View File
@@ -1,57 +1,56 @@
# Cover
Activate the cover feature by setting `coverpage`. The detail in [Configuration#coverpage](configuration#coverpage).
Activate the cover feature by setting `coverpage` to **true**, compare [coverpage configuration](configuration.md#coverpage).
## Basic usage
Set `coverpage` to **true**, and create a `_coverpage.md`. You can see the effect in current website.
*index.html*
Set `coverpage` to **true**, and create a `_coverpage.md`:
```html
<!-- index.html -->
<script>
window.$docsify = {
coverpage: true
}
</script>
<script src="//unpkg.com/docsify"></script>
<script src="//unpkg.com/docsify/lib/docsify.min.js"></script>
```
*_coverpage.md*
```markdown
<!-- _coverpage.md -->
![logo](_media/icon.svg)
# docsify
# docsify <small>3.5</small>
> A magical documentation site generator.
- Simple and lightweight (~12kb gzipped)
- Simple and lightweight (~16kB gzipped)
- No statically built html files
- Multiple themes
- Not build static html files
[GitHub](https://github.com/QingWei-Li/docsify/)
[Get Started](#quick-start)
[Get Started](#docsify)
```
!> A document site can have only one cover page.
!> A document site can have only one coverpage!
## Custom background
The background color is generated randomly by default. You can customize the background color or image.
*_coverpage.md*
The background color is generated randomly by default. You can customize the background color or a background image:
```markdown
# docsify
<!-- _coverpage.md -->
# docsify <small>3.5</small>
[GitHub](https://github.com/QingWei-Li/docsify/)
[Get Started](#quick-start)
<!-- background image -->
![](_media/bg.png)
<!-- background color -->
![color](#f0f0f0)
```
+51 -22
View File
@@ -1,10 +1,14 @@
# Custom navbar
You can create navbar in HTML file. But note that the link begins with `#/`.
## HTML
*index.html*
If you need custom navigation, you can create a HTML-based navigation bar.
!> Note that documentation links begin with `#/`.
```html
<!-- index.html -->
<body>
<nav>
<a href="#/">EN</a>
@@ -14,53 +18,78 @@ You can create navbar in HTML file. But note that the link begins with `#/`.
</body>
```
## Writing by Markdown
You can custom navbar by Markdown file. Set the `loadNavbar` to **true** and create a `_navbar.md`. The detail in [Configuration#load-navbar](configuration#load-navbar).
*index.html*
## Markdown
Alternatively, you can create a custom markdown-based navigation file by setting `loadNavbar` to **true** and creating `_navbar.md`, compare [load-navbar configuration](configuration.md#load-navbar).
```html
<!-- index.html -->
<script>
window.$docsify = {
loadNavbar: true
}
</script>
<script src="//unpkg.com/docsify"></script>
<script src="//unpkg.com/docsify/lib/docsify.min.js"></script>
```
*_navbar.md*
```markdown
<!-- _navbar.md -->
- [En](/)
- [chinese](/zh-cn/)
```
`_navbar.md` is loaded from each level directory. If this directory doesn't have `_navbar.md`, it will fallback to parent directory. For example, the current path is `/guide/quick-start`, the `_navbar.md` will be loaded from `/guide/_navbar.md`.
!> You need to create a `.nojekyll` in `./docs` to prevent GitHub Pages from ignoring files that begin with an underscore.
`_navbar.md` is loaded from each level directory. If the current directory doesn't have `_navbar.md`, it will fall back to the parent directory. If, for example, the current path is `/guide/quick-start`, the `_navbar.md` will be loaded from `/guide/_navbar.md`.
## Nesting
You can create sub-lists by indenting items that are under a certain parent.
```markdown
<!-- _navbar.md -->
- Getting started
- [Quick start](/quickstart)
- [Writing more pages](/more-pages)
- [Custom navbar](/custom-navbar)
- [Cover page](/cover)
- [Quick start](quickstart.md)
- [Writing more pages](more-pages.md)
- [Custom navbar](custom-navbar.md)
- [Cover page](cover.md)
- Configuration
- [Configuration](/configuration)
- [Themes](/themes)
- [Using plugins](/plugins)
- [Markdown configuration](/markdown)
- [Lanuage highlight](/language-highlight)
- [Configuration](configuration.md)
- [Themes](themes.md)
- [Using plugins](plugins.md)
- [Markdown configuration](markdown.md)
- [Language highlight](language-highlight.md)
```
Example.
renders as
![Nesting navbar](_images/nested-navbar.png "Nesting navbar")
## Combining custom navbars with the emoji plugin
If you use the [emoji plugin](plugins#emoji):
```html
<!-- index.html -->
<script>
window.$docsify = {
// ...
}
</script>
<script src="//unpkg.com/docsify/lib/docsify.min.js"></script>
<script src="//unpkg.com/docsify/lib/plugins/emoji.min.js"></script>
```
you could, for example, use flag emojis in your custom navbar Markdown file:
```markdown
<!-- _navbar.md -->
- [:us:, :uk:](/)
- [:cn:](/zh-cn/)
```
+27
View File
@@ -0,0 +1,27 @@
## docsify
> Ein magischer Generator für Dokumentationen.
## Was ist das
**docsify** generiert deine Dokumentationswebseite zeitgleich (mit der Darstellung). Im Gegensatz zu GitBook, werden keine statischen HTML Seiten generiert. Stattdessen, werden im Hintergrund Markdown Dateien geladen und umgewandelt, und als Webseite dargestellt. Alles, was du brauchst, ist eine Datei namens `index.html`, um sie über [GitHub Pages zu veröffentlichen](de-de/deploy.md).
Siehe [Schnellstart](de-de/quickstart.md) für weitere Informationen.
## Features
* keine generierten, statischen HTML Dateien
* einfach und klein (~16kB gzipped)
* smarte Erweiterung mit Volltextsuche
* mehrere Themes
* praktische API für Erweiterungen
* Unterstützung für Emoji
* Kompatibel mit IE10+
## Beispiele
Vergleiche die Liste namens [Showcase](https://github.com/QingWei-Li/docsify/#showcase) mit Beispielen, wie **docsify** verwendet wird.
## Spenden
Bitte ziehe eine Spende in Erwägung, sollte **docsify** dir hilfreich oder meine Arbeit dir wertvoll erscheinen. Ich freue mich, wenn du mir [eine Tasse Kaffee kaufst](https://github.com/QingWei-Li/donate). :heart:
+22
View File
@@ -0,0 +1,22 @@
- Loslegen
- [Schnellstart](de-de/quickstart.md)
- [Schreiben weiterer Seiten](de-de/more-pages.md)
- [Navigationsleiste anpassen](de-de/custom-navbar.md)
- [Titelseite](de-de/cover.md)
- Anpassen
- [Einstellungen](de-de/configuration.md)
- [Themen](de-de/themes.md)
- [Liste der Erweiterungen](de-de/plugins.md)
- [Schreiben eigener Erweiterungen](de-de/write-a-plugin.md)
- [Markdown-Einstellungen](de-de/markdown.md)
- [Hervorheben von Sprachen](de-de/language-highlight.md)
- Guide
- [Inbetriebnahme](de-de/deploy.md)
- [Helfer](de-de/helpers.md)
- [Vue Kompatibilität](de-de/vue.md)
- [CDN](de-de/cdn.md)
- [Offline Modus (PWA)](de-de/pwa.md)
- [Changelog](de-de/changelog.md)
+49
View File
@@ -0,0 +1,49 @@
# CDN
Empfohlen: [unpkg](//unpkg.com), welches jeweils die aktuelle Version liefert, wie sie über npm veröffentlicht wurde. Du kannst auch den Quellcode des npm Packets über [unpkg.com/docsify/](//unpkg.com/docsify/) anschauen.
## Aktuelle Version
```html
<!-- lade CSS -->
<link rel="stylesheet" href="//unpkg.com/docsify/themes/vue.css">
<!-- lade Script -->
<script src="//unpkg.com/docsify/lib/docsify.js"></script>
```
Alternativ kannst du auch die [komprimierten Dateien](#komprimierte-dateien) verwenden.
## Spezielle Version
```html
<!-- lade CSS -->
<link rel="stylesheet" href="//unpkg.com/docsify@2.0.0/themes/vue.css">
<!-- lade Script -->
<script src="//unpkg.com/docsify@2.0.0/lib/docsify.js"></script>
```
## Komprimierte Dateien
```html
<!-- lade CSS -->
<link rel="stylesheet" href="//unpkg.com/docsify/lib/themes/vue.css">
<!-- lade Script -->
<script src="//unpkg.com/docsify/lib/docsify.min.js"></script>
```
```html
<!-- lade CSS -->
<link rel="stylesheet" href="//unpkg.com/docsify@2.0.0/lib/themes/vue.css">
<!-- lade Script -->
<script src="//unpkg.com/docsify@2.0.0/lib/docsify.min.js"></script>
```
## Andere CDN
- http://www.bootcdn.cn/docsify
- http://www.jsdelivr.com/projects/docsify
- https://cdnjs.com/libraries/docsify
+317
View File
@@ -0,0 +1,317 @@
# Einstellungen
**docsify** unterstützt zwei verschiedene Arten, um die Einstellungen anzupassen. Du kannst das `window.$docsify` anpassen, oder die Einstellungen über das script tag im `data-*` Attribut vornehmen.
```html
<!-- über $docsify -->
<script>
window.$docsify = {
repo: 'QingWei-Li/docsify',
maxLevel: 3,
coverpage: true
}
</script>
<!-- oder data-* -->
<script
src="//unpkg.com/docsify"
data-repo="QingWei-Li/docsify"
data-max-level="3"
data-coverpage>
</script>
```
Beide Arten sind miteinander kompatibel, wobei die erste jedoch empfohlen wird. Sie ist deutlicher und kann in einer separaten Datei geführt werden.
!> Innerhalb des `window.$docsfiy` sollten die Optionen mit camelCase geschrieben werden.
## el
- Typ: `String`
- Standard: `#app`
Das DOM Element kann bei der Initialisierung gesetzt werden. Es kann ein CSS selector string oder ein richtiges HTMLElement sein.
```js
window.$docsify = {
el: '#app'
}
```
## repo
- Typ: `String`
- Standard: `null`
Verwende die repository URL oder eine Zeichenfolge aus `Benutzername/repo`, um das [GitHub Corner](http://tholman.com/github-corners/) widget in die obere rechte Ecke der Seite zu implementieren.
```js
window.$docsify = {
repo: 'QingWei-Li/docsify',
// oder
repo: 'https://github.com/QingWei-Li/docsify/'
}
```
## max-level
- Typ: `Number`
- Standard: `6`
Maximale Anzahl der Inhaltsübersichtebenen.
```js
window.$docsify = {
maxLevel: 4
}
```
## load-navbar
- Typ: `Boolean|String`
- Standard: `false`
Lädt die Navigationsleiste von der Markdown Datei `_navbar.md` falls **true**, oder vom gewählten Pfad.
```js
window.$docsify = {
// lade von _navbar.md
loadNavbar: true,
// lade von nav.md
loadNavbar: 'nav.md'
}
```
## load-sidebar
- Typ: `Boolean|String`
- Standard: `false`
Lädt das seitliche Inhaltsverzeichnis von der Markdown Datei `_sidebar.md` falls **true**, oder vom gewählten Pfad.
```js
window.$docsify = {
// lade von _sidebar.md
loadSidebar: true,
// lade von summary.md
loadSidebar: 'summary.md'
}
```
## sub-max-level
- Typ: `Number`
- Standard: `0`
Wähle die maximale Anzahl der Unterpunkte pro Datei in der Inhaltsübersicht.
```js
window.$docsify = {
subMaxLevel: 2
}
```
## auto2top
- Typ: `Boolean`
- Standard: `false`
Scrolle zum Anfang der Seite, wenn die Route gewechselt wird.
```js
window.$docsify = {
auto2top: true
}
```
## homepage
- Typ: `String`
- Standard: `README.md`
`README.md` in deinem Ordner für die Dokumentation wird als Startseite für deine Webseite gesetzt, aber manchmal musst du das vielleicht ändern.
```js
window.$docsify = {
// Wähle /home.md
homepage: 'home.md',
// Oder verwende das README in deinem repo
homepage: 'https://raw.githubusercontent.com/QingWei-Li/docsify/master/README.md'
}
```
## base-path
- Typ: `String`
Der Basispfad der Webseite. Du kannst einen anderen Ordner wählen, oder eine andere Domain.
```js
window.$docsify = {
basePath: '/path/',
// Lade die Dateien von einer anderen Domain
basePath: 'https://docsify.js.org/',
// Oder lade Dateien von einem anderen repo
basePath: 'https://raw.githubusercontent.com/ryanmcdermott/clean-code-javascript/master/'
}
```
## coverpage
- Typ: `Boolean|String`
- Standard: `false`
Aktiviere das [Titelseitenfeature](de-de/cover.md). Falls `true`, wird sie von `_coverpage.md` geladen.
```js
window.$docsify = {
coverpage: true,
// Anderer Dateiname
coverpage: 'cover.md'
}
```
## name
- Typ: `String`
Webseitenname, wie er in der Inhaltsübersicht in der Seitenleiste angezeigt wird.
```js
window.$docsify = {
name: 'docsify'
}
```
## name-link
- Typ: `String`
- Standard: `window.location.pathname`
Der Name der Links.
```js
window.$docsify = {
nameLink: '/',
// Für jede Route
nameLink: {
'/zh-cn/': '/zh-cn/',
'/': '/'
}
}
```
## markdown
- Typ: `Function`
Siehe [Markdown Konfiguration](de-de/markdown.md).
```js
window.$docsify = {
// Objekt
markdown: {
smartypants: true,
renderer: {
link: function() {
// ...
}
}
},
// Funktion
markdown: function (marked, renderer) {
// ...
return marked
}
}
```
## theme-color
- Typ: `String`
Passe die Farbe der Themen an. Verwende [CSS3 Variablen](https://developer.mozilla.org/en-US/docs/Web/CSS/Using_CSS_variables) und polyfill in älteren Browsern.
```js
window.$docsify = {
themeColor: '#3F51B5'
}
```
## alias
- Typ: `Object`
Verwende alternative Routen. Du kannst sie ungehindert anpassen.
```js
window.$docsify = {
alias: {
'/zh-cn/changelog': '/changelog',
'/changelog': 'https://raw.githubusercontent.com/QingWei-Li/docsify/master/CHANGELOG'
}
}
```
## auto-header
- Typ: `Boolean`
Sollten `loadSidebar` und `autoHeader` beide aktiviert sein, setze einen Header vor die Seite in jedem Link in `_sidebar.md`, bevor sie in HTML umgewandelt wird. Vergleiche [#78](https://github.com/QingWei-Li/docsify/issues/78).
```js
window.$docsify = {
loadSidebar: true,
autoHeader: true
}
```
## execute-script
- Typ: `Boolean`
Führe das Skript auf der Seite aus. Analysiere nur das erste script tag ([demo](de-de/themes.md)). Sollte Vue verwendet sein, wird es in der Standardeinstellung ausgeführt.
```js
window.$docsify = {
executeScript: true
}
```
```markdown
## Dies ist ein Test
<script>
console.log(2333)
</script>
```
?> Nehme zur Kenntnis, dass, solltest du ein externes Skript ausführen, z.B. ein eingebettete jsfiddle demo, du sicher gehen solltest, das [external-script](de-de/plugins.md?id=external-script) plugin zu verwenden.
## no-emoji
Verhindere die Umwandlung in Emojis:
```js
window.$docsify = {
noEmoji: true
}
```
## merge-navbar
Navbar will be merged with the sidebar on smaller screens.
```js
window.$docsify = {
mergeNavbar: true
}
```
+56
View File
@@ -0,0 +1,56 @@
# Titelseite
Aktiviere die Unterstützung für Titelseiten, indem du `coverpage` auf **true** einstellst, vergleiche [coverpage Einstellungen](configuration.md#coverpage).
## Einfache Verwendung
Setze `coverpage` auf **true**, und erstelle `_coverpage.md`:
```html
<!-- index.html -->
<script>
window.$docsify = {
coverpage: true
}
</script>
<script src="//unpkg.com/docsify/lib/docsify.min.js"></script>
```
```markdown
<!-- _coverpage.md -->
![logo](_media/icon.svg)
# docsify <small>3.5</small>
> Ein magischer Generator für Dokumentationsseiten.
- Einfach und wenig Speicherbedarf (~16kB gzipped)
- Keine statischen HTML Dateien
- Mehrere Themes
[GitHub](https://github.com/QingWei-Li/docsify/)
[Schnellstart](#docsify)
```
!> Die Dokumentationsseiten können nur eine Titelseite haben!
## Eigener Hintergrund
Die Hintergrundfarbe wird in der Standardeinstellung zufällig generiert. Du kannst sie anpassen, oder auch ein Hintergrundbild verwenden:
```markdown
<!-- _coverpage.md -->
# docsify <small>3.5</small>
[GitHub](https://github.com/QingWei-Li/docsify/)
[Schnellstart](#quick-start)
<!-- Hintegrundbild -->
![](_media/bg.png)
<!-- Hintegrundfarbe -->
![color](#f0f0f0)
```
+95
View File
@@ -0,0 +1,95 @@
# Navigationsleiste anpassen
## HTML
Solltest du eine Navigationsleiste benötigen, so kannst du eine HTML-basierte erstellen.
!> Die Links der Dokumentation fangen alle mit `#/` an.
```html
<!-- index.html -->
<body>
<nav>
<a href="#/">EN</a>
<a href="#/de-de/">DE</a>
</nav>
<div id="app"></div>
</body>
```
## Markdown
Oder du kannst deine Navigationsleiste mit einer Datei basierend auf Markdown erstellen, indem du `loadNavbar` auf **true** setzt und eine Datei namens `_navbar.md` erstellst, vergleiche [load-navbar Einstellungen](configuration.md#load-navbar).
```html
<!-- index.html -->
<script>
window.$docsify = {
loadNavbar: true
}
</script>
<script src="//unpkg.com/docsify/lib/docsify.min.js"></script>
```
```markdown
<!-- _navbar.md -->
- [En](/)
- [Deutsch](/de-de/)
```
!> Solltest du Github Pages verwenden, musst du zusätzlich eine Datei namens `.nojekyll` in `./docs` erstellen, um zu verhindern, dass Github Dateien ignoriert, die mit einem Unterstrich anfangen.
`_navbar.md` wird in jedem Verzeichnislevel geladen. Sollte das aktuelle Verzeichnis keine Datei namens `_navbar.md` haben, so sucht **docsify** in den übergeordneten Ordnern. Wenn du z.B. im Moment im Verzeichnis `/guide/quick-start` bist, so wird `_navbar.md` von der Datei `/guide/_navbar.md` geladen.
## Aufbauen von Strukturen
Du kannst untergeordnete Listen erstellen, indem du untergeordnete Punkte einem übergeordneten Punkt gegenüber einrückst.
```markdown
<!-- _navbar.md -->
- Getting started
- [Quick start](de-de/quickstart.md)
- [Writing more pages](de-de/more-pages.md)
- [Custom navbar](de-de/custom-navbar.md)
- [Cover page](de-de/cover.md)
- Configuration
- [Configuration](de-de/configuration.md)
- [Themes](de-de/themes.md)
- [Using plugins](de-de/plugins.md)
- [Markdown configuration](de-de/markdown.md)
- [Language highlight](de-de/language-highlight.md)
```
wird also wie folgt aussehen
![Nesting navbar](_images/nested-navbar.png "Nesting navbar")
## Angepasste Navigationsleisten in Verbindung mit dem emoji Erweiterung
Solltest du die [emoji Erweiterung](plugins.md#emoji) verwenden:
```html
<!-- index.html -->
<script>
window.$docsify = {
// ...
}
</script>
<script src="//unpkg.com/docsify/lib/docsify.min.js"></script>
<script src="//unpkg.com/docsify/lib/plugins/emoji.min.js"></script>
```
so kannst du z.B. auch die Flaggenemojis in der Markdown Datei für deine angepasste Navigationsleiste verwenden:
```markdown
<!-- _navbar.md -->
- [:us:, :uk:](/)
- [:de:](/de-de/)
```
+33
View File
@@ -0,0 +1,33 @@
# Inbetriebnahme
Ähnlich wie bei [GitBook](https://www.gitbook.com), kannst du deine Dateien über GitHub Pages oder VPS erstellen.
## GitHub Pages
Du kannst folgende drei Orte verwenden, um die Dokumentation für dein Github repository zu verwalten:
* `docs/` Ordner
* master branch
* gh-pages branch
Es wird empfohlen, deine Dateien im `./docs` Unterordner im `master` branch deines repository zu speichern. Wechsle dann zu den Einstellungen deines repository und wähle `master branch /docs folder` als deine Github Pages Quelle.
![github pages](_images/deploy-github-pages.png)
!> Du kannst die Dateien auch im Hauptverzeichnis speichern und dann `master branch` in den Einstellungen auswählen.
## VPS
Verwende folgende nginx config.
```nginx
server {
listen 80;
server_name your.domain.com;
location / {
alias /path/to/dir/of/docs;
index index.html;
}
}
```
+27
View File
@@ -0,0 +1,27 @@
# Dokumentationshelfer
docsify erweitert die Markdownsyntax, um deine Dokumente besser lesbar zu machen.
## Wichtiger Inhalt
Wichtiger Inhalt wie:
```markdown
!> **Zeit** ist Geld, mein Freund!
```
wird wie folgt gerendert:
!> **Zeit** ist Geld, mein Freund!
## Generelle Tipps
Generelle Tipps wie:
```markdown
?> *TODO* unit test
```
wird wie folgt gerendert:
?> *TODO* unit test
+11
View File
@@ -0,0 +1,11 @@
# Hervorheben von Sprachen
**docsify** verwendet [Prism](https://github.com/PrismJS/prism) um Quellcodeabschnitte in deinen Seiten hervorzuheben. Als Standardeinstellung werden nur CSS, JavaScipt und HTML unterstützt. Du kannst **Prism** auch mit weiteren Sprachen verwenden:
```html
<script src="//unpkg.com/docsify/lib/docsify.min.js"></script>
<script src="//unpkg.com/prismjs/components/prism-bash.min.js"></script>
<script src="//unpkg.com/prismjs/components/prism-php.min.js"></script>
```
?> Vergleiche die [component files](https://github.com/PrismJS/prism/tree/gh-pages/components) Liste für weitere Optionen.
+30
View File
@@ -0,0 +1,30 @@
# Markdown Einstellungen
**docsify** verwendet [marked](https://github.com/chjj/marked), um Markdown umzuwandeln. Du kannst einstellen, wie es deine Markdown Seiten in HTML umwandelt, indem du `renderer` konfigurierst:
```js
window.$docsify = {
markdown: {
smartypants: true,
renderer: {
link: function() {
// ...
}
}
}
}
```
?> Für mögliche Einstellungen, siehe [marked Dokumentation](https://github.com/chjj/marked#options-1)
Du kannst die Regeln auch beliebig anpassen.
```js
window.$docsify = {
markdown: function(marked, renderer) {
// ...
return marked
}
}
```
+92
View File
@@ -0,0 +1,92 @@
# Noch mehr Seiten
Wenn du mehr Seiten für deine Dokumentation brauchst, so kannst du weitere Markdown Dateien in deinem **docsify** Ordner erstellen. Eine Datei namens `guide.md` ist dann über `/#/guide` erreichbar.
Nehmen wir als Beispiel folgende Verzeichnisstruktur:
```text
.
├── docs
| └── README.md
| └── guide.md
| └── de-de
| └──README.md
| └──guide.md
```
Die passenden Routen sind dann
```text
docs/README.md => http://domain.com
docs/guide.md => http://domain.com/guide
docs/de-de/README.md => http://domain.com/de-de/
docs/de-de/guide.md => http://domain.com/de-de/guide
```
## Seitenleiste mit Inhaltsverzeichnis anpassen
Als Standardeinstellung wird das Inhaltsverzeichnis in der Seitenleiste automatisch basierend auf vorhandenen Markdown Dateien generiert. Wenn du das seitliche Inhaltsverzeichnis anpassen willst, kannst du eine Datei namens `_sidebar.md` erstellen (vergleiche [das seitliche Inhaltsverzeichnis für diese Dokumentation](https://github.com/QingWei-Li/docsify/blob/master/docs/de-de/_sidebar.md) als Beispiel):
Als Erstes musst du `loadSidebar` auf **true** setzen, vergleiche [Einstellungen für das seitliche Inhaltsverzeichnis](configuration.md#load-sidebar).
```html
<!-- index.html -->
<script>
window.$docsify = {
loadSidebar: true
}
</script>
<script src="//unpkg.com/docsify/lib/docsify.min.js"></script>
```
Als Zweites erstellst du eine Datei namens `_sidebar.md`:
```markdown
<!-- docs/_sidebar.md -->
- [Home](/)
- [Guide](de-de/guide.md)
```
!> Solltest du Github Pages verwenden, musst du zusätzlich eine Datei namens `.nojekyll` in `./docs` erstellen, um zu verhindern, dass Github Dateien ignoriert, die mit einem Unterstrich anfangen.
`_sidebar.md` wird in jedem Verzeichnislevel geladen. Sollte das aktuelle Verzeichnis keine Datei namens `_sidebar.md` haben, so sucht **docsify** in den übergeordneten Ordnern. Wenn du z.B. im Moment im Verzeichnis `/guide/quick-start` bist, so wird `_sidebar.md` von der Datei `/guide/_sidebar.md` geladen.
## Inhaltsverzeichnis
Eine angepasste Seitenleist kann auch automatisch ein Inhaltsverzeichnis generieren, indem ein `subMaxLevel` gesetzt wird, vergleiche [sub-max-level Einstellungen](configuration.md#sub-max-level).
```html
<!-- index.html -->
<script>
window.$docsify = {
loadSidebar: true,
subMaxLevel: 2
}
</script>
<script src="//unpkg.com/docsify/lib/docsify.min.js"></script>
```
## Ignoring Subheaders
When `subMaxLevel` is set, each header is automatically added to the table of contents by default. If you want to ignore a specific header, add `{docsify-ignore}` to it.
```markdown
# Getting Started
## Header {docsify-ignore}
This header won't appear in the sidebar table of contents.
```
To ignore all headers on a specific page, you can use `{docsify-ignore-all}` on the first header of the page.
```markdown
# Getting Started {docsify-ignore-all}
## Header
This header won't appear in the sidebar table of contents.
```
Both `{docsify-ignore}` and `{docsify-ignore-all}` will not be rendered on the page when used.
+95
View File
@@ -0,0 +1,95 @@
# Liste der Erweiterungen
## Volltextsuche
Als Standardeinstellung werden Hyperlinks auf der aktuellen Seite erkannt und der Inhalt in `localStorage` gespeichert. Du kannst den Pfad zu den Dateien auch anpassen:
```html
<script>
window.$docsify = {
search: 'auto', // Standard
search : [
'/', // => /README.md
'/guide', // => /guide.md
'/get-started', // => /get-started.md
'/de-de/', // => /de-de/README.md
],
// vollständige Parameter für die Einstellungen
search: {
maxAge: 86400000, // Verfallszeit, als Standard ein Tag
paths: [], // oder 'auto'
placeholder: 'Type to search',
// Lokalisation
placeholder: {
'/de-de/': 'Suche',
'/': 'Search'
},
noData: 'No Results!',
// Lokalisation
noData: {
'/de-de/': 'Keine Ergebnisse',
'/': 'No Results'
}
}
}
</script>
<script src="//unpkg.com/docsify/lib/docsify.min.js"></script>
<script src="//unpkg.com/docsify/lib/plugins/search.min.js"></script>
```
## Google Analytics
Installiere diese Erweiterung und passe die track id an:
```html
<script>
window.$docsify = {
ga: 'UA-XXXXX-Y'
}
</script>
<script src="//unpkg.com/docsify/lib/docsify.min.js"></script>
<script src="//unpkg.com/docsify/lib/plugins/ga.min.js"></script>
```
Konfiguration über `data-ga`:
```html
<script src="//unpkg.com/docsify/lib/docsify.min.js" data-ga="UA-XXXXX-Y"></script>
<script src="//unpkg.com/docsify/lib/plugins/ga.min.js"></script>
```
## front matter
```html
<script src="//unpkg.com/docsify/lib/plugins/front-matter.min.js"></script>
```
## emoji
Als Standardeinstellung werden emojis umgewandelt. Als Beispiel wird `:100:` umgewandelt in :100:. Aber das ist nicht genau, das es keine passende Nicht-emoji Zeichenfolge gibt. Solltest du emojis richtig umwandeln wollen, musst du diese Erweiterung verwenden.
```html
<script src="//unpkg.com/docsify/lib/plugins/emoji.min.js"></script>
```
## Externes Skript
Wenn das Skript auf der Seite ein externes ist (eine Javascript Datei über das `src` Attribut importiert), brauchst du diese Erweiterung, damit das funktioniert.
```html
<script src="//unpkg.com/docsify/lib/plugins/external-script.min.js"></script>
```
## Bilder zoomen
Medium's Bilderzoom. Basierend auf [zoom-image](https://github.com/egoist/zoom-image).
```html
<script src="//unpkg.com/docsify/lib/plugins/zoom-image.min.js"></script>
```
+115
View File
@@ -0,0 +1,115 @@
# Offline Modus
[Progressive Web Apps](https://developers.google.com/web/progressive-web-apps/) (PWA) sind Erfahrungen die Vorzüge des Internets mit den Vorzügen von Apps verbinden. Wir können unsere Webseite verbessern, indem wir sie mit Hilfe von service workers auch **offline** und in schlechten Netzen interagierbar machen.
Sie sind sehr einfach zu verwenden.
## serviceWorker erstellen
Erstelle eine Datei namens `sw.js` in deinem **docsify** Verzeichnis und kopiere folgenden Code:
*sw.js*
```js
/* ===========================================================
* docsify sw.js
* ===========================================================
* Copyright 2016 @huxpro
* Licensed under Apache 2.0
* Register service worker.
* ========================================================== */
const RUNTIME = 'docsify'
const HOSTNAME_WHITELIST = [
self.location.hostname,
'fonts.gstatic.com',
'fonts.googleapis.com',
'unpkg.com'
]
// The Util Function to hack URLs of intercepted requests
const getFixedUrl = (req) => {
var now = Date.now()
var url = new URL(req.url)
// 1. fixed http URL
// Just keep syncing with location.protocol
// fetch(httpURL) belongs to active mixed content.
// And fetch(httpRequest) is not supported yet.
url.protocol = self.location.protocol
// 2. add query for caching-busting.
// Github Pages served with Cache-Control: max-age=600
// max-age on mutable content is error-prone, with SW life of bugs can even extend.
// Until cache mode of Fetch API landed, we have to workaround cache-busting with query string.
// Cache-Control-Bug: https://bugs.chromium.org/p/chromium/issues/detail?id=453190
if (url.hostname === self.location.hostname) {
url.search += (url.search ? '&' : '?') + 'cache-bust=' + now
}
return url.href
}
/**
* @Lifecycle Activate
* New one activated when old isnt being used.
*
* waitUntil(): activating ====> activated
*/
self.addEventListener('activate', event => {
event.waitUntil(self.clients.claim())
})
/**
* @Functional Fetch
* All network requests are being intercepted here.
*
* void respondWith(Promise<Response> r)
*/
self.addEventListener('fetch', event => {
// Skip some of cross-origin requests, like those for Google Analytics.
if (HOSTNAME_WHITELIST.indexOf(new URL(event.request.url).hostname) > -1) {
// Stale-while-revalidate
// similar to HTTP's stale-while-revalidate: https://www.mnot.net/blog/2007/12/12/stale
// Upgrade from Jake's to Surma's: https://gist.github.com/surma/eb441223daaedf880801ad80006389f1
const cached = caches.match(event.request)
const fixedUrl = getFixedUrl(event.request)
const fetched = fetch(fixedUrl, { cache: 'no-store' })
const fetchedCopy = fetched.then(resp => resp.clone())
// Call respondWith() with whatever we get first.
// If the fetch fails (e.g disconnected), wait for the cache.
// If theres nothing in cache, wait for the fetch.
// If neither yields a response, return offline pages.
event.respondWith(
Promise.race([fetched.catch(_ => cached), cached])
.then(resp => resp || fetched)
.catch(_ => { /* eat any errors */ })
)
// Update the cache with the version we fetched (only for ok status)
event.waitUntil(
Promise.all([fetchedCopy, caches.open(RUNTIME)])
.then(([response, cache]) => response.ok && cache.put(event.request, response))
.catch(_ => { /* eat any errors */ })
)
}
})
```
## Registrieren
Jetzt registrieren wir die Funktion in der Datei `index.html`. Nur manche aktuellen Browser unterstützen die Funktion, wir müssen also prüfen:
*index.html*
```html
<script>
if (typeof navigator.serviceWorker !== 'undefined') {
navigator.serviceWorker.register('sw.js')
}
</script>
```
## Geniessen
Du kannst die Website jetzt veröffentlichen und Benutzer können sie dann vollständig offline verwenden, sobald sie einmal geladen wurde :ghost: Du kannst das jetzt ausprobieren, indem du deine Internetverbindung ausschaltest und diese Seite neu lädst.
+87
View File
@@ -0,0 +1,87 @@
# Schnellstart
Es wird empfohlen, `docsify-cli` global zu installieren, welches bei der Inbetriebnahme und der lokalen Vorschau hilft.
```bash
npm i docsify-cli -g
```
## Inbetriebnahme
Wenn du die Dokumentation in dem Unterordner `./docs` erstellen willst, kannst du den Befehl `init` verwenden.
```bash
docsify init ./docs
```
## Inhalt schreiben
Nachdem der Befehl `init` vollständig ausgeführt wurde, kannst du folgende Dateien im Unterordner `./docs` finden:
* `index.html` als zentrale Datei
* `README.md` als die Startseite für die Dokumentation
* `.nojekyll` verhindert, dass Github Pages Dateien ignoriert, die mit einem Unterstrich beginnen.
Du kannst die Dokumentation über die Datei `./docs/README.md` nach Belieben ändern, und natürlich [weitere Seiten](de-de/more-pages.md) hinzufügen.
## Vorschau der eigenen Seiten
Du kannst einen lokalen Server mit dem Befehl `docsify serve` laufen lassen, und auf eine Vorschau deiner Webseite über `http://localhost:3000` zugreifen.
```bash
docsify serve docs
```
?> Für weitere Informationen hinsichtlich der Verwendung von `docsify-cli`, siehe [docsify-cli Dokumentation](https://github.com/QingWei-Li/docsify-cli).
## Manuelle Inbetriebnahme
Wenn du `npm` nicht verwenden möchtest, oder Probleme bei der Installation des Tools hast, kannst du auch manuell die Datei namens `index.html` erstellen:
```html
<!-- index.html -->
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">dict.
<link rel="stylesheet" href="//unpkg.com/docsify/themes/vue.css">
</head>
<body>
<div id="app"></div>
</body>
<script src="//unpkg.com/docsify/lib/docsify.min.js"></script>
</html>
```
Solltest du Python installiert haben, kannst du einen statischen Server laufen lassen, um eine Vorschau deiner Webseite anzuschauen:
```bash
cd docs && python -m SimpleHTTPServer 3000
```
## Ladedialog
Wenn du möchtest, kann **docsify** einen Ladedialog anzeigen, während es deine Dokumentation umwandelt:
```html
<!-- index.html -->
<div id="app">Please wait...</div>
```
Du solltest das `data-app` Attribut anpassen, wenn du `el` geändert hast:
```html
<!-- index.html -->
<div data-app id="main">Please wait...</div>
<script>
window.$docsify = {
el: '#main'
}
</script>
```
Vergleiche [el Einstellungen](configuration.md#el).
+56
View File
@@ -0,0 +1,56 @@
# Themes
Es gibt im Moment vier Themes zur Auswahl, ähnlich wie die Webseiten von [Vue](//vuejs.org) oder [buble](//buble.surge.sh), sowie eine weitere, dunkle von [@liril-net](https://github.com/liril-net).
```html
<link rel="stylesheet" href="//unpkg.com/docsify/themes/vue.css">
<link rel="stylesheet" href="//unpkg.com/docsify/themes/buble.css">
<link rel="stylesheet" href="//unpkg.com/docsify/themes/dark.css">
<link rel="stylesheet" href="//unpkg.com/docsify/themes/pure.css">
```
!> Komprimierte Dateien sind über `/lib/themes/` verfügbar.
```html
<!-- komprimierte Versionen -->
<link rel="stylesheet" href="//unpkg.com/docsify/lib/themes/vue.css">
<link rel="stylesheet" href="//unpkg.com/docsify/lib/themes/buble.css">
<link rel="stylesheet" href="//unpkg.com/docsify/lib/themes/dark.css">
<link rel="stylesheet" href="//unpkg.com/docsify/lib/themes/pure.css">
```
Solltest du weitere Themes erstellen, kannst du sie gerne der Allgemeinheit mit einem [pull request](https://github.com/QingWei-Li/docsify/pulls) zur Verfügung stellen.
#### Klicke hier für eine Vorschau
<div class="demo-theme-preview">
<a data-theme="vue">vue.css</a>
<a data-theme="buble">buble.css</a>
<a data-theme="dark">dark.css</a>
<a data-theme="pure">pure.css</a>
</div>
<style>
.demo-theme-preview a {
padding-right: 10px;
}
.demo-theme-preview a:hover {
cursor: pointer;
text-decoration: underline;
}
</style>
<script>
var preview = Docsify.dom.find('.demo-theme-preview');
var themes = Docsify.dom.findAll('[rel="stylesheet"]');
preview.onclick = function (e) {
var title = e.target.getAttribute('data-theme')
themes.forEach(function (theme) {
theme.disabled = theme.title !== title
});
};
</script>
+100
View File
@@ -0,0 +1,100 @@
# Kompatibel mit Vue
Du kannst Vue Komponenten direkt in den Markdown Dateien verwenden, und sie werden umgewandelt. Du kannst dies zum Beispiel verwenden, um Vue Komponenten gleichzeitig zu demonstrieren und zu dokumentieren.
## Einfache Verwendung
Lade Vue in `./index.html`.
```html
<script src="//unpkg.com/vue"></script>
<script src="//unpkg.com/docsify"></script>
<!-- oder verwende die komprimierten Dateien -->
<script src="//unpkg.com/vue/dist/vue.min.js"></script>
<script src="//unpkg.com/docsify/lib/docsify.min.js"></script>
```
Dann kannst du sofort Vue Code in deinen Markdown Dateien verwenden. `new Vue({ el: '#main' })` wird als Standard ausgeführt, um Instanzen zu erschaffen.
*README.md*
```markdown
# Vue guide
`v-for` usage.
```html
<ul>
<li v-for="i in 10">{{ i }}</li>
</ul>
``
<ul>
<li v-for="i in 10">{{ i }}</li>
</ul>
```
Du kannst manuell eine Vue Instanz initialisieren.
*README.md*
```markdown
# Vue demo
<div>hello {{ msg }}</div>
<script>
new Vue({
el: '#main',
data: { msg: 'Vue' }
})
</script>
```
!> In Markdown Dateien wird nur das Skript innerhalb des ersten script tag Blocks ausgeführt.
## Kombiniere Vuep um Demos zu erschaffen
[Vuep](https://github.com/QingWei-Li/vuep) ist eine Komponente zur Darstellung von Vue Komponenten mit einem Liveeditor und einer Vorschau.Unterstützt die Vue Komponenten spec und JSX.
*index.html*
```html
<!-- injizieren von CSS -->
<link rel="stylesheet" href="//unpkg.com/vuep/dist/vuep.css">
<!-- injizieren von JS -->
<script src="//unpkg.com/vue"></script>
<script src="//unpkg.com/vuep"></script>
<script src="//unpkg.com/docsify"></script>
<!-- oder verwende die komprimierten Dateien -->
<script src="//unpkg.com/vue/dist/vue.min.js"></script>
<script src="//unpkg.com/vuep/dist/vuep.min.js"></script>
<script src="//unpkg.com/docsify/lib/docsify.min.js"></script>
```
*README.md*
```markdown
# Vuep
<vuep template="#example"></vuep>
<script v-pre type="text/x-template" id="example">
<template>
<div>Hello, {{ name }}!</div>
</template>
<script>
module.exports = {
data: function () {
return { name: 'Vue' }
}
}
</script>
</script>
```
?> Zum Beispiel vergleich auch die [vuep Dokumentation](https://qingwei-li.github.io/vuep/).
+70
View File
@@ -0,0 +1,70 @@
# Schreiben einer Erweiterung
Eine Erweiterung ist schlicht eine Funktion, welche `hook` als Argument nimmt. hook unterstützt dabei das Verwalten von asynchrononen Tasks.
## Volle Konfiguration
```js
window.$docsify = {
plugins: [
function (hook, vm) {
hook.init(function() {
// Called when the script starts running, only trigger once, no arguments,
})
hook.beforeEach(function(content) {
// Invoked each time before parsing the Markdown file.
// ...
return content
})
hook.afterEach(function(html, next) {
// Invoked each time after the Markdown file is parsed.
// beforeEach and afterEach support asynchronous。
// ...
// call `next(html)` when task is done.
next(html)
})
hook.doneEach(function() {
// Invoked each time after the data is fully loaded, no arguments,
// ...
})
hook.mounted(function() {
// Called after initial completion. Only trigger once, no arguments.
})
hook.ready(function() {
// Called after initial completion, no arguments.
})
}
]
}
```
!> Du kannst auf interne Methoden über `window.Docsify` zugreifen. Greife auf die aktuelle Instanz über das zweite Argument zu.
## Beispiel
Füge jeder Seite eine footer Komponente hinzu:
```js
window.$docsify = {
plugins: [
function (hook) {
var footer = [
'<hr/>',
'<footer>',
'<span><a href="https://github.com/QingWei-Li">cinwell</a> &copy;2017.</span>',
'<span>Proudly published with <a href="https://github.com/QingWei-Li/docsify" target="_blank">docsify</a>.</span>',
'</footer>'
].join('')
hook.afterEach(function (html) {
return html + footer
})
}
]
}
```
+6 -6
View File
@@ -1,16 +1,16 @@
# Deploy
As as GitBook, you can deploy files to GitHub Pages or VPS.
Similar to [GitBook](https://www.gitbook.com), you can deploy files to GitHub Pages or VPS.
## GitHub Pages
There're three places to populate your docs
There're three places to populate your docs for your Github repository:
- `docs/` folder
- master branch
- gh-pages branch
* `docs/` folder
* master branch
* gh-pages branch
You can save your files in `./docs` and setting `master branch /docs folder`.
It is recommended that you save your files to the `./docs` subfolder of the `master` branch of your repository. Then select `master branch /docs folder` as your Github Pages source in your repositories' settings page.
![github pages](_images/deploy-github-pages.png)
+6 -5
View File
@@ -4,23 +4,24 @@ docsify extends Markdown syntax to make your documents more readable.
## important content
Suitable for displaying important information.
Important content like:
```markdown
!> **Time** is money, my friend!
```
!> **Time** is money, my friend!
is rendered as:
!> **Time** is money, my friend!
## General tips
General tips.
General tips like:
```markdown
?> *TODO* unit test
```
?> *TODO* unit test
are rendered as:
?> *TODO* unit test
+31 -12
View File
@@ -10,26 +10,45 @@
<link rel="stylesheet" href="//unpkg.com/docsify/lib/themes/vue.css" title="vue">
<link rel="stylesheet" href="//unpkg.com/docsify/lib/themes/dark.css" title="dark" disabled>
<link rel="stylesheet" href="//unpkg.com/docsify/lib/themes/buble.css" title="buble" disabled>
<link rel="stylesheet" href="//unpkg.com/docsify/lib/themes/pure.css" title="pure" disabled>
<style>
nav.app-nav li ul {
min-width: 100px;
}
</style>
</head>
<body>
<nav data-cloak>
<a href="#/">En</a>
<a href="#/zh-cn/">中文</a>
</nav>
<div id="app"></div>
<div id="app">Loading ...</div>
</body>
<script>
window.$docsify = {
name: 'docsify',
maxLevel: 4,
subMaxLevel: 2,
auto2top: true,
coverpage: true,
loadSidebar: true,
alias: {
'/de-de/changelog': '/changelog',
'/zh-cn/changelog': '/changelog',
'/changelog': 'https://raw.githubusercontent.com/QingWei-Li/docsify/master/CHANGELOG'
}
},
auto2top: true,
coverpage: true,
executeScript: true,
loadSidebar: true,
loadNavbar: true,
mergeNavbar: true,
maxLevel: 4,
name: 'docsify',
search: {
noData: {
'/de-de/': 'Keine Ergebnisse!',
'/zh-cn/': '没有结果!',
'/': 'No results!'
},
paths: 'auto',
placeholder: {
'/de-de/': 'Suche',
'/zh-cn/': '搜索',
'/': 'Search'
}
},
subMaxLevel: 2
}
</script>
<script src="//unpkg.com/docsify/lib/docsify.min.js"></script>
+5 -7
View File
@@ -1,13 +1,11 @@
# language highlight
The code language highlight tool is [Prism](https://github.com/PrismJS/prism). Only supports CSS, JavaScipt and HTML by default. You can load its component to highlight the language you need.
**docsify** uses [Prism](https://github.com/PrismJS/prism) to highlight code blocks in your pages. By default it only supports CSS, JavaScipt and HTML. You can make **Prism** load additional languages:
```html
<script src="//unpkg.com/docsify"></script>
<script src="//unpkg.com/prismjs/components/prism-bash.js"></script>
<script src="//unpkg.com/prismjs/components/prism-php.js"></script>
<script src="//unpkg.com/docsify/lib/docsify.min.js"></script>
<script src="//unpkg.com/prismjs/components/prism-bash.min.js"></script>
<script src="//unpkg.com/prismjs/components/prism-php.min.js"></script>
```
?> See fully supported highlight component [files list](https://github.com/PrismJS/prism/tree/gh-pages/components).
?> Check the [component files](https://github.com/PrismJS/prism/tree/gh-pages/components) list for more options.
+1 -1
View File
@@ -1,6 +1,6 @@
# Markdown configuration
The Markdown parser is [marked](https://github.com/chjj/marked). You can customize how docsify renders your Markdown content to HTML. Support customize `renderer`.
**docsify** uses [marked](https://github.com/chjj/marked) as its Markdown parser. You can customize how it renders your Markdown content to HTML by customizing `renderer`:
```js
window.$docsify = {
+44 -18
View File
@@ -1,22 +1,21 @@
# More pages
If you need more pages multi-level routing site. It is easy to achieve in docsify. A simple example: If you create a `guide.md`, then get the route is `/#/guide`.
If you need more pages, you can simply create more markdown files in your docsify directory. If you create a file named `guide.md`, then it is accessible via `/#/guide`.
For example, the directory structure is as follows:
```text
-| docs/
-| README.md
-| guide.md
-| zh-cn/
-| README.md
-| guide.md
.
├── docs
| └── README.md
| └── guide.md
| └── zh-cn
| └──README.md
| └──guide.md
```
Matching routes
```text
docs/README.md => http://domain.com
docs/guide.md => http://domain.com/guide
@@ -26,41 +25,68 @@ docs/zh-cn/guide.md => http://domain.com/zh-cn/guide
## Custom sidebar
By default, the TOC in sidebar is automatically generated based on Markdown file. You can create a Table of Contents page to list down pages in your site.
By default, the table of contents in the sidebar is automatically generated based on your markdown files. If you need a custom sidebar, then you can create your own `_sidebar.md` (see [this documentation's sidebar](https://github.com/QingWei-Li/docsify/blob/master/docs/_sidebar.md) for an example):
First, you need to set `loadSidebar` to **true**. The detail in [Configuration#load-sidebar](configuration#load-sidebar).
First, you need to set `loadSidebar` to **true**. Details are available in the [configuration paragraph](configuration.md#load-sidebar).
```html
<!-- index.html -->
<script>
window.$docsify = {
loadSidebar: true
}
</script>
<script src="//unpkg.com/docsify"></script>
<script src="//unpkg.com/docsify/lib/docsify.min.js"></script>
```
Create the `_sidebar.md`
Create the `_sidebar.md`:
```markdown
<!-- docs/_sidebar.md -->
- [Home](/)
- [Guide](/guide)
- [Guide](guide.md)
```
!> Need create a `.nojekyll` in `./docs` to prevent GitHub Pages from ignoring files that begin with an underscore.
!> You need to create a `.nojekyll` in `./docs` to prevent GitHub Pages from ignoring files that begin with an underscore.
`_sidebar.md` is loaded from each level directory. If this directory doesn't have `_sidebar.md`, it will fallback to parent directory. For example, the current path is `/guide/quick-start`, the `_sidebar.md` will be loaded from `/guide/_sidebar.md`.
`_sidebar.md` is loaded from each level directory. If the current directory doesn't have `_sidebar.md`, it will fall back to the parent directory. If, for example, the current path is `/guide/quick-start`, the `_sidebar.md` will be loaded from `/guide/_sidebar.md`.
## Table of Contents
Custom sidebar can also be automatically generate TOC by setting `subMaxLevel`. The detail in [Configuration#sub-max-level](configuration#sub-max-level).
A custom sidebar can also automatically generate a table of contents by setting a `subMaxLevel`, compare [sub-max-level configuration](configuration.md#sub-max-level).
```html
<!-- index.html -->
<script>
window.$docsify = {
loadSidebar: true,
subMaxLevel: 2
}
</script>
<script src="//unpkg.com/docsify"></script>
<script src="//unpkg.com/docsify/lib/docsify.min.js"></script>
```
## Ignoring Subheaders
When `subMaxLevel` is set, each header is automatically added to the table of contents by default. If you want to ignore a specific header, add `{docsify-ignore}` to it.
```markdown
# Getting Started
## Header {docsify-ignore}
This header won't appear in the sidebar table of contents.
```
To ignore all headers on a specific page, you can use `{docsify-ignore-all}` on the first header of the page.
```markdown
# Getting Started {docsify-ignore-all}
## Header
This header won't appear in the sidebar table of contents.
```
Both `{docsify-ignore}` and `{docsify-ignore-all}` will not be rendered on the page when used.
+37 -76
View File
@@ -1,8 +1,6 @@
# Using plugins
# List of Plugins
## List of Plugins
### Full text search
## Full text search
By default, the hyperlink on the current page is recognized and the content is saved in `localStorage`. You can also specify the path to the files.
@@ -19,7 +17,7 @@ By default, the hyperlink on the current page is recognized and the content is s
'/zh-cn/', // => /zh-cn/README.md
],
// 完整配置参数
// complete configuration parameters
search: {
maxAge: 86400000, // Expiration time, the default one day
paths: [], // or 'auto'
@@ -29,16 +27,23 @@ By default, the hyperlink on the current page is recognized and the content is s
placeholder: {
'/zh-cn/': '搜索',
'/': 'Type to search'
},
noData: 'No Results!',
// Localization
noData: {
'/zh-cn/': '找不到结果',
'/': 'No Results'
}
}
}
</script>
<script src="//unpkg.com/docsify"></script>
<script src="//unpkg.com/docsify/lib/plugins/search.js"></script>
<script src="//unpkg.com/docsify/lib/docsify.min.js"></script>
<script src="//unpkg.com/docsify/lib/plugins/search.min.js"></script>
```
### Google Analytics
## Google Analytics
Install the plugin and configure the track id.
@@ -48,87 +53,43 @@ Install the plugin and configure the track id.
ga: 'UA-XXXXX-Y'
}
</script>
<script src="//unpkg.com/docsify"></script>
<script src="//unpkg.com/docsify/lib/plugins/ga.js"></script>
<script src="//unpkg.com/docsify/lib/docsify.min.js"></script>
<script src="//unpkg.com/docsify/lib/plugins/ga.min.js"></script>
```
Configure by `data-ga`.
```html
<script src="//unpkg.com/docsify/lib/docsify.min.js" data-ga="UA-XXXXX-Y"></script>
<script src="//unpkg.com/docsify/lib/plugins/ga.min.js"></script>
```
## front matter
```html
<script src="//unpkg.com/docsify" data-ga="UA-XXXXX-Y"></script>
<script src="//unpkg.com/docsify/lib/plugins/ga.js"></script>
<script src="//unpkg.com/docsify/lib/plugins/front-matter.min.js"></script>
```
## emoji
## Write a plugin
The default is to support parsing emoji. For example `:100:` will be parsed to :100:. But it is not precise because there is no matching non-emoji string. If you need to correctly parse the emoji string, you need install this plugin.
A plugin is simply a function that takes `hook` as arguments.
The hook supports handling asynchronous tasks.
#### Full configuration
```js
window.$docsify = {
plugins: [
function (hook, vm) {
hook.init(function() {
// Called when the script starts running, only trigger once, no arguments,
})
hook.beforeEach(function(content) {
// Invoked each time before parsing the Markdown file.
// ...
return content
})
hook.afterEach(function(html, next) {
// Invoked each time after the Markdown file is parsed.
// beforeEach and afterEach support asynchronous。
// ...
// call `next(html)` when task is done.
next(html)
})
hook.doneEach(function() {
// Invoked each time after the data is fully loaded, no arguments,
// ...
})
hook.mounted(function() {
// Called after initial completion. Only trigger once, no arguments.
})
hook.ready(function() {
// Called after initial completion, no arguments.
})
}
]
}
```html
<script src="//unpkg.com/docsify/lib/plugins/emoji.min.js"></script>
```
!> You can get internal methods through `window.Docsify`. Get the current instance through the second argument.
## External Script
#### Example
If the script on the page is an external one (imports a js file via `src` attribute), you'll need this plugin to make it work.
Add footer component in each pages.
```html
<script src="//unpkg.com/docsify/lib/plugins/external-script.min.js"></script>
```
```js
window.$docsify = {
plugins: [
function (hook) {
var footer = [
'<hr/>',
'<footer>',
'<span><a href="https://github.com/QingWei-Li">cinwell</a> &copy;2017.</span>',
'<span>Proudly published with <a href="https://github.com/QingWei-Li/docsify" target="_blank">docsify</a>.</span>',
'</footer>'
].join('')
## Zoom image
hook.afterEach(function (html) {
return html + footer
})
}
]
}
Medium's Image Zoom. Based on [zoom-image](https://github.com/egoist/zoom-image).
```html
<script src="//unpkg.com/docsify/lib/plugins/zoom-image.min.js"></script>
```
+115
View File
@@ -0,0 +1,115 @@
# Offline Mode
[Progressive Web Apps](https://developers.google.com/web/progressive-web-apps/) (PWA) are experiences that combine the best of the web with the best of apps. We can enhance our website with service workers to work **offline** or on low-quality networks.
It is also very easy to use it.
## Create serviceWorker
Create a `sw.js` file in your documents root directory and copy the following code:
*sw.js*
```js
/* ===========================================================
* docsify sw.js
* ===========================================================
* Copyright 2016 @huxpro
* Licensed under Apache 2.0
* Register service worker.
* ========================================================== */
const RUNTIME = 'docsify'
const HOSTNAME_WHITELIST = [
self.location.hostname,
'fonts.gstatic.com',
'fonts.googleapis.com',
'unpkg.com'
]
// The Util Function to hack URLs of intercepted requests
const getFixedUrl = (req) => {
var now = Date.now()
var url = new URL(req.url)
// 1. fixed http URL
// Just keep syncing with location.protocol
// fetch(httpURL) belongs to active mixed content.
// And fetch(httpRequest) is not supported yet.
url.protocol = self.location.protocol
// 2. add query for caching-busting.
// Github Pages served with Cache-Control: max-age=600
// max-age on mutable content is error-prone, with SW life of bugs can even extend.
// Until cache mode of Fetch API landed, we have to workaround cache-busting with query string.
// Cache-Control-Bug: https://bugs.chromium.org/p/chromium/issues/detail?id=453190
if (url.hostname === self.location.hostname) {
url.search += (url.search ? '&' : '?') + 'cache-bust=' + now
}
return url.href
}
/**
* @Lifecycle Activate
* New one activated when old isnt being used.
*
* waitUntil(): activating ====> activated
*/
self.addEventListener('activate', event => {
event.waitUntil(self.clients.claim())
})
/**
* @Functional Fetch
* All network requests are being intercepted here.
*
* void respondWith(Promise<Response> r)
*/
self.addEventListener('fetch', event => {
// Skip some of cross-origin requests, like those for Google Analytics.
if (HOSTNAME_WHITELIST.indexOf(new URL(event.request.url).hostname) > -1) {
// Stale-while-revalidate
// similar to HTTP's stale-while-revalidate: https://www.mnot.net/blog/2007/12/12/stale
// Upgrade from Jake's to Surma's: https://gist.github.com/surma/eb441223daaedf880801ad80006389f1
const cached = caches.match(event.request)
const fixedUrl = getFixedUrl(event.request)
const fetched = fetch(fixedUrl, { cache: 'no-store' })
const fetchedCopy = fetched.then(resp => resp.clone())
// Call respondWith() with whatever we get first.
// If the fetch fails (e.g disconnected), wait for the cache.
// If theres nothing in cache, wait for the fetch.
// If neither yields a response, return offline pages.
event.respondWith(
Promise.race([fetched.catch(_ => cached), cached])
.then(resp => resp || fetched)
.catch(_ => { /* eat any errors */ })
)
// Update the cache with the version we fetched (only for ok status)
event.waitUntil(
Promise.all([fetchedCopy, caches.open(RUNTIME)])
.then(([response, cache]) => response.ok && cache.put(event.request, response))
.catch(_ => { /* eat any errors */ })
)
}
})
```
## Register
Now, register it in your `index.html`. It only works on some modern browsers, so we need to judge:
*index.html*
```html
<script>
if (typeof navigator.serviceWorker !== 'undefined') {
navigator.serviceWorker.register('sw.js')
}
</script>
```
## Enjoy it
Release your website and start experiencing magical offline feature. :ghost: You can turn off Wi-Fi and refresh the current site to experience it.
+25 -23
View File
@@ -1,14 +1,14 @@
# Quick start
Recommended install `docsify-cli` globally, which can help us to initialize and preview the website locally.
It is recommended to install `docsify-cli` globally, which helps initializing and previewing the website locally.
```bash
npm i docsify-cli -g
```
## initialize
## Initialize
If you want to write the documentation in `./docs` directory, you can use the `init` command.
If you want to write the documentation in the `./docs` subdirectory, you can use the `init` command.
```bash
docsify init ./docs
@@ -16,33 +16,31 @@ docsify init ./docs
## Writing content
After the init is complete, you can see the file list in the docs directory.
After the `init` is complete, you can see the file list in the `./docs` subdirectory.
* `index.html` as the entry file
* `README.md` as the home page
* `.nojekyll` prevents GitHub Pages from ignoring files that begin with an underscore
- `index.html` as the entry file
- `README.md` as the home page
- `.nojekyll` can prevent GitHub Pages from ignoring files that begin with an underscore
You can easily update the documentation in `docs/README.md`, of course you can add [more pages](more-pages).
You can easily update the documentation in `./docs/README.md`, of course you can add [more pages](more-pages.md).
## Preview your site
Run the local server via `docsify serve`. You can preview your site in browser via http://localhost:3000.
Run the local server with `docsify serve`. You can preview your site in your browser on `http://localhost:3000`.
```bash
docsify serve docs
```
?> More usages of reference [docsify-cli documentation](https://github.com/QingWei-Li/docsify-cli).
?> For more use cases of `docsify-cli`, head over to the [docsify-cli documentation](https://github.com/QingWei-Li/docsify-cli).
## Manually
## Manual initialization
If you don't like npm or feel the trouble to install the tool. What we need is an `index.html`.
*index.html*
If you don't like `npm` or have trouble installing the tool, you can manually create `index.html`:
```html
<!-- index.html -->
<!DOCTYPE html>
<html>
<head>
@@ -52,29 +50,31 @@ If you don't like npm or feel the trouble to install the tool. What we need is a
<body>
<div id="app"></div>
</body>
<script src="//unpkg.com/docsify"></script>
<script src="//unpkg.com/docsify/lib/docsify.min.js"></script>
</html>
```
If your system has Python, you can easily to run a static server to preview your site.
If you installed python on your system, you can easily use it to run a static server to preview your site.
```bash
cd docs && python -m SimpleHTTPServer 3000
```
## Loading tip
## Loading dialog
Show `Loading...` Before starting rendering. You can customize the content.
If you want, you can show a loading dialog before docsify starts to render your documentation:
*index.html*
```html
<!-- index.html -->
<div id="app">Please wait...</div>
```
You should set the `data-app` attribute if you changed `el`.
You should set the `data-app` attribute if you changed `el`:
*index.html*
```html
<!-- index.html -->
<div data-app id="main">Please wait...</div>
<script>
@@ -83,3 +83,5 @@ You should set the `data-app` attribute if you changed `el`.
}
</script>
```
Compare [el configuration](configuration.md#el).
+17 -9
View File
@@ -2,35 +2,43 @@
There are currently three themes available. Copy [Vue](//vuejs.org) and [buble](//buble.surge.sh) website custom theme and [@liril-net](https://github.com/liril-net) contribution to the theme of the black style.
```html
<link rel="stylesheet" href="//unpkg.com/docsify/themes/vue.css">
<link rel="stylesheet" href="//unpkg.com/docsify/themes/buble.css">
<link rel="stylesheet" href="//unpkg.com/docsify/themes/dark.css">
<link rel="stylesheet" href="//unpkg.com/docsify/themes/vue.css">
<link rel="stylesheet" href="//unpkg.com/docsify/themes/buble.css">
<link rel="stylesheet" href="//unpkg.com/docsify/themes/dark.css">
<link rel="stylesheet" href="//unpkg.com/docsify/themes/pure.css">
```
!> This compressed files in `/lib/themes/`.
!> Compressed files are available in `/lib/themes/`.
If you have any ideas or would like to develop new theme, welcome submit [PR](https://github.com/QingWei-Li/docsify/pulls).
```html
<!-- compressed -->
<link rel="stylesheet" href="//unpkg.com/docsify/lib/themes/vue.css">
<link rel="stylesheet" href="//unpkg.com/docsify/lib/themes/buble.css">
<link rel="stylesheet" href="//unpkg.com/docsify/lib/themes/dark.css">
<link rel="stylesheet" href="//unpkg.com/docsify/lib/themes/pure.css">
```
If you have any ideas or would like to develop a new theme, you are welcome to submit a [pull request](https://github.com/QingWei-Li/docsify/pulls).
#### Click to preview
<div class="demo-theme-preview">
<a data-theme="vue">vue.css</a>
<a data-theme="buble">buble.css</a>
<a data-theme="dark">dark.css</a>
<a data-theme="pure">pure.css</a>
</div>
<style>
.demo-theme-preview a {
padding-right: 10px;
}
.demo-theme-preview a:hover {
text-decoration: underline;
cursor: pointer;
text-decoration: underline;
}
</style>
+19 -9
View File
@@ -1,19 +1,21 @@
# Compatible with Vue
You can write Vue components directly in the Markdown file, and it will be parsed.
You can use this feature to write vue demo and documentation together.
You can write Vue components directly in the Markdown file, and it will be parsed. You can use this feature to write vue demo and documentation together.
## Basic usage
Load the Vue in `index.html`.
Load the Vue in `./index.html`.
```html
<script src="//unpkg.com/vue"></script>
<script src="//unpkg.com/docsify"></script>
<!-- or use the compressed files -->
<script src="//unpkg.com/vue/dist/vue.min.js"></script>
<script src="//unpkg.com/docsify/lib/docsify.min.js"></script>
```
Then you can immediately write Vue code at Markdown file.
`new Vue({ el: '#main' })` script is executed by default to create instance.
Then you can immediately write Vue code at Markdown file. `new Vue({ el: '#main' })` script is executed by default to create instance.
*README.md*
@@ -59,9 +61,18 @@ You can manually initialize a Vue instance.
*index.html*
```html
<!-- inject css file -->
<link rel="stylesheet" href="//unpkg.com/vuep/dist/vuep.css">
<!-- inject javascript file -->
<script src="//unpkg.com/vue"></script>
<script src="//unpkg.com/vuep"></script>
<script src="//unpkg.com/docsify"></script>
<!-- or use the compressed files -->
<script src="//unpkg.com/vue/dist/vue.min.js"></script>
<script src="//unpkg.com/vuep/dist/vuep.min.js"></script>
<script src="//unpkg.com/docsify/lib/docsify.min.js"></script>
```
*README.md*
@@ -70,13 +81,13 @@ You can manually initialize a Vue instance.
<vuep template="#example"></vuep>
<script type="text/x-template" id="example">
<script v-pre type="text/x-template" id="example">
<template>
<div>Hello, {{ name }}!</div>
</template>
<script>
export default {
module.exports = {
data: function () {
return { name: 'Vue' }
}
@@ -85,5 +96,4 @@ You can manually initialize a Vue instance.
</script>
```
?> Example Refer to the vuep [documentation](https://qingwei-li.github.io/vuep/).
?> Example Refer to the [vuep documentation](https://qingwei-li.github.io/vuep/).
+70
View File
@@ -0,0 +1,70 @@
# Write a plugin
A plugin is simply a function that takes `hook` as an argument. The hook supports handling of asynchronous tasks.
## Full configuration
```js
window.$docsify = {
plugins: [
function (hook, vm) {
hook.init(function() {
// Called when the script starts running, only trigger once, no arguments,
})
hook.beforeEach(function(content) {
// Invoked each time before parsing the Markdown file.
// ...
return content
})
hook.afterEach(function(html, next) {
// Invoked each time after the Markdown file is parsed.
// beforeEach and afterEach support asynchronous。
// ...
// call `next(html)` when task is done.
next(html)
})
hook.doneEach(function() {
// Invoked each time after the data is fully loaded, no arguments,
// ...
})
hook.mounted(function() {
// Called after initial completion. Only trigger once, no arguments.
})
hook.ready(function() {
// Called after initial completion, no arguments.
})
}
]
}
```
!> You can get internal methods through `window.Docsify`. Get the current instance through the second argument.
## Example
Add footer component in each pages.
```js
window.$docsify = {
plugins: [
function (hook) {
var footer = [
'<hr/>',
'<footer>',
'<span><a href="https://github.com/QingWei-Li">cinwell</a> &copy;2017.</span>',
'<span>Proudly published with <a href="https://github.com/QingWei-Li/docsify" target="_blank">docsify</a>.</span>',
'</footer>'
].join('')
hook.afterEach(function (html) {
return html + footer
})
}
]
}
```
+4 -3
View File
@@ -6,16 +6,17 @@
docsify 是一个动态生成文档网站的工具。不同于 GitBook、Hexo 的地方是它不会生成将 `.md` 转成 `.html` 文件,所有转换工作都是在运行时进行。
这将非常实用,如果只是需要快速的搭建一个小型的文档网站,或者不想因为生成的一堆 `.html` 文件“污染” commit 记录,只需要创建一个 `index.html` 就可以开始写文档而且直接[部署在 GitHub Pages](zh-cn/deploy)。
这将非常实用,如果只是需要快速的搭建一个小型的文档网站,或者不想因为生成的一堆 `.html` 文件“污染” commit 记录,只需要创建一个 `index.html` 就可以开始写文档而且直接[部署在 GitHub Pages](zh-cn/deploy.md)。
查看[快速开始](zh-cn/quickstart)了解详情。
查看[快速开始](zh-cn/quickstart.md)了解详情。
## 特性
- 无需构建,写完文档直接发布
- 容易使用并且轻量 (~14kB gzipped)
- 容易使用并且轻量 (~16kB gzipped)
- 智能的全文搜索
- 提供多套主题
- 丰富的 API
- 支持 Emoji
- 兼容 IE10+
## 例子
+16 -14
View File
@@ -1,20 +1,22 @@
- 入门
- [快速开始](zh-cn/quickstart)
- [多页文档](zh-cn/more-pages)
- [定制导航栏](zh-cn/custom-navbar)
- [封面](zh-cn/cover)
- [快速开始](zh-cn/quickstart.md)
- [多页文档](zh-cn/more-pages.md)
- [定制导航栏](zh-cn/custom-navbar.md)
- [封面](zh-cn/cover.md)
- 定制化
- [配置项](zh-cn/configuration)
- [主题](zh-cn/themes)
- [使用插件](zh-cn/plugins)
- [Markdown 配置](zh-cn/markdown)
- [代码高亮](zh-cn/language-highlight)
- [配置项](zh-cn/configuration.md)
- [主题](zh-cn/themes.md)
- [插件列表](zh-cn/plugins.md)
- [开发插件](zh-cn/write-a-plugin.md)
- [Markdown 配置](zh-cn/markdown.md)
- [代码高亮](zh-cn/language-highlight.md)
- 指南
- [部署](zh-cn/deploy)
- [文档助手](zh-cn/helpers)
- [兼容 Vue](zh-cn/vue)
- [CDN](zh-cn/cdn)
- [部署](zh-cn/deploy.md)
- [文档助手](zh-cn/helpers.md)
- [兼容 Vue](zh-cn/vue.md)
- [CDN](zh-cn/cdn.md)
- [离线模式(PWA)](zh-cn/pwa.md)
- [Changelog](zh-cn/changelog)
- [Changelog](zh-cn/changelog.md)
+3 -2
View File
@@ -44,5 +44,6 @@ JS 的压缩文件是原有文件路径的基础上加 `.min`后缀
## 其他 CDN
[jsDelivr](http://www.jsdelivr.com/projects/docsify) 也是可用的,具体用法参考其文档。
- http://www.bootcdn.cn/docsify
- http://www.jsdelivr.com/projects/docsify
- https://cdnjs.com/libraries/docsify
+34 -6
View File
@@ -74,7 +74,7 @@ window.$docsify = {
- 类型:`Boolean|String`
- 默认值: `false`
加载自定义导航栏,参考[定制导航栏](zh-cn/custom-navbar) 了解用法。设置为 `true` 后会加载 `_navbar.md` 文件,也可以自定义加载的文件名。
加载自定义导航栏,参考[定制导航栏](zh-cn/custom-navbar.md) 了解用法。设置为 `true` 后会加载 `_navbar.md` 文件,也可以自定义加载的文件名。
```js
window.$docsify = {
@@ -91,7 +91,7 @@ window.$docsify = {
- 类型:`Boolean|String`
- 默认值: `false`
加载自定义侧边栏,参考[多页文档](zh-cn/more-pages)。设置为 `true` 后会加载 `_sidebar.md` 文件,也可以自定义加载的文件名。
加载自定义侧边栏,参考[多页文档](zh-cn/more-pages.md)。设置为 `true` 后会加载 `_sidebar.md` 文件,也可以自定义加载的文件名。
```js
window.$docsify = {
@@ -173,7 +173,7 @@ window.$docsify = {
- 类型:`Boolean|String`
- 默认值: `false`
启用[封面页](/zh-cn/cover)。开启后是加载 `_coverpage.md` 文件,也可以自定义文件名。
启用[封面页](zh-cn/cover.md)。开启后是加载 `_coverpage.md` 文件,也可以自定义文件名。
```js
window.$docsify = {
@@ -206,7 +206,13 @@ window.$docsify = {
```js
window.$docsify = {
nameLink: '/'
nameLink: '/',
// 按照路由切换
nameLink: {
'/zh-cn/': '/zh-cn/',
'/': '/'
}
}
```
@@ -214,7 +220,7 @@ window.$docsify = {
- 类型: `Object|Function`
参考 [Markdown 配置](/zh-cn/markdown)。
参考 [Markdown 配置](zh-cn/markdown.md)。
```js
window.$docsify = {
@@ -281,7 +287,7 @@ window.$docsify = {
- 类型:`Boolean`
执行文档里的 script 标签里的脚本,只执行第一个 script ([demo](zh-cn/themes))。 如果 Vue 存在,则自动开启。
执行文档里的 script 标签里的脚本,只执行第一个 script ([demo](zh-cn/themes.md))。 如果 Vue 存在,则自动开启。
```js
window.$docsify = {
@@ -298,3 +304,25 @@ window.$docsify = {
```
注意如果执行的是一个外链脚本,比如 jsfiddle 的内嵌 demo,请确保引入 [external-script](plugins.md?id=外链脚本-external-script) 插件。
## no-emoji
禁用 emoji 解析。
```js
window.$docsify = {
noEmoji: true
}
```
## merge-navbar
小屏设备下合并导航栏到侧边栏。
```js
window.$docsify = {
mergeNavbar: true
}
```
+1 -1
View File
@@ -1,6 +1,6 @@
# 封面
通过设置 `coverpage` 参数,可以开启渲染封面的功能。具体用法见[配置项#coverpage](zh-cn/configuration#coverpage)。
通过设置 `coverpage` 参数,可以开启渲染封面的功能。具体用法见[配置项#coverpage](configuration.md#coverpage)。
## 基本用法
+10 -10
View File
@@ -17,7 +17,7 @@
## 配置文件
那我们可以通过 Markdown 文件来配置导航。首先配置 `loadNavbar`,默认加载的文件为 `_navbar.md`。具体配置规则见[配置项#load-navbar](zh-cn/configuration#load-navbar)。
那我们可以通过 Markdown 文件来配置导航。首先配置 `loadNavbar`,默认加载的文件为 `_navbar.md`。具体配置规则见[配置项#load-navbar](configuration.md#load-navbar)。
*index.html*
@@ -49,17 +49,17 @@
```markdown
- 基础
- [快速开始](zh-cn/quickstart)
- [多页文档](zh-cn/more-pages)
- [定制导航栏](zh-cn/custom-navbar)
- [封面](zh-cn/cover)
- [快速开始](zh-cn/quickstart.md)
- [多页文档](zh-cn/more-pages.md)
- [定制导航栏](zh-cn/custom-navbar.md)
- [封面](zh-cn/cover.md)
- 配置
- [配置项](zh-cn/configuration)
- [主题](zh-cn/themes)
- [使用插件](zh-cn/plugins)
- [Markdown 配置](zh-cn/markdown)
- [代码高亮](zh-cn/language-highlight)
- [配置项](zh-cn/configuration.md)
- [主题](zh-cn/themes.md)
- [使用插件](zh-cn/plugins.md)
- [Markdown 配置](zh-cn/markdown.md)
- [代码高亮](zh-cn/language-highlight.md)
```
效果图
+22 -1
View File
@@ -26,7 +26,7 @@ docs/zh-cn/guide.md => http://domain.com/zh-cn/guide
默认情况下,侧边栏会根据当前文档的标题生成目录。也可以设置文档链接,通过 Markdown 文件生成,效果如当前的文档的侧边栏。
首先配置 `loadSidebar` 选项,具体配置规则见[配置项#load-sidebar](zh-cn/configuration#load-sidebar)。
首先配置 `loadSidebar` 选项,具体配置规则见[配置项#load-sidebar](configuration.md#load-sidebar)。
```html
<script>
@@ -63,4 +63,25 @@ docs/zh-cn/guide.md => http://domain.com/zh-cn/guide
<script src="//unpkg.com/docsify"></script>
```
## Ignoring Subheaders
When `subMaxLevel` is set, each header is automatically added to the table of contents by default. If you want to ignore a specific header, add `{docsify-ignore}` to it.
```markdown
# Getting Started
## Header {docsify-ignore}
This header won't appear in the sidebar table of contents.
```
To ignore all headers on a specific page, you can use `{docsify-ignore-all}` on the first header of the page.
```markdown
# Getting Started {docsify-ignore-all}
## Header
This header won't appear in the sidebar table of contents.
```
Both `{docsify-ignore}` and `{docsify-ignore-all}` will not be rendered on the page when used.
+25 -65
View File
@@ -1,8 +1,6 @@
# 使用插件
# 插件列表
## 内置插件
### 全文搜索 - Search
## 全文搜索 - Search
全文搜索插件会根据当前页面上的超链接获取文档内容,在 `localStorage` 内建立文档索引。默认过期时间为一天,当然我们可以自己指定需要缓存的文件列表或者配置过期时间。
@@ -29,6 +27,14 @@
placeholder: {
'/zh-cn/': '搜索',
'/': 'Type to search'
},
noData: 'No Results!',
// 支持本地化
noData: {
'/zh-cn/': '找不到结果',
'/': 'No Results'
}
}
}
@@ -37,7 +43,7 @@
<script src="//unpkg.com/docsify/lib/plugins/search.js"></script>
```
### 谷歌统计 - Google Analytics
## 谷歌统计 - Google Analytics
需要配置 track id 才能使用。
@@ -58,72 +64,26 @@
<script src="//unpkg.com/docsify/lib/plugins/ga.js"></script>
```
## 自定义插件
## emoji
docsify 提供了一套插件机制,其中提供的钩子(hook)支持处理异步逻辑,可以很方便的扩展功能
默认是提供 emoji 解析的,能将类似 `:100:` 解析成 :100:。但是它不是精准的,因为没有处理非 emoji 的字符串。如果你需要正确解析 emoji 字符串,你可以引入这个插件
#### 完整功能
```js
window.$docsify = {
plugins: [
function (hook, vm) {
hook.init(function() {
// 初始化时调用,只调用一次,没有参数。
})
hook.beforeEach(function(content) {
// 每次开始解析 Markdown 内容时调用
// ...
return content
})
hook.afterEach(function(html, next) {
// 解析成 html 后调用。beforeEach 和 afterEach 支持处理异步逻辑
// ...
// 异步处理完成后调用 next(html) 返回结果
next(html)
})
hook.doneEach(function() {
// 每次路由切换时数据全部加载完成后调用,没有参数。
// ...
})
hook.mounted(function() {
// 初始化完成后调用 ,只调用一次,没有参数。
})
hook.ready(function() {
// 初始化并第一次加完成数据后调用,没有参数。
})
}
]
}
```html
<script src="//unpkg.com/docsify/lib/plugins/emoji.js"></script>
```
!> 如果需要用 docsify 的内部方法,可以通过 `window.Docsify` 获取,通过 `vm` 获取当前实例。
## 外链脚本 - External Script
#### 例子
如果文档里的 script 是内联脚本,可以直接执行;而如果是外链脚本(即 js 文件内容由 `src` 属性引入),则需要使用此插件。
给每个页面的末尾加上 `footer`
```html
<script src="//unpkg.com/docsify/lib/plugins/external-script.js"></script>
```
```js
window.$docsify = {
plugins: [
function (hook) {
var footer = [
'<hr/>',
'<footer>',
'<span><a href="https://github.com/QingWei-Li">cinwell</a> &copy;2017.</span>',
'<span>Proudly published with <a href="https://github.com/QingWei-Li/docsify" target="_blank">docsify</a>.</span>',
'</footer>'
].join('')
## 图片缩放 - Zoom image
hook.afterEach(function (html) {
return html + footer
})
}
]
}
Medium's 风格的图片缩放插件. 基于 [zoom-image](https://github.com/egoist/zoom-image)。
```html
<script src="//unpkg.com/docsify/lib/plugins/zoom-image.js"></script>
```
+113
View File
@@ -0,0 +1,113 @@
# 离线模式
[Progressive Web Apps](https://developers.google.com/web/progressive-web-apps/)(PWA) 是一项融合 Web 和 Native 应用各项优点的解决方案。我们可以利用其支持离线功能的特点,让我们的网站可以在信号差或者离线状态下正常运行。
要使用它也非常容易。
## 创建 serviceWorker
这里已经整理好了一份代码,你只需要在网站根目录下创建一个 `sw.js` 文件,并粘贴下面的代码。
*sw.js*
```js
/* ===========================================================
* docsify sw.js
* ===========================================================
* Copyright 2016 @huxpro
* Licensed under Apache 2.0
* Register service worker.
* ========================================================== */
const RUNTIME = 'docsify'
const HOSTNAME_WHITELIST = [
self.location.hostname,
'fonts.gstatic.com',
'fonts.googleapis.com',
'unpkg.com'
]
// The Util Function to hack URLs of intercepted requests
const getFixedUrl = (req) => {
var now = Date.now()
var url = new URL(req.url)
// 1. fixed http URL
// Just keep syncing with location.protocol
// fetch(httpURL) belongs to active mixed content.
// And fetch(httpRequest) is not supported yet.
url.protocol = self.location.protocol
// 2. add query for caching-busting.
// Github Pages served with Cache-Control: max-age=600
// max-age on mutable content is error-prone, with SW life of bugs can even extend.
// Until cache mode of Fetch API landed, we have to workaround cache-busting with query string.
// Cache-Control-Bug: https://bugs.chromium.org/p/chromium/issues/detail?id=453190
if (url.hostname === self.location.hostname) {
url.search += (url.search ? '&' : '?') + 'cache-bust=' + now
}
return url.href
}
/**
* @Lifecycle Activate
* New one activated when old isnt being used.
*
* waitUntil(): activating ====> activated
*/
self.addEventListener('activate', event => {
event.waitUntil(self.clients.claim())
})
/**
* @Functional Fetch
* All network requests are being intercepted here.
*
* void respondWith(Promise<Response> r)
*/
self.addEventListener('fetch', event => {
// Skip some of cross-origin requests, like those for Google Analytics.
if (HOSTNAME_WHITELIST.indexOf(new URL(event.request.url).hostname) > -1) {
// Stale-while-revalidate
// similar to HTTP's stale-while-revalidate: https://www.mnot.net/blog/2007/12/12/stale
// Upgrade from Jake's to Surma's: https://gist.github.com/surma/eb441223daaedf880801ad80006389f1
const cached = caches.match(event.request)
const fixedUrl = getFixedUrl(event.request)
const fetched = fetch(fixedUrl, { cache: 'no-store' })
const fetchedCopy = fetched.then(resp => resp.clone())
// Call respondWith() with whatever we get first.
// If the fetch fails (e.g disconnected), wait for the cache.
// If theres nothing in cache, wait for the fetch.
// If neither yields a response, return offline pages.
event.respondWith(
Promise.race([fetched.catch(_ => cached), cached])
.then(resp => resp || fetched)
.catch(_ => { /* eat any errors */ })
)
// Update the cache with the version we fetched (only for ok status)
event.waitUntil(
Promise.all([fetchedCopy, caches.open(RUNTIME)])
.then(([response, cache]) => response.ok && cache.put(event.request, response))
.catch(_ => { /* eat any errors */ })
)
}
})
```
## 注册
现在,到 `index.html` 里注册它。这个功能只能工作在一些现代浏览器上,所以我们需要加个判断。
*index.html*
```html
<script>
if (typeof navigator.serviceWorker !== 'undefined') {
navigator.serviceWorker.register('sw.js')
}
</script>
```
## 体验一下
发布你的网站,并开始享受离线模式的魔力吧!:ghost: 当然你现在看到的 docsify 的文档网站已经支持离线模式了,你可以关掉 Wi-Fi 体验一下。
+1 -2
View File
@@ -22,7 +22,7 @@ docsify init ./docs
- `README.md` 会做为主页内容渲染
- `.nojekyll` 用于阻止 GitHub Pages 会忽略掉下划线开头的文件
直接编辑 `docs/README.md` 就能更新网站内容,当然也可以[写多个页面](zh-cn/more-pages)。
直接编辑 `docs/README.md` 就能更新网站内容,当然也可以[写多个页面](zh-cn/more-pages.md)。
## 本地预览网站
@@ -81,4 +81,3 @@ cd docs && python -m SimpleHTTPServer 3000
}
</script>
```
+9
View File
@@ -6,10 +6,18 @@
<link rel="stylesheet" href="//unpkg.com/docsify/themes/vue.css">
<link rel="stylesheet" href="//unpkg.com/docsify/themes/buble.css">
<link rel="stylesheet" href="//unpkg.com/docsify/themes/dark.css">
<link rel="stylesheet" href="//unpkg.com/docsify/themes/pure.css">
```
!> CSS 的压缩文件位于 `/lib/themes/`
```html
<link rel="stylesheet" href="//unpkg.com/docsify/lib/themes/vue.css">
<link rel="stylesheet" href="//unpkg.com/docsify/lib/themes/buble.css">
<link rel="stylesheet" href="//unpkg.com/docsify/lib/themes/dark.css">
<link rel="stylesheet" href="//unpkg.com/docsify/lib/themes/pure.css">
```
如果你有其他想法或者想开发别的主题,欢迎提 [PR](https://github.com/QingWei-Li/docsify/pulls)。
#### 点击切换主题
@@ -19,6 +27,7 @@
<a data-theme="vue">vue.css</a>
<a data-theme="buble">buble.css</a>
<a data-theme="dark">dark.css</a>
<a data-theme="pure">pure.css</a>
</div>
+27 -2
View File
@@ -58,9 +58,18 @@
*index.html*
```html
<!-- inject css file -->
<link rel="stylesheet" href="//unpkg.com/vuep/dist/vuep.css">
<!-- inject javascript file -->
<script src="//unpkg.com/vue"></script>
<script src="//unpkg.com/vuep"></script>
<script src="//unpkg.com/docsify"></script>
<!-- or use the compressed files -->
<script src="//unpkg.com/vue/dist/vue.min.js"></script>
<script src="//unpkg.com/vuep/dist/vuep.min.js"></script>
<script src="//unpkg.com/docsify/lib/docsify.min.js"></script>
```
*README.md*
@@ -69,13 +78,13 @@
<vuep template="#example"></vuep>
<script type="text/x-template" id="example">
<script v-pre type="text/x-template" id="example">
<template>
<div>Hello, {{ name }}!</div>
</template>
<script>
export default {
module.exports = {
data: function () {
return { name: 'Vue' }
}
@@ -84,4 +93,20 @@
</script>
```
<vuep template="#example"></vuep>
<script v-pre type="text/x-template" id="example">
<template>
<div>Hello, {{ name }}!</div>
</template>
<script>
module.exports = {
data: function () {
return { name: 'Vue' }
}
}
</script>
</script>
?> 具体效果参考 [Vuep 文档](https://qingwei-li.github.io/vuep/)。
+69
View File
@@ -0,0 +1,69 @@
# 自定义插件
docsify 提供了一套插件机制,其中提供的钩子(hook)支持处理异步逻辑,可以很方便的扩展功能。
## 完整功能
```js
window.$docsify = {
plugins: [
function (hook, vm) {
hook.init(function() {
// 初始化时调用,只调用一次,没有参数。
})
hook.beforeEach(function(content) {
// 每次开始解析 Markdown 内容时调用
// ...
return content
})
hook.afterEach(function(html, next) {
// 解析成 html 后调用。beforeEach 和 afterEach 支持处理异步逻辑
// ...
// 异步处理完成后调用 next(html) 返回结果
next(html)
})
hook.doneEach(function() {
// 每次路由切换时数据全部加载完成后调用,没有参数。
// ...
})
hook.mounted(function() {
// 初始化完成后调用 ,只调用一次,没有参数。
})
hook.ready(function() {
// 初始化并第一次加完成数据后调用,没有参数。
})
}
]
}
```
!> 如果需要用 docsify 的内部方法,可以通过 `window.Docsify` 获取,通过 `vm` 获取当前实例。
## 例子
给每个页面的末尾加上 `footer`
```js
window.$docsify = {
plugins: [
function (hook) {
var footer = [
'<hr/>',
'<footer>',
'<span><a href="https://github.com/QingWei-Li">cinwell</a> &copy;2017.</span>',
'<span>Proudly published with <a href="https://github.com/QingWei-Li/docsify" target="_blank">docsify</a>.</span>',
'</footer>'
].join('')
hook.afterEach(function (html) {
return html + footer
})
}
]
}
```
+186 -118
View File
@@ -74,8 +74,10 @@ var config = merge({
themeColor: '',
nameLink: window.location.pathname,
autoHeader: false,
executeScript: false,
ga: ''
executeScript: null,
noEmoji: false,
ga: '',
mergeNavbar: false
}, window.$docsify);
var script = document.currentScript ||
@@ -161,7 +163,10 @@ function getNode (el, noCache) {
if ( noCache === void 0 ) noCache = false;
if (typeof el === 'string') {
el = noCache ? find(el) : (cacheNode[el] || find(el));
if (typeof window.Vue !== 'undefined') {
return find(el)
}
el = noCache ? find(el) : (cacheNode[el] || (cacheNode[el] = find(el)));
}
return el
@@ -213,11 +218,11 @@ function on (el, type, handler) {
: el.addEventListener(type, handler);
}
var off = function on (el, type, handler) {
function off (el, type, handler) {
isFn(type)
? window.removeEventListener(el, type)
: el.removeEventListener(type, handler);
};
}
/**
* Toggle class
@@ -300,12 +305,16 @@ var isAbsolutePath = cached(function (path) {
return /(:|(\/{2}))/.test(path)
});
var getRoot = cached(function (path) {
return /\/$/g.test(path) ? path : path.match(/(\S*\/)[^\/]+$/)[1]
var getParentPath = cached(function (path) {
return /\/$/g.test(path)
? path
: (path = path.match(/(\S*\/)[^\/]+$/))
? path[1]
: ''
});
var cleanPath = cached(function (path) {
return path.replace(/\/+/g, '/')
return path.replace(/([^:])\/{2,}/g, '$1/')
});
function replaceHash (path) {
@@ -372,12 +381,17 @@ function parse (path) {
* to URL
* @param {string} path
* @param {object} qs query params
* @param {string} currentRoute optional current route
*/
function toURL (path, params) {
function toURL (path, params, currentRoute) {
var local = currentRoute && path[0] === '#';
var route = parse(replaceSlug(path));
route.query = merge({}, route.query, params);
path = route.path + stringifyQuery(route.query);
path = path.replace(/\.md(\?)|\.md$/, '$1');
if (local) { path = currentRoute + path; }
return cleanPath('#/' + path)
}
@@ -393,7 +407,7 @@ var route = Object.freeze({
getBasePath: getBasePath,
getPath: getPath,
isAbsolutePath: isAbsolutePath,
getRoot: getRoot,
getParentPath: getParentPath,
cleanPath: cleanPath
});
@@ -402,19 +416,20 @@ var title = $.title;
* Toggle button
*/
function btn (el) {
var toggle = function () { return body.classList.toggle('close'); };
var toggle = function (_) { return body.classList.toggle('close'); };
el = getNode(el);
on(el, 'click', toggle);
on(el, 'click', function (e) {
e.stopPropagation();
toggle();
});
if (isMobile) {
var sidebar = getNode('.sidebar');
var sidebar = getNode('.sidebar');
on(sidebar, 'click', function () {
toggle();
setTimeout(function () { return getAndActive(sidebar, true, true); }, 0);
});
}
isMobile && on(body, 'click', function (_) { return body.classList.contains('close') && toggle(); }
);
on(sidebar, 'click', function (_) { return setTimeout((function (_) { return getAndActive(sidebar, true, true); }, 0)); }
);
}
function sticky () {
@@ -464,17 +479,62 @@ function getAndActive (el, isParent, autoTitle) {
return target
}
var nav = {};
var hoverOver = false;
function highlight () {
var sidebar = getNode('.sidebar');
var anchors = findAll('.anchor');
var wrap = find(sidebar, '.sidebar-nav');
var active = find(sidebar, 'li.active');
var top = body.scrollTop;
var last;
for (var i = 0, len = anchors.length; i < len; i += 1) {
var node = anchors[i];
if (node.offsetTop > top) {
if (!last) { last = node; }
break
} else {
last = node;
}
}
if (!last) { return }
var li = nav[last.getAttribute('data-id')];
if (!li || li === active) { return }
active && active.classList.remove('active');
li.classList.add('active');
active = li;
// scroll into view
// https://github.com/vuejs/vuejs.org/blob/master/themes/vue/source/js/common.js#L282-L297
if (!hoverOver && body.classList.contains('sticky')) {
var height = sidebar.clientHeight;
var curOffset = 0;
var cur = active.offsetTop + active.clientHeight + 40;
var isInView = (
active.offsetTop >= wrap.scrollTop &&
cur <= wrap.scrollTop + height
);
var notThan = cur - curOffset < height;
var top$1 = isInView
? wrap.scrollTop
: notThan
? curOffset
: cur - height;
sidebar.scrollTop = top$1;
}
}
function scrollActiveSidebar () {
if (isMobile) { return }
var hoverOver = false;
var anchors = findAll('.anchor');
var sidebar = find('.sidebar');
var wrap = find(sidebar, '.sidebar-nav');
var nav = {};
var sidebar = getNode('.sidebar');
var lis = findAll(sidebar, 'li');
var active = find(sidebar, 'li.active');
for (var i = 0, len = lis.length; i < len; i += 1) {
var li = lis[i];
@@ -489,50 +549,6 @@ function scrollActiveSidebar () {
nav[decodeURIComponent(href)] = li;
}
function highlight () {
var top = body.scrollTop;
var last;
for (var i = 0, len = anchors.length; i < len; i += 1) {
var node = anchors[i];
if (node.offsetTop > top) {
if (!last) { last = node; }
break
} else {
last = node;
}
}
if (!last) { return }
var li = nav[last.getAttribute('data-id')];
if (!li || li === active) { return }
active && active.classList.remove('active');
li.classList.add('active');
active = li;
// scroll into view
// https://github.com/vuejs/vuejs.org/blob/master/themes/vue/source/js/common.js#L282-L297
if (!hoverOver && body.classList.contains('sticky')) {
var height = sidebar.clientHeight;
var curOffset = 0;
var cur = active.offsetTop + active.clientHeight + 40;
var isInView = (
active.offsetTop >= wrap.scrollTop &&
cur <= wrap.scrollTop + height
);
var notThan = cur - curOffset < height;
var top$1 = isInView
? wrap.scrollTop
: notThan
? curOffset
: cur - height;
sidebar.scrollTop = top$1;
}
}
off('scroll', highlight);
on('scroll', highlight);
on(sidebar, 'mouseover', function () { hoverOver = true; });
@@ -597,7 +613,6 @@ var progressbar = function (ref) {
};
var cache = {};
var RUN_VERSION = Date.now();
/**
* Simple ajax get
@@ -613,8 +628,6 @@ function get (url, hasBar) {
xhr.addEventListener.apply(xhr, arguments);
};
url += (/\?(\w+)=/g.test(url) ? '&' : '?') + "v=" + RUN_VERSION;
if (cache[url]) {
return { then: function (cb) { return cb(cache[url]); }, abort: noop }
}
@@ -700,7 +713,7 @@ function corner (data) {
'<path d="M128.3,109.0 C113.8,99.7 119.0,89.6 119.0,89.6 C122.0,82.7 120.5,78.6 120.5,78.6 C119.2,72.0 123.4,76.3 123.4,76.3 C127.3,80.9 125.5,87.3 125.5,87.3 C122.9,97.6 130.6,101.9 134.4,103.2" fill="currentColor" style="transform-origin: 130px 106px;" class="octo-arm"></path>' +
'<path d="M115.0,115.0 C114.9,115.1 118.7,116.5 119.8,115.4 L133.7,101.6 C136.9,99.2 139.9,98.4 142.2,98.6 C133.8,88.0 127.5,74.4 143.8,58.0 C148.5,53.4 154.0,51.2 159.7,51.0 C160.3,49.4 163.2,43.6 171.4,40.1 C171.4,40.1 176.1,42.5 178.8,56.2 C183.1,58.6 187.2,61.8 190.9,65.4 C194.5,69.0 197.7,73.2 200.1,77.6 C213.8,80.2 216.3,84.9 216.3,84.9 C212.7,93.1 206.9,96.0 205.4,96.6 C205.1,102.4 203.0,107.8 198.3,112.5 C181.9,128.9 168.3,122.5 157.7,114.1 C157.9,116.9 156.7,120.9 152.7,124.9 L141.0,136.5 C139.8,137.7 141.6,141.9 141.8,141.8 Z" fill="currentColor" class="octo-body"></path>' +
'</svg>' +
'</a>`')
'</a>')
}
/**
@@ -715,7 +728,7 @@ function main (config) {
'</button>' +
'<aside class="sidebar">' +
(config.name
? ("<h1><a href=\"" + (config.nameLink) + "\">" + (config.name) + "</a></h1>")
? ("<h1><a class=\"app-name-link\" data-nosearch>" + (config.name) + "</a></h1>")
: '') +
'<div class="sidebar-nav"></div>' +
'</aside>');
@@ -2892,8 +2905,7 @@ function genTree (toc, maxLevel) {
if (level > maxLevel) { return }
if (last[len]) {
last[len].children = last[len].children || [];
last[len].children.push(headline);
last[len].children = (last[len].children || []).concat(headline);
} else {
headlines.push(headline);
}
@@ -2927,14 +2939,18 @@ function slugify (str) {
return slug
}
function clearSlugCache () {
slugify.clear = function () {
cache$1 = {};
};
function replace (m, $1) {
return '<img class="emoji" src="https://assets-cdn.github.com/images/icons/emoji/' + $1 + '.png" alt="' + $1 + '" />'
}
function emojify (text) {
return text
.replace(/<(pre|template)[^>]*?>([\s\S]+)<\/(pre|template)>/g, function (m) { return m.replace(/:/g, '__colon__'); })
.replace(/:(\w+?):/ig, '<img class="emoji" src="https://assets-cdn.github.com/images/icons/emoji/$1.png" alt="$1" />')
return $docsify.noEmoji ? text : text
.replace(/<(pre|template|code)[^>]*?>[\s\S]+?<\/(pre|template|code)>/g, function (m) { return m.replace(/:/g, '__colon__'); })
.replace(/:(\w+?):/ig, window.emojify || replace)
.replace(/__colon__/g, ':')
}
@@ -2942,7 +2958,7 @@ var markdownCompiler = marked;
var contentBase = '';
var currentPath = '';
var renderer = new marked.Renderer();
var TOC = {};
var cacheTree = {};
var toc = [];
/**
@@ -2955,7 +2971,7 @@ var markdown = cached(function (text) {
html = markdownCompiler(text);
html = emojify(html);
clearSlugCache();
slugify.clear();
return html
});
@@ -2967,7 +2983,6 @@ markdown.init = function (config, base) {
if ( base === void 0 ) base = window.location.pathname;
contentBase = getBasePath(base);
currentPath = parse().path;
if (isFn(config)) {
markdownCompiler = config(marked, renderer);
@@ -2986,10 +3001,24 @@ markdown.update = function () {
* @link https://github.com/chjj/marked#overriding-renderer-methods
*/
renderer.heading = function (text, level) {
var nextToc = { level: level, title: text };
if (/{docsify-ignore}/g.test(text)) {
text = text.replace('{docsify-ignore}', '');
nextToc.title = text;
nextToc.ignoreSubHeading = true;
}
if (/{docsify-ignore-all}/g.test(text)) {
text = text.replace('{docsify-ignore-all}', '');
nextToc.title = text;
nextToc.ignoreAllSubs = true;
}
var slug = slugify(text);
var url = toURL(currentPath, { id: slug });
toc.push({ level: level, slug: url, title: text });
nextToc.slug = url;
toc.push(nextToc);
return ("<h" + level + " id=\"" + slug + "\"><a href=\"" + url + "\" data-id=\"" + slug + "\" class=\"anchor\"><span>" + text + "</span></a></h" + level + ">")
};
@@ -3004,11 +3033,14 @@ renderer.code = function (code, lang) {
renderer.link = function (href, title, text) {
var blank = '';
if (!/:|(\/{2})/.test(href)) {
href = toURL(href);
href = toURL(href, null, currentPath);
} else {
blank = ' target="_blank"';
}
return ("<a href=\"" + href + "\" title=\"" + (title || text) + "\"" + blank + ">" + text + "</a>")
if (title) {
title = " title=\"" + title + "\"";
}
return ("<a href=\"" + href + "\"" + (title || '') + blank + ">" + text + "</a>")
};
renderer.paragraph = function (text) {
if (/^!&gt;/.test(text)) {
@@ -3039,8 +3071,9 @@ function sidebar (text, level) {
html = markdown(text);
html = html.match(/<ul[^>]*>([\s\S]+)<\/ul>/g)[0];
} else {
var tree$$1 = genTree(toc, level);
var tree$$1 = cacheTree[currentPath] || genTree(toc, level);
html = tree(tree$$1, '<ul>');
cacheTree[currentPath] = tree$$1;
}
return html
@@ -3051,12 +3084,14 @@ function sidebar (text, level) {
*/
function subSidebar (el, level) {
if (el) {
toc[0] && toc[0].ignoreAllSubs && (toc = []);
toc[0] && toc[0].level === 1 && toc.shift();
var tree$$1 = genTree(TOC[currentPath] || toc, level);
toc.forEach(function (node, i) {
node.ignoreSubHeading && toc.splice(i, 1);
});
var tree$$1 = cacheTree[currentPath] || genTree(toc, level);
el.parentNode.innerHTML += tree(tree$$1, '<ul class="app-sub-sidebar">');
}
if (toc.length) {
TOC[currentPath] = toc.slice();
cacheTree[currentPath] = tree$$1;
}
toc = [];
}
@@ -3102,15 +3137,18 @@ function renderMain (html) {
this._renderTo('.markdown-section', html);
// Render sidebar with the TOC
!this.config.loadSidebar && this._renderSidebar();
// execute script
this.config.executeScript && executeScript();
if (!this.config.executeScript &&
// execute script
if (this.config.executeScript !== false &&
typeof window.Vue !== 'undefined' &&
!executeScript()) {
setTimeout(function (_) {
var vueVM = window.__EXECUTE_RESULT__;
vueVM && vueVM.$destroy && vueVM.$destroy();
window.__EXECUTE_RESULT__ = new window.Vue().$mount('#main');
}, 0);
} else {
this.config.executeScript && executeScript();
}
if (this.config.auto2top) {
@@ -3118,6 +3156,22 @@ function renderMain (html) {
}
}
function renderNameLink (vm) {
var el = getNode('.app-name-link');
var nameLink = vm.config.nameLink;
var path = vm.route.path;
if (!el) { return }
if (isPrimitive(vm.config.nameLink)) {
el.setAttribute('href', nameLink);
} else if (typeof nameLink === 'object') {
var match = Object.keys(nameLink).find(function (key) { return path.indexOf(key) > -1; });
el.setAttribute('href', nameLink[match]);
}
}
function renderMixin (proto) {
proto._renderTo = function (el, content, replace) {
var node = getNode(el);
@@ -3129,10 +3183,11 @@ function renderMixin (proto) {
var maxLevel = ref.maxLevel;
var subMaxLevel = ref.subMaxLevel;
var autoHeader = ref.autoHeader;
var loadSidebar = ref.loadSidebar;
this._renderTo('.sidebar-nav', sidebar(text, maxLevel));
var active = getAndActive('.sidebar-nav', true, true);
subSidebar(active, subMaxLevel);
subSidebar(loadSidebar ? active : '', subMaxLevel);
// bind event
this.activeLink = active;
scrollActiveSidebar();
@@ -3180,10 +3235,12 @@ function renderMixin (proto) {
var path = m[1];
toggleClass(el, 'add', 'has-mask');
if (isAbsolutePath(m[1])) {
if (!isAbsolutePath(m[1])) {
path = getPath(getBasePath(this.config.basePath), m[1]);
}
el.style.backgroundImage = "url(" + path + ")";
el.style.backgroundSize = 'cover';
el.style.backgroundPosition = 'center center';
}
html = html.replace(m[0], '');
}
@@ -3194,6 +3251,8 @@ function renderMixin (proto) {
proto._updateRender = function () {
markdown.update();
// render name link
renderNameLink(this);
};
}
@@ -3208,12 +3267,8 @@ function initRender (vm) {
var el = find(id);
var html = '';
var navAppendToTarget = body;
navEl.classList.add('app-nav');
if (!config.repo) {
navEl.classList.add('no-badge');
}
if (!el) {
el = create(id);
appendTo(body, el);
@@ -3228,8 +3283,19 @@ function initRender (vm) {
html += main(config);
// Render main app
vm._renderTo(el, html, true);
if (config.mergeNavbar && isMobile) {
navAppendToTarget = find('.sidebar');
} else {
navEl.classList.add('app-nav');
if (!config.repo) {
navEl.classList.add('no-badge');
}
}
// Add nav
before(body, navEl);
before(navAppendToTarget, navEl);
if (config.themeColor) {
$.head.innerHTML += theme(config.themeColor);
@@ -3258,7 +3324,7 @@ function routeMixin (proto) {
var config = ref.config;
var base = getBasePath(config.basePath);
path = getAlias(path, config.alias);
path = config.alias ? getAlias(path, config.alias) : path;
path = getFileName(path);
path = path === '/README.md' ? (config.homepage || path) : path;
path = isAbsolutePath(path) ? path : getPath(base, path);
@@ -3272,6 +3338,7 @@ var lastRoute = {};
function initRoute (vm) {
normalize();
lastRoute = vm.route = parse();
vm._updateRender();
on('hashchange', function (_) {
normalize();
@@ -3306,6 +3373,16 @@ function initEvent (vm) {
}
}
function loadNested (path, file, next, vm, first) {
path = first ? path : path.replace(/\/$/, '');
path = getParentPath(path);
if (!path) { return }
get(vm.$getFile(path + file))
.then(next, function (_) { return loadNested(path, file, next, vm); });
}
function fetchMixin (proto) {
var last;
proto._fetch = function (cb) {
@@ -3317,7 +3394,6 @@ function fetchMixin (proto) {
var ref$1 = this.config;
var loadNavbar = ref$1.loadNavbar;
var loadSidebar = ref$1.loadSidebar;
var root = getRoot(path);
// Abort last request
last && last.abort && last.abort();
@@ -3335,20 +3411,13 @@ function fetchMixin (proto) {
var fn = function (result) { this$1._renderSidebar(result); cb(); };
// Load sidebar
get(this$1.$getFile(root + loadSidebar))
// fallback root navbar when fail
.then(fn, function (_) { return get(loadSidebar).then(fn); });
loadNested(path, loadSidebar, fn, this$1, true);
},
function (_) { return this$1._renderMain(null); });
// Load nav
loadNavbar &&
get(this.$getFile(root + loadNavbar))
.then(
function (text) { return this$1._renderNav(text); },
// fallback root navbar when fail
function (_) { return get(loadNavbar).then(function (text) { return this$1._renderNav(text); }); }
);
loadNested(path, loadNavbar, function (text) { return this$1._renderNav(text); }, this, true);
};
proto._fetchCover = function () {
@@ -3356,7 +3425,7 @@ function fetchMixin (proto) {
var ref = this.config;
var coverpage = ref.coverpage;
var root = getRoot(this.route.path);
var root = getParentPath(this.route.path);
var path = this.$getFile(root + coverpage);
if (this.route.path !== '/' || !coverpage) {
@@ -3421,7 +3490,7 @@ var util = Object.freeze({
});
var initGlobalAPI = function () {
window.Docsify = { util: util, dom: dom, render: render, route: route, get: get };
window.Docsify = { util: util, dom: dom, render: render, route: route, get: get, slugify: slugify };
window.marked = marked;
window.Prism = prism;
};
@@ -3446,7 +3515,6 @@ initGlobalAPI();
/**
* Run Docsify
*/
setTimeout(function (_) { return new Docsify(); }, 0);
}());
+2 -2
View File
File diff suppressed because one or more lines are too long
+159
View File
@@ -0,0 +1,159 @@
this.D = this.D || {};
(function () {
'use strict';
var AllGithubEmoji = ['+1', '100', '1234', '8ball', 'a', 'ab', 'abc', 'abcd',
'accept', 'aerial_tramway', 'airplane', 'alarm_clock', 'alien', 'ambulance',
'anchor', 'angel', 'anger', 'angry', 'anguished', 'ant', 'apple', 'aquarius',
'aries', 'arrow_backward', 'arrow_double_down', 'arrow_double_up', 'arrow_down',
'arrow_down_small', 'arrow_forward', 'arrow_heading_down', 'arrow_heading_up',
'arrow_left', 'arrow_lower_left', 'arrow_lower_right', 'arrow_right',
'arrow_right_hook', 'arrow_up', 'arrow_up_down', 'arrow_up_small', 'arrow_upper_left',
'arrow_upper_right', 'arrows_clockwise', 'arrows_counterclockwise', 'art',
'articulated_lorry', 'astonished', 'athletic_shoe', 'atm', 'b', 'baby', 'baby_bottle',
'baby_chick', 'baby_symbol', 'back', 'baggage_claim', 'balloon', 'ballot_box_with_check',
'bamboo', 'banana', 'bangbang', 'bank', 'bar_chart', 'barber', 'baseball', 'basketball',
'bath', 'bathtub', 'battery', 'bear', 'bee', 'beer', 'beers', 'beetle', 'beginner',
'bell', 'bento', 'bicyclist', 'bike', 'bikini', 'bird', 'birthday', 'black_circle',
'black_joker', 'black_large_square', 'black_medium_small_square', 'black_medium_square',
'black_nib', 'black_small_square', 'black_square_button', 'blossom', 'blowfish',
'blue_book', 'blue_car', 'blue_heart', 'blush', 'boar', 'boat', 'bomb', 'book',
'bookmark', 'bookmark_tabs', 'books', 'boom', 'boot', 'bouquet', 'bow', 'bowling',
'bowtie', 'boy', 'bread', 'bride_with_veil', 'bridge_at_night', 'briefcase',
'broken_heart', 'bug', 'bulb', 'bullettrain_front', 'bullettrain_side', 'bus',
'busstop', 'bust_in_silhouette', 'busts_in_silhouette', 'cactus', 'cake', 'calendar',
'calling', 'camel', 'camera', 'cancer', 'candy', 'capital_abcd', 'capricorn', 'car',
'card_index', 'carousel_horse', 'cat', 'cat2', 'cd', 'chart', 'chart_with_downwards_trend',
'chart_with_upwards_trend', 'checkered_flag', 'cherries', 'cherry_blossom', 'chestnut',
'chicken', 'children_crossing', 'chocolate_bar', 'christmas_tree', 'church', 'cinema',
'circus_tent', 'city_sunrise', 'city_sunset', 'cl', 'clap', 'clapper', 'clipboard',
'clock1', 'clock10', 'clock1030', 'clock11', 'clock1130', 'clock12', 'clock1230',
'clock130', 'clock2', 'clock230', 'clock3', 'clock330', 'clock4', 'clock430',
'clock5', 'clock530', 'clock6', 'clock630', 'clock7', 'clock730', 'clock8', 'clock830',
'clock9', 'clock930', 'closed_book', 'closed_lock_with_key', 'closed_umbrella',
'cloud', 'clubs', 'cn', 'cocktail', 'coffee', 'cold_sweat', 'collision', 'computer',
'confetti_ball', 'confounded', 'confused', 'congratulations', 'construction',
'construction_worker', 'convenience_store', 'cookie', 'cool', 'cop', 'copyright',
'corn', 'couple', 'couple_with_heart', 'couplekiss', 'cow', 'cow2', 'credit_card',
'crescent_moon', 'crocodile', 'crossed_flags', 'crown', 'cry', 'crying_cat_face',
'crystal_ball', 'cupid', 'curly_loop', 'currency_exchange', 'curry', 'custard',
'customs', 'cyclone', 'dancer', 'dancers', 'dango', 'dart', 'dash', 'date', 'de',
'deciduous_tree', 'department_store', 'diamond_shape_with_a_dot_inside', 'diamonds',
'disappointed', 'disappointed_relieved', 'dizzy', 'dizzy_face', 'do_not_litter',
'dog', 'dog2', 'dollar', 'dolls', 'dolphin', 'door', 'doughnut', 'dragon',
'dragon_face', 'dress', 'dromedary_camel', 'droplet', 'dvd', 'e-mail', 'ear',
'ear_of_rice', 'earth_africa', 'earth_americas', 'earth_asia', 'egg', 'eggplant',
'eight', 'eight_pointed_black_star', 'eight_spoked_asterisk', 'electric_plug',
'elephant', 'email', 'end', 'envelope', 'envelope_with_arrow', 'es', 'euro',
'european_castle', 'european_post_office', 'evergreen_tree', 'exclamation',
'expressionless', 'eyeglasses', 'eyes', 'facepunch', 'factory', 'fallen_leaf',
'family', 'fast_forward', 'fax', 'fearful', 'feelsgood', 'feet', 'ferris_wheel',
'file_folder', 'finnadie', 'fire', 'fire_engine', 'fireworks', 'first_quarter_moon',
'first_quarter_moon_with_face', 'fish', 'fish_cake', 'fishing_pole_and_fish',
'fist', 'five', 'flags', 'flashlight', 'flipper', 'floppy_disk', 'flower_playing_cards',
'flushed', 'foggy', 'football', 'footprints', 'fork_and_knife', 'fountain',
'four', 'four_leaf_clover', 'fr', 'free', 'fried_shrimp', 'fries', 'frog',
'frowning', 'fu', 'fuelpump', 'full_moon', 'full_moon_with_face', 'game_die',
'gb', 'gem', 'gemini', 'ghost', 'gift', 'gift_heart', 'girl', 'globe_with_meridians',
'goat', 'goberserk', 'godmode', 'golf', 'grapes', 'green_apple', 'green_book',
'green_heart', 'grey_exclamation', 'grey_question', 'grimacing', 'grin',
'grinning', 'guardsman', 'guitar', 'gun', 'haircut', 'hamburger', 'hammer',
'hamster', 'hand', 'handbag', 'hankey', 'hash', 'hatched_chick', 'hatching_chick',
'headphones', 'hear_no_evil', 'heart', 'heart_decoration', 'heart_eyes',
'heart_eyes_cat', 'heartbeat', 'heartpulse', 'hearts', 'heavy_check_mark',
'heavy_division_sign', 'heavy_dollar_sign', 'heavy_exclamation_mark', 'heavy_minus_sign',
'heavy_multiplication_x', 'heavy_plus_sign', 'helicopter', 'herb', 'hibiscus',
'high_brightness', 'high_heel', 'hocho', 'honey_pot', 'honeybee', 'horse',
'horse_racing', 'hospital', 'hotel', 'hotsprings', 'hourglass', 'hourglass_flowing_sand',
'house', 'house_with_garden', 'hurtrealbad', 'hushed', 'ice_cream', 'icecream',
'id', 'ideograph_advantage', 'imp', 'inbox_tray', 'incoming_envelope',
'information_desk_person', 'information_source', 'innocent', 'interrobang',
'iphone', 'it', 'izakaya_lantern', 'jack_o_lantern', 'japan', 'japanese_castle',
'japanese_goblin', 'japanese_ogre', 'jeans', 'joy', 'joy_cat', 'jp', 'key',
'keycap_ten', 'kimono', 'kiss', 'kissing', 'kissing_cat', 'kissing_closed_eyes',
'kissing_heart', 'kissing_smiling_eyes', 'koala', 'koko', 'kr', 'lantern',
'large_blue_circle', 'large_blue_diamond', 'large_orange_diamond', 'last_quarter_moon',
'last_quarter_moon_with_face', 'laughing', 'leaves', 'ledger', 'left_luggage',
'left_right_arrow', 'leftwards_arrow_with_hook', 'lemon', 'leo', 'leopard',
'libra', 'light_rail', 'link', 'lips', 'lipstick', 'lock', 'lock_with_ink_pen',
'lollipop', 'loop', 'loud_sound', 'loudspeaker', 'love_hotel', 'love_letter',
'low_brightness', 'm', 'mag', 'mag_right', 'mahjong', 'mailbox', 'mailbox_closed',
'mailbox_with_mail', 'mailbox_with_no_mail', 'man', 'man_with_gua_pi_mao',
'man_with_turban', 'mans_shoe', 'maple_leaf', 'mask', 'massage', 'meat_on_bone',
'mega', 'melon', 'memo', 'mens', 'metal', 'metro', 'microphone', 'microscope',
'milky_way', 'minibus', 'minidisc', 'mobile_phone_off', 'money_with_wings',
'moneybag', 'monkey', 'monkey_face', 'monorail', 'moon', 'mortar_board', 'mount_fuji',
'mountain_bicyclist', 'mountain_cableway', 'mountain_railway', 'mouse', 'mouse2',
'movie_camera', 'moyai', 'muscle', 'mushroom', 'musical_keyboard', 'musical_note',
'musical_score', 'mute', 'nail_care', 'name_badge', 'neckbeard', 'necktie',
'negative_squared_cross_mark', 'neutral_face', 'new', 'new_moon', 'new_moon_with_face',
'newspaper', 'ng', 'night_with_stars', 'nine', 'no_bell', 'no_bicycles', 'no_entry',
'no_entry_sign', 'no_good', 'no_mobile_phones', 'no_mouth', 'no_pedestrians',
'no_smoking', 'non-potable_water', 'nose', 'notebook', 'notebook_with_decorative_cover',
'notes', 'nut_and_bolt', 'o', 'o2', 'ocean', 'octocat', 'octopus', 'oden', 'office',
'ok', 'ok_hand', 'ok_woman', 'older_man', 'older_woman', 'on', 'oncoming_automobile',
'oncoming_bus', 'oncoming_police_car', 'oncoming_taxi', 'one', 'open_book',
'open_file_folder', 'open_hands', 'open_mouth', 'ophiuchus', 'orange_book',
'outbox_tray', 'ox', 'package', 'page_facing_up', 'page_with_curl', 'pager',
'palm_tree', 'panda_face', 'paperclip', 'parking', 'part_alternation_mark',
'partly_sunny', 'passport_control', 'paw_prints', 'peach', 'pear', 'pencil',
'pencil2', 'penguin', 'pensive', 'performing_arts', 'persevere', 'person_frowning',
'person_with_blond_hair', 'person_with_pouting_face', 'phone', 'pig', 'pig2',
'pig_nose', 'pill', 'pineapple', 'pisces', 'pizza', 'point_down', 'point_left',
'point_right', 'point_up', 'point_up_2', 'police_car', 'poodle', 'poop',
'post_office', 'postal_horn', 'postbox', 'potable_water', 'pouch', 'poultry_leg',
'pound', 'pouting_cat', 'pray', 'princess', 'punch', 'purple_heart', 'purse',
'pushpin', 'put_litter_in_its_place', 'question', 'rabbit', 'rabbit2', 'racehorse',
'radio', 'radio_button', 'rage', 'rage1', 'rage2', 'rage3', 'rage4', 'railway_car',
'rainbow', 'raised_hand', 'raised_hands', 'raising_hand', 'ram', 'ramen', 'rat',
'recycle', 'red_car', 'red_circle', 'registered', 'relaxed', 'relieved', 'repeat',
'repeat_one', 'restroom', 'revolving_hearts', 'rewind', 'ribbon', 'rice',
'rice_ball', 'rice_cracker', 'rice_scene', 'ring', 'rocket', 'roller_coaster',
'rooster', 'rose', 'rotating_light', 'round_pushpin', 'rowboat', 'ru', 'rugby_football',
'runner', 'running', 'running_shirt_with_sash', 'sa', 'sagittarius', 'sailboat',
'sake', 'sandal', 'santa', 'satellite', 'satisfied', 'saxophone', 'school',
'school_satchel', 'scissors', 'scorpius', 'scream', 'scream_cat', 'scroll',
'seat', 'secret', 'see_no_evil', 'seedling', 'seven', 'shaved_ice', 'sheep',
'shell', 'ship', 'shipit', 'shirt', 'shit', 'shoe', 'shower', 'signal_strength',
'six', 'six_pointed_star', 'ski', 'skull', 'sleeping', 'sleepy', 'slot_machine',
'small_blue_diamond', 'small_orange_diamond', 'small_red_triangle',
'small_red_triangle_down', 'smile', 'smile_cat', 'smiley', 'smiley_cat',
'smiling_imp', 'smirk', 'smirk_cat', 'smoking', 'snail', 'snake', 'snowboarder',
'snowflake', 'snowman', 'sob', 'soccer', 'soon', 'sos', 'sound', 'space_invader',
'spades', 'spaghetti', 'sparkle', 'sparkler', 'sparkles', 'sparkling_heart',
'speak_no_evil', 'speaker', 'speech_balloon', 'speedboat', 'squirrel', 'star',
'star2', 'stars', 'station', 'statue_of_liberty', 'steam_locomotive', 'stew',
'straight_ruler', 'strawberry', 'stuck_out_tongue', 'stuck_out_tongue_closed_eyes',
'stuck_out_tongue_winking_eye', 'sun_with_face', 'sunflower', 'sunglasses',
'sunny', 'sunrise', 'sunrise_over_mountains', 'surfer', 'sushi', 'suspect',
'suspension_railway', 'sweat', 'sweat_drops', 'sweat_smile', 'sweet_potato',
'swimmer', 'symbols', 'syringe', 'tada', 'tanabata_tree', 'tangerine', 'taurus',
'taxi', 'tea', 'telephone', 'telephone_receiver', 'telescope', 'tennis', 'tent',
'thought_balloon', 'three', 'thumbsdown', 'thumbsup', 'ticket', 'tiger', 'tiger2',
'tired_face', 'tm', 'toilet', 'tokyo_tower', 'tomato', 'tongue', 'top', 'tophat',
'tractor', 'traffic_light', 'train', 'train2', 'tram', 'triangular_flag_on_post',
'triangular_ruler', 'trident', 'triumph', 'trolleybus', 'trollface', 'trophy',
'tropical_drink', 'tropical_fish', 'truck', 'trumpet', 'tshirt', 'tulip',
'turtle', 'tv', 'twisted_rightwards_arrows', 'two', 'two_hearts', 'two_men_holding_hands',
'two_women_holding_hands', 'u5272', 'u5408', 'u55b6', 'u6307', 'u6708', 'u6709',
'u6e80', 'u7121', 'u7533', 'u7981', 'u7a7a', 'uk', 'umbrella', 'unamused',
'underage', 'unlock', 'up', 'us', 'v', 'vertical_traffic_light', 'vhs',
'vibration_mode', 'video_camera', 'video_game', 'violin', 'virgo', 'volcano',
'vs', 'walking', 'waning_crescent_moon', 'waning_gibbous_moon', 'warning',
'watch', 'water_buffalo', 'watermelon', 'wave', 'wavy_dash', 'waxing_crescent_moon',
'waxing_gibbous_moon', 'wc', 'weary', 'wedding', 'whale', 'whale2', 'wheelchair',
'white_check_mark', 'white_circle', 'white_flower', 'white_large_square',
'white_medium_small_square', 'white_medium_square', 'white_small_square',
'white_square_button', 'wind_chime', 'wine_glass', 'wink', 'wolf', 'woman',
'womans_clothes', 'womans_hat', 'womens', 'worried', 'wrench', 'x', 'yellow_heart',
'yen', 'yum', 'zap', 'zero', 'zzz'];
// emoji from All-Github-Emoji-Icons
// https://github.com/scotch-io/All-Github-Emoji-Icons
window.emojify = function (match, $1) {
return AllGithubEmoji.indexOf($1) === -1
? match
: '<img class="emoji" src="https://assets-cdn.github.com/images/icons/emoji/' + $1 + '.png" alt="' + $1 + '" />'
};
}());
+1
View File
File diff suppressed because one or more lines are too long
+31
View File
@@ -0,0 +1,31 @@
this.D = this.D || {};
(function () {
'use strict';
function handleExternalScript () {
var container = Docsify.dom.getNode('#main');
var scripts = Docsify.dom.findAll(container, 'script');
for (var i = scripts.length; i--;) {
var script = scripts[i];
if (script && script.src) {
var newScript = document.createElement('script');
Array.prototype.slice.call(script.attributes).forEach(function (attribute) {
newScript[attribute.name] = attribute.value;
});
script.parentNode.insertBefore(newScript, script);
script.parentNode.removeChild(script);
}
}
}
var install = function (hook) {
hook.doneEach(handleExternalScript);
};
window.$docsify.plugins = [].concat(install, window.$docsify.plugins);
}());
+1
View File
@@ -0,0 +1 @@
this.D=this.D||{},function(){"use strict";function e(){for(var e=Docsify.dom.getNode("#main"),i=Docsify.dom.findAll(e,"script"),o=i.length;o--;){var t=i[o];if(t&&t.src){var n=document.createElement("script");Array.prototype.slice.call(t.attributes).forEach(function(e){n[e.name]=e.value}),t.parentNode.insertBefore(n,t),t.parentNode.removeChild(t)}}}var i=function(i){i.doneEach(e)};window.$docsify.plugins=[].concat(i,window.$docsify.plugins)}();
+503
View File
@@ -0,0 +1,503 @@
this.D = this.D || {};
(function () {
'use strict';
/**
* Fork https://github.com/egoist/docute/blob/master/src/utils/yaml.js
*/
/* eslint-disable */
/*
YAML parser for Javascript
Author: Diogo Costa
This program is released under the MIT License as follows:
Copyright (c) 2011 Diogo Costa (costa.h4evr@gmail.com)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
/**
* @name YAML
* @namespace
*/
var errors = [];
var reference_blocks = [];
var processing_time = 0;
var regex$1 =
{
"regLevel" : new RegExp("^([\\s\\-]+)"),
"invalidLine" : new RegExp("^\\-\\-\\-|^\\.\\.\\.|^\\s*#.*|^\\s*$"),
"dashesString" : new RegExp("^\\s*\\\"([^\\\"]*)\\\"\\s*$"),
"quotesString" : new RegExp("^\\s*\\\'([^\\\']*)\\\'\\s*$"),
"float" : new RegExp("^[+-]?[0-9]+\\.[0-9]+(e[+-]?[0-9]+(\\.[0-9]+)?)?$"),
"integer" : new RegExp("^[+-]?[0-9]+$"),
"array" : new RegExp("\\[\\s*(.*)\\s*\\]"),
"map" : new RegExp("\\{\\s*(.*)\\s*\\}"),
"key_value" : new RegExp("([a-z0-9_-][ a-z0-9_-]*):( .+)", "i"),
"single_key_value" : new RegExp("^([a-z0-9_-][ a-z0-9_-]*):( .+?)$", "i"),
"key" : new RegExp("([a-z0-9_-][ a-z0-9_-]+):( .+)?", "i"),
"item" : new RegExp("^-\\s+"),
"trim" : new RegExp("^\\s+|\\s+$"),
"comment" : new RegExp("([^\\\'\\\"#]+([\\\'\\\"][^\\\'\\\"]*[\\\'\\\"])*)*(#.*)?")
};
/**
* @class A block of lines of a given level.
* @param {int} lvl The block's level.
* @private
*/
function Block(lvl) {
return {
/* The block's parent */
parent: null,
/* Number of children */
length: 0,
/* Block's level */
level: lvl,
/* Lines of code to process */
lines: [],
/* Blocks with greater level */
children : [],
/* Add a block to the children collection */
addChild : function(obj) {
this.children.push(obj);
obj.parent = this;
++this.length;
}
};
}
function parser$1(str) {
var regLevel = regex$1["regLevel"];
var invalidLine = regex$1["invalidLine"];
var lines = str.split("\n");
var m;
var level = 0, curLevel = 0;
var blocks = [];
var result = new Block(-1);
var currentBlock = new Block(0);
result.addChild(currentBlock);
var levels = [];
var line = "";
blocks.push(currentBlock);
levels.push(level);
for(var i = 0, len = lines.length; i < len; ++i) {
line = lines[i];
if(line.match(invalidLine)) {
continue;
}
if(m = regLevel.exec(line)) {
level = m[1].length;
} else
{ level = 0; }
if(level > curLevel) {
var oldBlock = currentBlock;
currentBlock = new Block(level);
oldBlock.addChild(currentBlock);
blocks.push(currentBlock);
levels.push(level);
} else if(level < curLevel) {
var added = false;
var k = levels.length - 1;
for(; k >= 0; --k) {
if(levels[k] == level) {
currentBlock = new Block(level);
blocks.push(currentBlock);
levels.push(level);
if(blocks[k].parent!= null)
{ blocks[k].parent.addChild(currentBlock); }
added = true;
break;
}
}
if(!added) {
errors.push("Error: Invalid indentation at line " + i + ": " + line);
return;
}
}
currentBlock.lines.push(line.replace(regex$1["trim"], ""));
curLevel = level;
}
return result;
}
function processValue(val) {
val = val.replace(regex$1["trim"], "");
var m = null;
if(val == 'true') {
return true;
} else if(val == 'false') {
return false;
} else if(val == '.NaN') {
return Number.NaN;
} else if(val == 'null') {
return null;
} else if(val == '.inf') {
return Number.POSITIVE_INFINITY;
} else if(val == '-.inf') {
return Number.NEGATIVE_INFINITY;
} else if(m = val.match(regex$1["dashesString"])) {
return m[1];
} else if(m = val.match(regex$1["quotesString"])) {
return m[1];
} else if(m = val.match(regex$1["float"])) {
return parseFloat(m[0]);
} else if(m = val.match(regex$1["integer"])) {
return parseInt(m[0]);
} else if( !isNaN(m = Date.parse(val))) {
return new Date(m);
} else if(m = val.match(regex$1["single_key_value"])) {
var res = {};
res[m[1]] = processValue(m[2]);
return res;
} else if(m = val.match(regex$1["array"])){
var count = 0, c = ' ';
var res = [];
var content = "";
var str = false;
for(var j = 0, lenJ = m[1].length; j < lenJ; ++j) {
c = m[1][j];
if(c == '\'' || c == '"') {
if(str === false) {
str = c;
content += c;
continue;
} else if((c == '\'' && str == '\'') || (c == '"' && str == '"')) {
str = false;
content += c;
continue;
}
} else if(str === false && (c == '[' || c == '{')) {
++count;
} else if(str === false && (c == ']' || c == '}')) {
--count;
} else if(str === false && count == 0 && c == ',') {
res.push(processValue(content));
content = "";
continue;
}
content += c;
}
if(content.length > 0)
{ res.push(processValue(content)); }
return res;
} else if(m = val.match(regex$1["map"])){
var count = 0, c = ' ';
var res = [];
var content = "";
var str = false;
for(var j = 0, lenJ = m[1].length; j < lenJ; ++j) {
c = m[1][j];
if(c == '\'' || c == '"') {
if(str === false) {
str = c;
content += c;
continue;
} else if((c == '\'' && str == '\'') || (c == '"' && str == '"')) {
str = false;
content += c;
continue;
}
} else if(str === false && (c == '[' || c == '{')) {
++count;
} else if(str === false && (c == ']' || c == '}')) {
--count;
} else if(str === false && count == 0 && c == ',') {
res.push(content);
content = "";
continue;
}
content += c;
}
if(content.length > 0)
{ res.push(content); }
var newRes = {};
for(var j = 0, lenJ = res.length; j < lenJ; ++j) {
if(m = res[j].match(regex$1["key_value"])) {
newRes[m[1]] = processValue(m[2]);
}
}
return newRes;
} else
{ return val; }
}
function processFoldedBlock(block) {
var lines = block.lines;
var children = block.children;
var str = lines.join(" ");
var chunks = [str];
for(var i = 0, len = children.length; i < len; ++i) {
chunks.push(processFoldedBlock(children[i]));
}
return chunks.join("\n");
}
function processLiteralBlock(block) {
var lines = block.lines;
var children = block.children;
var str = lines.join("\n");
for(var i = 0, len = children.length; i < len; ++i) {
str += processLiteralBlock(children[i]);
}
return str;
}
function processBlock(blocks) {
var m = null;
var res = {};
var lines = null;
var children = null;
var currentObj = null;
var level = -1;
var processedBlocks = [];
var isMap = true;
for(var j = 0, lenJ = blocks.length; j < lenJ; ++j) {
if(level != -1 && level != blocks[j].level)
{ continue; }
processedBlocks.push(j);
level = blocks[j].level;
lines = blocks[j].lines;
children = blocks[j].children;
currentObj = null;
for(var i = 0, len = lines.length; i < len; ++i) {
var line = lines[i];
if(m = line.match(regex$1["key"])) {
var key = m[1];
if(key[0] == '-') {
key = key.replace(regex$1["item"], "");
if (isMap) {
isMap = false;
if (typeof(res.length) === "undefined") {
res = [];
}
}
if(currentObj != null) { res.push(currentObj); }
currentObj = {};
isMap = true;
}
if(typeof m[2] != "undefined") {
var value = m[2].replace(regex$1["trim"], "");
if(value[0] == '&') {
var nb = processBlock(children);
if(currentObj != null) { currentObj[key] = nb; }
else { res[key] = nb; }
reference_blocks[value.substr(1)] = nb;
} else if(value[0] == '|') {
if(currentObj != null) { currentObj[key] = processLiteralBlock(children.shift()); }
else { res[key] = processLiteralBlock(children.shift()); }
} else if(value[0] == '*') {
var v = value.substr(1);
var no = {};
if(typeof reference_blocks[v] == "undefined") {
errors.push("Reference '" + v + "' not found!");
} else {
for(var k in reference_blocks[v]) {
no[k] = reference_blocks[v][k];
}
if(currentObj != null) { currentObj[key] = no; }
else { res[key] = no; }
}
} else if(value[0] == '>') {
if(currentObj != null) { currentObj[key] = processFoldedBlock(children.shift()); }
else { res[key] = processFoldedBlock(children.shift()); }
} else {
if(currentObj != null) { currentObj[key] = processValue(value); }
else { res[key] = processValue(value); }
}
} else {
if(currentObj != null) { currentObj[key] = processBlock(children); }
else { res[key] = processBlock(children); }
}
} else if(line.match(/^-\s*$/)) {
if (isMap) {
isMap = false;
if (typeof(res.length) === "undefined") {
res = [];
}
}
if(currentObj != null) { res.push(currentObj); }
currentObj = {};
isMap = true;
continue;
} else if(m = line.match(/^-\s*(.*)/)) {
if(currentObj != null)
{ currentObj.push(processValue(m[1])); }
else {
if (isMap) {
isMap = false;
if (typeof(res.length) === "undefined") {
res = [];
}
}
res.push(processValue(m[1]));
}
continue;
}
}
if(currentObj != null) {
if (isMap) {
isMap = false;
if (typeof(res.length) === "undefined") {
res = [];
}
}
res.push(currentObj);
}
}
for(var j = processedBlocks.length - 1; j >= 0; --j) {
blocks.splice.call(blocks, processedBlocks[j], 1);
}
return res;
}
function semanticAnalysis(blocks) {
var res = processBlock(blocks.children);
return res;
}
function preProcess(src) {
var m;
var lines = src.split("\n");
var r = regex$1["comment"];
for(var i in lines) {
if(m = lines[i].match(r)) {
/* var cmt = "";
if(typeof m[3] != "undefined")
lines[i] = m[1];
else if(typeof m[3] != "undefined")
lines[i] = m[3];
else
lines[i] = "";
*/
if(typeof m[3] !== "undefined") {
lines[i] = m[0].substr(0, m[0].length - m[3].length);
}
}
}
return lines.join("\n");
}
function load(str) {
errors = [];
reference_blocks = [];
processing_time = (new Date()).getTime();
var pre = preProcess(str);
var doc = parser$1(pre);
var res = semanticAnalysis(doc);
processing_time = (new Date()).getTime() - processing_time;
return res;
}
/**
* Fork https://github.com/egoist/docute/blob/master/src/utils/front-matter.js
*/
/* eslint-disable */
var optionalByteOrderMark = '\\ufeff?';
var pattern = '^(' +
optionalByteOrderMark +
'(= yaml =|---)' +
'$([\\s\\S]*?)' +
'(?:\\2|\\.\\.\\.)' +
'$' +
'' +
'(?:\\n)?)';
// NOTE: If this pattern uses the 'g' flag the `regex` variable definition will
// need to be moved down into the functions that use it.
var regex = new RegExp(pattern, 'm');
function extractor (string) {
string = string || '';
var lines = string.split(/(\r?\n)/);
if (lines[0] && /= yaml =|---/.test(lines[0])) {
return parse(string)
} else {
return { attributes: {}, body: string }
}
}
function parse (string) {
var match = regex.exec(string);
if (!match) {
return {
attributes: {},
body: string
}
}
var yaml = match[match.length - 1].replace(/^\s+|\s+$/g, '');
var attributes = load(yaml) || {};
var body = string.replace(match[0], '');
return { attributes: attributes, body: body, frontmatter: yaml }
}
var install = function (hook, vm) {
hook.beforeEach(function (content) {
var ref = extractor(content);
var attributes = ref.attributes;
var body = ref.body;
Docsify.util.merge(vm.config, attributes.config);
return body
});
};
window.$docsify.plugins = [].concat(install, window.$docsify.plugins);
}());
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -23,7 +23,7 @@ function init (id) {
function collect () {
init(window.$docsify.ga);
window.ga('set', 'page', location.href);
window.ga('set', 'page', location.hash);
window.ga('send', 'pageview');
}
+1 -1
View File
@@ -1 +1 @@
this.D=this.D||{},function(){"use strict";function n(){var n=document.createElement("script");n.async=!0,n.src="https://www.google-analytics.com/analytics.js",document.body.appendChild(n)}function o(o){window.ga||(n(),window.ga=window.ga||function(){(window.ga.q=window.ga.q||[]).push(arguments)},window.ga.l=Number(new Date),window.ga("create",o,"auto"))}function i(){o(window.$docsify.ga),window.ga("set","page",location.href),window.ga("send","pageview")}var w=function(n){return window.$docsify.ga?void n.beforeEach(i):void console.error("[Docsify] ga is required.")};window.$docsify.plugins=[].concat(w,window.$docsify.plugins)}();
this.D=this.D||{},function(){"use strict";function n(){var n=document.createElement("script");n.async=!0,n.src="https://www.google-analytics.com/analytics.js",document.body.appendChild(n)}function o(o){window.ga||(n(),window.ga=window.ga||function(){(window.ga.q=window.ga.q||[]).push(arguments)},window.ga.l=Number(new Date),window.ga("create",o,"auto"))}function i(){o(window.$docsify.ga),window.ga("set","page",location.hash),window.ga("send","pageview")}var w=function(n){return window.$docsify.ga?void n.beforeEach(i):void console.error("[Docsify] ga is required.")};window.$docsify.plugins=[].concat(w,window.$docsify.plugins)}();
+33 -17
View File
@@ -21,7 +21,7 @@ function escapeHtml (string) {
function getAllPaths () {
var paths = [];
helper.dom.findAll('a')
helper.dom.findAll('a:not([data-nosearch])')
.map(function (node) {
var href = node.href;
var originHref = node.getAttribute('href');
@@ -46,13 +46,14 @@ function genIndex (path, content) {
if ( content === void 0 ) content = '';
var tokens = window.marked.lexer(content);
var slugify = window.Docsify.slugify;
var toURL = Docsify.route.toURL;
var index = {};
var slug;
tokens.forEach(function (token) {
if (token.type === 'heading' && token.depth <= 2) {
slug = toURL(path, { id: token.text });
slug = toURL(path, { id: slugify(token.text) });
index[slug] = { slug: slug, title: token.text, body: '' };
} else {
if (!slug) { return }
@@ -67,7 +68,7 @@ function genIndex (path, content) {
}
}
});
slugify.clear();
return index
}
@@ -78,7 +79,7 @@ function search (keywords) {
data = data.concat(Object.keys(INDEXS[key]).map(function (page) { return INDEXS[key][page]; }));
});
keywords = keywords.trim().split(/[\s\-\\\/]+/);
keywords = [].concat(keywords, keywords.trim().split(/[\s\-\\\/]+/));
var loop = function ( i ) {
var post = data[i];
@@ -88,14 +89,14 @@ function search (keywords) {
var postContent = post.body && post.body.trim();
var postUrl = post.slug || '';
if (postTitle !== '' && postContent !== '') {
if (postTitle && postContent) {
keywords.forEach(function (keyword, i) {
var regEx = new RegExp(keyword, 'gi');
var indexTitle = -1;
var indexContent = -1;
indexTitle = postTitle.search(regEx);
indexContent = postContent.search(regEx);
indexTitle = postTitle && postTitle.search(regEx);
indexContent = postContent && postContent.search(regEx);
if (indexTitle < 0 && indexContent < 0) {
isMatch = false;
@@ -169,9 +170,10 @@ function init$1 (config, vm) {
}
var dom;
var NO_DATA_TEXT = '';
function style () {
var code = "\n.sidebar {\n padding-top: 0;\n}\n\n.search {\n margin-bottom: 20px;\n padding: 6px;\n border-bottom: 1px solid #eee;\n}\n\n.search .results-panel {\n display: none;\n}\n\n.search .results-panel.show {\n display: block;\n}\n\n.search input {\n outline: none;\n border: none;\n width: 100%;\n padding: 7px;\n line-height: 22px;\n font-size: 14px;\n}\n\n.search h2 {\n font-size: 17px;\n margin: 10px 0;\n}\n\n.search a {\n text-decoration: none;\n color: inherit;\n}\n\n.search .matching-post {\n border-bottom: 1px solid #eee;\n}\n\n.search .matching-post:last-child {\n border-bottom: 0;\n}\n\n.search p {\n font-size: 14px;\n overflow: hidden;\n text-overflow: ellipsis;\n display: -webkit-box;\n -webkit-line-clamp: 2;\n -webkit-box-orient: vertical;\n}\n\n.search p.empty {\n text-align: center;\n}";
var code = "\n.sidebar {\n padding-top: 0;\n}\n\n.search {\n margin-bottom: 20px;\n padding: 6px;\n border-bottom: 1px solid #eee;\n}\n\n.search .results-panel {\n display: none;\n}\n\n.search .results-panel.show {\n display: block;\n}\n\n.search input {\n outline: none;\n border: none;\n width: 100%;\n padding: 7px;\n line-height: 22px;\n font-size: 14px;\n -webkit-appearance: none;\n -moz-appearance: none;\n appearance: none;\n}\n\n.search h2 {\n font-size: 17px;\n margin: 10px 0;\n}\n\n.search a {\n text-decoration: none;\n color: inherit;\n}\n\n.search .matching-post {\n border-bottom: 1px solid #eee;\n}\n\n.search .matching-post:last-child {\n border-bottom: 0;\n}\n\n.search p {\n font-size: 14px;\n overflow: hidden;\n text-overflow: ellipsis;\n display: -webkit-box;\n -webkit-line-clamp: 2;\n -webkit-box-orient: vertical;\n}\n\n.search p.empty {\n text-align: center;\n}";
var style = dom.create('style', code);
dom.appendTo(dom.head, style);
}
@@ -192,13 +194,7 @@ function bindEvents () {
var $search = dom.find('div.search');
var $input = dom.find($search, 'input');
var $panel = dom.find($search, '.results-panel');
// Prevent to Fold sidebar
dom.on($search, 'click',
function (e) { return e.target.tagName !== 'A' && e.stopPropagation(); });
dom.on($input, 'input', function (e) {
var value = e.target.value.trim();
var doSearch = function (value) {
if (!value) {
$panel.classList.remove('show');
$panel.innerHTML = '';
@@ -207,13 +203,21 @@ function bindEvents () {
var matchs = search(value);
var html = '';
matchs.forEach(function (post) {
html += "<div class=\"matching-post\">\n <h2><a href=\"" + (post.url) + "\">" + (post.title) + "</a></h2>\n <p>" + (post.content) + "</p>\n</div>";
});
$panel.classList.add('show');
$panel.innerHTML = html || '<p class="empty">No Results!</p>';
$panel.innerHTML = html || ("<p class=\"empty\">" + NO_DATA_TEXT + "</p>");
};
var timeId;
// Prevent to Fold sidebar
dom.on($search, 'click',
function (e) { return e.target.tagName !== 'A' && e.stopPropagation(); });
dom.on($input, 'input', function (e) {
clearTimeout(timeId);
timeId = setTimeout(function (_) { return doSearch(e.target.value.trim()); }, 100);
});
}
@@ -228,6 +232,15 @@ function updatePlaceholder (text, path) {
}
}
function updateNoData (text, path) {
if (typeof text === 'string') {
NO_DATA_TEXT = text;
} else {
var match = Object.keys(text).find(function (key) { return path.indexOf(key) > -1; });
NO_DATA_TEXT = text[match];
}
}
function init$$1 (opts) {
dom = Docsify.dom;
style();
@@ -237,10 +250,12 @@ function init$$1 (opts) {
function update (opts, vm) {
updatePlaceholder(opts.placeholder, vm.route.path);
updateNoData(opts.noData, vm.route.path);
}
var CONFIG = {
placeholder: 'Type to search',
noData: 'No Results!',
paths: 'auto',
maxAge: 86400000 // 1 day
};
@@ -255,6 +270,7 @@ var install = function (hook, vm) {
CONFIG.paths = Array.isArray(opts.paths) ? opts.paths : 'auto';
CONFIG.maxAge = util.isPrimitive(opts.maxAge) ? opts.maxAge : CONFIG.maxAge;
CONFIG.placeholder = opts.placeholder || CONFIG.placeholder;
CONFIG.noData = opts.noData || CONFIG.noData;
}
var isAuto = CONFIG.paths === 'auto';
+1 -1
View File
@@ -1 +1 @@
this.D=this.D||{},function(){"use strict";function e(e){var n={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;"};return String(e).replace(/[&<>"'\/]/g,function(e){return n[e]})}function n(){var e=[];return h.dom.findAll("a").map(function(n){var t=n.href,r=n.getAttribute("href"),i=h.route.parse(t).path;i&&e.indexOf(i)===-1&&!h.route.isAbsolutePath(r)&&e.push(i)}),e}function t(e){localStorage.setItem("docsify.search.expires",Date.now()+e),localStorage.setItem("docsify.search.index",JSON.stringify(f))}function r(e,n){void 0===n&&(n="");var t,r=window.marked.lexer(n),i=Docsify.route.toURL,o={};return r.forEach(function(n){if("heading"===n.type&&n.depth<=2)t=i(e,{id:n.text}),o[t]={slug:t,title:n.text,body:""};else{if(!t)return;o[t]?o[t].body?o[t].body+="\n"+(n.text||""):o[t].body=n.text:o[t]={slug:t,title:"",body:""}}}),o}function i(n){var t=[],r=[];Object.keys(f).forEach(function(e){r=r.concat(Object.keys(f[e]).map(function(n){return f[e][n]}))}),n=n.trim().split(/[\s\-\\\\/]+/);for(var i=function(i){var o=r[i],a=!1,s="",c=o.title&&o.title.trim(),l=o.body&&o.body.trim(),p=o.slug||"";if(""!==c&&""!==l&&(n.forEach(function(n,t){var r=new RegExp(n,"gi"),i=-1,o=-1;if(i=c.search(r),o=l.search(r),i<0&&o<0)a=!1;else{a=!0,o<0&&(o=0);var p=0,d=0;p=o<11?0:o-10,d=0===p?70:o+n.length+60,d>l.length&&(d=l.length);var h="..."+e(l).substring(p,d).replace(r,'<em class="search-keyword">'+n+"</em>")+"...";s+=h}}),a)){var d={title:e(c),content:s,url:p};t.push(d)}},o=0;o<r.length;o++)i(o);return t}function o(e,i){h=Docsify;var o="auto"===e.paths,a=localStorage.getItem("docsify.search.expires")<Date.now();if(f=JSON.parse(localStorage.getItem("docsify.search.index")),a)f={};else if(!o)return;var s=o?n():e.paths,c=s.length,l=0;s.forEach(function(n){return f[n]?l++:void h.get(i.$getFile(n)).then(function(i){f[n]=r(n,i),c===++l&&t(e.maxAge)})})}function a(){var e="\n.sidebar {\n padding-top: 0;\n}\n\n.search {\n margin-bottom: 20px;\n padding: 6px;\n border-bottom: 1px solid #eee;\n}\n\n.search .results-panel {\n display: none;\n}\n\n.search .results-panel.show {\n display: block;\n}\n\n.search input {\n outline: none;\n border: none;\n width: 100%;\n padding: 7px;\n line-height: 22px;\n font-size: 14px;\n}\n\n.search h2 {\n font-size: 17px;\n margin: 10px 0;\n}\n\n.search a {\n text-decoration: none;\n color: inherit;\n}\n\n.search .matching-post {\n border-bottom: 1px solid #eee;\n}\n\n.search .matching-post:last-child {\n border-bottom: 0;\n}\n\n.search p {\n font-size: 14px;\n overflow: hidden;\n text-overflow: ellipsis;\n display: -webkit-box;\n -webkit-line-clamp: 2;\n -webkit-box-orient: vertical;\n}\n\n.search p.empty {\n text-align: center;\n}",n=u.create("style",e);u.appendTo(u.head,n)}function s(e){var n='<input type="search" /><div class="results-panel"></div></div>',t=u.create("div",n),r=u.find("aside");u.toggleClass(t,"search"),u.before(r,t)}function c(){var e=u.find("div.search"),n=u.find(e,"input"),t=u.find(e,".results-panel");u.on(e,"click",function(e){return"A"!==e.target.tagName&&e.stopPropagation()}),u.on(n,"input",function(e){var n=e.target.value.trim();if(!n)return t.classList.remove("show"),void(t.innerHTML="");var r=i(n),o="";r.forEach(function(e){o+='<div class="matching-post">\n <h2><a href="'+e.url+'">'+e.title+"</a></h2>\n <p>"+e.content+"</p>\n</div>"}),t.classList.add("show"),t.innerHTML=o||'<p class="empty">No Results!</p>'})}function l(e,n){var t=u.getNode('.search input[type="search"]');if("string"==typeof e)t.placeholder=e;else{var r=Object.keys(e).find(function(e){return n.indexOf(e)>-1});t.placeholder=e[r]}}function p(e){u=Docsify.dom,a(),s(e),c()}function d(e,n){l(e.placeholder,n.route.path)}var h,u,f={},g={placeholder:"Type to search",paths:"auto",maxAge:864e5},v=function(e,n){var t=Docsify.util,r=n.config.search||g;Array.isArray(r)?g.paths=r:"object"==typeof r&&(g.paths=Array.isArray(r.paths)?r.paths:"auto",g.maxAge=t.isPrimitive(r.maxAge)?r.maxAge:g.maxAge,g.placeholder=r.placeholder||g.placeholder);var i="auto"===g.paths;e.mounted(function(e){p(g),!i&&o(g,n)}),e.doneEach(function(e){d(g,n),i&&o(g,n)})};window.$docsify.plugins=[].concat(v,window.$docsify.plugins)}();
this.D=this.D||{},function(){"use strict";function n(n){var e={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;"};return String(n).replace(/[&<>"'\/]/g,function(n){return e[n]})}function e(){var n=[];return d.dom.findAll("a:not([data-nosearch])").map(function(e){var t=e.href,a=e.getAttribute("href"),o=d.route.parse(t).path;o&&n.indexOf(o)===-1&&!d.route.isAbsolutePath(a)&&n.push(o)}),n}function t(n){localStorage.setItem("docsify.search.expires",Date.now()+n),localStorage.setItem("docsify.search.index",JSON.stringify(g))}function a(n,e){void 0===e&&(e="");var t,a=window.marked.lexer(e),o=window.Docsify.slugify,r=Docsify.route.toURL,i={};return a.forEach(function(e){if("heading"===e.type&&e.depth<=2)t=r(n,{id:o(e.text)}),i[t]={slug:t,title:e.text,body:""};else{if(!t)return;i[t]?i[t].body?i[t].body+="\n"+(e.text||""):i[t].body=e.text:i[t]={slug:t,title:"",body:""}}}),o.clear(),i}function o(e){var t=[],a=[];Object.keys(g).forEach(function(n){a=a.concat(Object.keys(g[n]).map(function(e){return g[n][e]}))}),e=[].concat(e,e.trim().split(/[\s\-\\\\/]+/));for(var o=function(o){var r=a[o],i=!1,s="",c=r.title&&r.title.trim(),l=r.body&&r.body.trim(),p=r.slug||"";if(c&&l&&(e.forEach(function(e,t){var a=new RegExp(e,"gi"),o=-1,r=-1;if(o=c&&c.search(a),r=l&&l.search(a),o<0&&r<0)i=!1;else{i=!0,r<0&&(r=0);var p=0,u=0;p=r<11?0:r-10,u=0===p?70:r+e.length+60,u>l.length&&(u=l.length);var f="..."+n(l).substring(p,u).replace(a,'<em class="search-keyword">'+e+"</em>")+"...";s+=f}}),i)){var u={title:n(c),content:s,url:p};t.push(u)}},r=0;r<a.length;r++)o(r);return t}function r(n,o){d=Docsify;var r="auto"===n.paths,i=localStorage.getItem("docsify.search.expires")<Date.now();if(g=JSON.parse(localStorage.getItem("docsify.search.index")),i)g={};else if(!r)return;var s=r?e():n.paths,c=s.length,l=0;s.forEach(function(e){return g[e]?l++:void d.get(o.$getFile(e)).then(function(o){g[e]=a(e,o),c===++l&&t(n.maxAge)})})}function i(){var n="\n.sidebar {\n padding-top: 0;\n}\n\n.search {\n margin-bottom: 20px;\n padding: 6px;\n border-bottom: 1px solid #eee;\n}\n\n.search .results-panel {\n display: none;\n}\n\n.search .results-panel.show {\n display: block;\n}\n\n.search input {\n outline: none;\n border: none;\n width: 100%;\n padding: 7px;\n line-height: 22px;\n font-size: 14px;\n -webkit-appearance: none;\n -moz-appearance: none;\n appearance: none;\n}\n\n.search h2 {\n font-size: 17px;\n margin: 10px 0;\n}\n\n.search a {\n text-decoration: none;\n color: inherit;\n}\n\n.search .matching-post {\n border-bottom: 1px solid #eee;\n}\n\n.search .matching-post:last-child {\n border-bottom: 0;\n}\n\n.search p {\n font-size: 14px;\n overflow: hidden;\n text-overflow: ellipsis;\n display: -webkit-box;\n -webkit-line-clamp: 2;\n -webkit-box-orient: vertical;\n}\n\n.search p.empty {\n text-align: center;\n}",e=h.create("style",n);h.appendTo(h.head,e)}function s(n){var e='<input type="search" /><div class="results-panel"></div></div>',t=h.create("div",e),a=h.find("aside");h.toggleClass(t,"search"),h.before(a,t)}function c(){var n,e=h.find("div.search"),t=h.find(e,"input"),a=h.find(e,".results-panel"),r=function(n){if(!n)return a.classList.remove("show"),void(a.innerHTML="");var e=o(n),t="";e.forEach(function(n){t+='<div class="matching-post">\n <h2><a href="'+n.url+'">'+n.title+"</a></h2>\n <p>"+n.content+"</p>\n</div>"}),a.classList.add("show"),a.innerHTML=t||'<p class="empty">'+y+"</p>"};h.on(e,"click",function(n){return"A"!==n.target.tagName&&n.stopPropagation()}),h.on(t,"input",function(e){clearTimeout(n),n=setTimeout(function(n){return r(e.target.value.trim())},100)})}function l(n,e){var t=h.getNode('.search input[type="search"]');if("string"==typeof n)t.placeholder=n;else{var a=Object.keys(n).find(function(n){return e.indexOf(n)>-1});t.placeholder=n[a]}}function p(n,e){if("string"==typeof n)y=n;else{var t=Object.keys(n).find(function(n){return e.indexOf(n)>-1});y=n[t]}}function u(n){h=Docsify.dom,i(),s(n),c()}function f(n,e){l(n.placeholder,e.route.path),p(n.noData,e.route.path)}var d,h,g={},y="",m={placeholder:"Type to search",noData:"No Results!",paths:"auto",maxAge:864e5},v=function(n,e){var t=Docsify.util,a=e.config.search||m;Array.isArray(a)?m.paths=a:"object"==typeof a&&(m.paths=Array.isArray(a.paths)?a.paths:"auto",m.maxAge=t.isPrimitive(a.maxAge)?a.maxAge:m.maxAge,m.placeholder=a.placeholder||m.placeholder,m.noData=a.noData||m.noData);var o="auto"===m.paths;n.mounted(function(n){u(m),!o&&r(m,e)}),n.doneEach(function(n){f(m,e),o&&r(m,e)})};window.$docsify.plugins=[].concat(v,window.$docsify.plugins)}();
+304
View File
@@ -0,0 +1,304 @@
this.D = this.D || {};
(function () {
'use strict';
var commonjsGlobal = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
function createCommonjsModule(fn, module) {
return module = { exports: {} }, fn(module, module.exports), module.exports;
}
var zoomImage = createCommonjsModule(function (module, exports) {
(function (global, factory) {
module.exports = factory();
}(commonjsGlobal, (function () { 'use strict';
var windowWidth = function () { return document.documentElement.clientWidth; };
var windowHeight = function () { return document.documentElement.clientHeight; };
var elemOffset = function (elem) {
var rect = elem.getBoundingClientRect();
var docElem = document.documentElement;
var win = window;
return {
top: rect.top + win.pageYOffset - docElem.clientTop,
left: rect.left + win.pageXOffset - docElem.clientLeft
}
};
var once = function (elem, type, handler) {
var fn = function (e) {
e.target.removeEventListener(type, fn);
handler();
};
elem.addEventListener(type, fn);
};
var Size = function Size(w, h) {
this.w = w;
this.h = h;
};
var ZoomImage = function ZoomImage(img, offset) {
this.img = img;
this.preservedTransform = img.style.transform;
this.wrap = null;
this.overlay = null;
this.offset = offset;
};
ZoomImage.prototype.forceRepaint = function forceRepaint () {
var _ = this.img.offsetWidth;
return
};
ZoomImage.prototype.zoom = function zoom () {
var size = new Size(this.img.naturalWidth, this.img.naturalHeight);
this.wrap = document.createElement('div');
this.wrap.classList.add('zoom-img-wrap');
this.img.parentNode.insertBefore(this.wrap, this.img);
this.wrap.appendChild(this.img);
this.img.classList.add('zoom-img');
this.img.setAttribute('data-action', 'zoom-out');
this.overlay = document.createElement('div');
this.overlay.classList.add('zoom-overlay');
document.body.appendChild(this.overlay);
this.forceRepaint();
var scale = this.calculateScale(size);
this.forceRepaint();
this.animate(scale);
document.body.classList.add('zoom-overlay-open');
};
ZoomImage.prototype.calculateScale = function calculateScale (size) {
var maxScaleFactor = size.w / this.img.width;
var viewportWidth = (windowWidth() - this.offset);
var viewportHeight = (windowHeight() - this.offset);
var imageAspectRatio = size.w / size.h;
var viewportAspectRatio = viewportWidth / viewportHeight;
if (size.w < viewportWidth && size.h < viewportHeight) {
return maxScaleFactor
} else if (imageAspectRatio < viewportAspectRatio) {
return (viewportHeight / size.h) * maxScaleFactor
}
return (viewportWidth / size.w) * maxScaleFactor
};
ZoomImage.prototype.animate = function animate (scale) {
var imageOffset = elemOffset(this.img);
var scrollTop = window.pageYOffset;
var viewportX = (windowWidth() / 2);
var viewportY = scrollTop + (windowHeight() / 2);
var imageCenterX = imageOffset.left + (this.img.width / 2);
var imageCenterY = imageOffset.top + (this.img.height / 2);
var tx = viewportX - imageCenterX;
var ty = viewportY - imageCenterY;
var tz = 0;
var imgTr = "scale(" + scale + ")";
var wrapTr = "translate3d(" + tx + "px, " + ty + "px, " + tz + "px)";
this.img.style.transform = imgTr;
this.wrap.style.transform = wrapTr;
};
ZoomImage.prototype.dispose = function dispose () {
if (this.wrap === null || this.wrap.parentNode === null) {
return
}
this.img.classList.remove('zoom-img');
this.img.setAttribute('data-action', 'zoom');
this.wrap.parentNode.insertBefore(this.img, this.wrap);
this.wrap.parentNode.removeChild(this.wrap);
document.body.removeChild(this.overlay);
document.body.classList.remove('zoom-overlay-transitioning');
};
ZoomImage.prototype.close = function close () {
var this$1 = this;
document.body.classList.add('zoom-overlay-transitioning');
this.img.style.transform = this.preservedTransform;
if (this.img.style.length === 0) {
this.img.removeAttribute('style');
}
this.wrap.style.transform = 'none';
once(this.img, 'transitionend', function () {
this$1.dispose();
// remove class should happen after dispose. Otherwise,
// a new click event could fire and create a duplicate ZoomImage for
// the same <img> element.
document.body.classList.remove('zoom-overlay-open');
});
};
/**
* Pure JavaScript implementation of zoom.js.
*
* Original preamble:
* zoom.js - It's the best way to zoom an image
* @version v0.0.2
* @link https://github.com/fat/zoom.js
* @license MIT
*
* Needs a related CSS file to work. See the README at
* https://github.com/nishanths/zoom.js for more info.
*
* This is a fork of the original zoom.js implementation by @fat.
* Copyrights for the original project are held by @fat. All other copyright
* for changes in the fork are held by Nishanth Shanmugham.
*
* Copyright (c) 2013 @fat
* The MIT License. Copyright © 2016 Nishanth Shanmugham.
*/
var current = null;
var offset = 80;
var initialScrollPos = -1;
var initialTouchPos = -1;
function handleScroll() {
if (initialScrollPos === -1) {
initialScrollPos = window.pageYOffset;
}
var deltaY = Math.abs(initialScrollPos - window.pageYOffset);
if (deltaY >= 40) {
closeCurrent();
}
}
function handleKeyup(e) {
if (e.keyCode === 27) {
closeCurrent();
}
}
function handleTouchStart(e) {
var t = e.touches[0];
if (t === null) {
return
}
initialTouchPos = t.pageY;
e.target.addEventListener('touchmove', handleTouchMove);
}
function handleTouchMove(e) {
var t = e.touches[0];
if (t === null) {
return
}
if (Math.abs(t.pageY - initialTouchPos) > 10) {
closeCurrent();
e.target.removeEventListener('touchmove', handleTouchMove);
}
}
function handleClick() {
closeCurrent();
}
function addCloseListeners() {
document.addEventListener('scroll', handleScroll);
document.addEventListener('keyup', handleKeyup);
document.addEventListener('touchstart', handleTouchStart);
document.addEventListener('click', handleClick, true);
}
function removeCloseListeners() {
document.removeEventListener('scroll', handleScroll);
document.removeEventListener('keyup', handleKeyup);
document.removeEventListener('touchstart', handleTouchStart);
document.removeEventListener('click', handleClick, true);
}
function closeCurrent(force) {
if (current === null) {
return
}
if (force) {
current.dispose();
} else {
current.close();
}
removeCloseListeners();
current = null;
}
function prepareZoom(e) {
if (document.body.classList.contains('zoom-overlay-open')) {
return
}
if (e.metaKey || e.ctrlKey) {
window.open((e.target.getAttribute('data-original') || e.target.src), '_blank');
return
}
if (e.target.width >= windowWidth() - offset) {
return
}
closeCurrent(true);
current = new ZoomImage(e.target, offset);
current.zoom();
addCloseListeners();
}
var zoom = function (el) {
el.setAttribute('data-action', 'zoom');
el.addEventListener('click', prepareZoom);
return function () { return el.removeEventListener('click', prepareZoom); }
};
return zoom;
})));
});
var style = "img[data-action=\"zoom\"] {\n cursor: pointer;\n cursor: -webkit-zoom-in;\n cursor: zoom-in;\n}\n.zoom-img,\n.zoom-img-wrap {\n position: relative;\n z-index: 666;\n transition: -webkit-transform 300ms cubic-bezier(.2,0,.2,1);\n transition: transform 300ms cubic-bezier(.2,0,.2,1);\n transition: transform 300ms cubic-bezier(.2,0,.2,1), -webkit-transform 300ms cubic-bezier(.2,0,.2,1);\n}\n.zoom-overlay {\n z-index: 420;\n background: #fff;\n position: fixed;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n pointer-events: none;\n opacity: 0;\n transition: opacity 300ms;\n}\n.zoom-overlay-open .zoom-overlay {\n opacity: 1;\n}\n.zoom-overlay-open {\n cursor: pointer;\n cursor: -webkit-zoom-out;\n cursor: zoom-out;\n}\n.zoom-overlay-transitioning {\n cursor: default;\n}\n.zoom-overlay-open.zoom-overlay-transitioning .zoom-overlay{\n opacity: 0;\n}\n";
function install (hook) {
var dom = Docsify.dom;
var destroys;
// add style
dom.appendTo(dom.head, dom.create('style', style));
hook.doneEach(function (_) {
var images = dom.findAll('img:not(.emoji)');
if (Array.isArray(destroys) && destroys.length) {
destroys.forEach(function (o) { return o(); });
destroys = [];
}
destroys = images.map(zoomImage);
});
}
$docsify.plugins = [].concat(install, $docsify.plugins);
}());
+1
View File
@@ -0,0 +1 @@
this.D=this.D||{},function(){"use strict";function t(t,e){return e={exports:{}},t(e,e.exports),e.exports}function e(t){var e,n=Docsify.dom;n.appendTo(n.head,n.create("style",i)),t.doneEach(function(t){var i=n.findAll("img:not(.emoji)");Array.isArray(e)&&e.length&&(e.forEach(function(t){return t()}),e=[]),e=i.map(o)})}var n="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},o=t(function(t,e){!function(e,n){t.exports=n()}(n,function(){function t(){g===-1&&(g=window.pageYOffset);var t=Math.abs(g-window.pageYOffset);t>=40&&a()}function e(t){27===t.keyCode&&a()}function n(t){var e=t.touches[0];null!==e&&(y=e.pageY,t.target.addEventListener("touchmove",o))}function o(t){var e=t.touches[0];null!==e&&Math.abs(e.pageY-y)>10&&(a(),t.target.removeEventListener("touchmove",o))}function i(){a()}function r(){document.addEventListener("scroll",t),document.addEventListener("keyup",e),document.addEventListener("touchstart",n),document.addEventListener("click",i,!0)}function s(){document.removeEventListener("scroll",t),document.removeEventListener("keyup",e),document.removeEventListener("touchstart",n),document.removeEventListener("click",i,!0)}function a(t){null!==h&&(t?h.dispose():h.close(),s(),h=null)}function c(t){if(!document.body.classList.contains("zoom-overlay-open"))return t.metaKey||t.ctrlKey?void window.open(t.target.getAttribute("data-original")||t.target.src,"_blank"):void(t.target.width>=m()-v||(a(!0),h=new p(t.target,v),h.zoom(),r()))}var m=function(){return document.documentElement.clientWidth},u=function(){return document.documentElement.clientHeight},d=function(t){var e=t.getBoundingClientRect(),n=document.documentElement,o=window;return{top:e.top+o.pageYOffset-n.clientTop,left:e.left+o.pageXOffset-n.clientLeft}},l=function(t,e,n){var o=function(t){t.target.removeEventListener(e,o),n()};t.addEventListener(e,o)},f=function(t,e){this.w=t,this.h=e},p=function(t,e){this.img=t,this.preservedTransform=t.style.transform,this.wrap=null,this.overlay=null,this.offset=e};p.prototype.forceRepaint=function(){this.img.offsetWidth},p.prototype.zoom=function(){var t=new f(this.img.naturalWidth,this.img.naturalHeight);this.wrap=document.createElement("div"),this.wrap.classList.add("zoom-img-wrap"),this.img.parentNode.insertBefore(this.wrap,this.img),this.wrap.appendChild(this.img),this.img.classList.add("zoom-img"),this.img.setAttribute("data-action","zoom-out"),this.overlay=document.createElement("div"),this.overlay.classList.add("zoom-overlay"),document.body.appendChild(this.overlay),this.forceRepaint();var e=this.calculateScale(t);this.forceRepaint(),this.animate(e),document.body.classList.add("zoom-overlay-open")},p.prototype.calculateScale=function(t){var e=t.w/this.img.width,n=m()-this.offset,o=u()-this.offset,i=t.w/t.h,r=n/o;return t.w<n&&t.h<o?e:i<r?o/t.h*e:n/t.w*e},p.prototype.animate=function(t){var e=d(this.img),n=window.pageYOffset,o=m()/2,i=n+u()/2,r=e.left+this.img.width/2,s=e.top+this.img.height/2,a=o-r,c=i-s,l=0,f="scale("+t+")",p="translate3d("+a+"px, "+c+"px, "+l+"px)";this.img.style.transform=f,this.wrap.style.transform=p},p.prototype.dispose=function(){null!==this.wrap&&null!==this.wrap.parentNode&&(this.img.classList.remove("zoom-img"),this.img.setAttribute("data-action","zoom"),this.wrap.parentNode.insertBefore(this.img,this.wrap),this.wrap.parentNode.removeChild(this.wrap),document.body.removeChild(this.overlay),document.body.classList.remove("zoom-overlay-transitioning"))},p.prototype.close=function(){var t=this;document.body.classList.add("zoom-overlay-transitioning"),this.img.style.transform=this.preservedTransform,0===this.img.style.length&&this.img.removeAttribute("style"),this.wrap.style.transform="none",l(this.img,"transitionend",function(){t.dispose(),document.body.classList.remove("zoom-overlay-open")})};var h=null,v=80,g=-1,y=-1,w=function(t){return t.setAttribute("data-action","zoom"),t.addEventListener("click",c),function(){return t.removeEventListener("click",c)}};return w})}),i='img[data-action="zoom"] {\n cursor: pointer;\n cursor: -webkit-zoom-in;\n cursor: zoom-in;\n}\n.zoom-img,\n.zoom-img-wrap {\n position: relative;\n z-index: 666;\n transition: -webkit-transform 300ms cubic-bezier(.2,0,.2,1);\n transition: transform 300ms cubic-bezier(.2,0,.2,1);\n transition: transform 300ms cubic-bezier(.2,0,.2,1), -webkit-transform 300ms cubic-bezier(.2,0,.2,1);\n}\n.zoom-overlay {\n z-index: 420;\n background: #fff;\n position: fixed;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n pointer-events: none;\n opacity: 0;\n transition: opacity 300ms;\n}\n.zoom-overlay-open .zoom-overlay {\n opacity: 1;\n}\n.zoom-overlay-open {\n cursor: pointer;\n cursor: -webkit-zoom-out;\n cursor: zoom-out;\n}\n.zoom-overlay-transitioning {\n cursor: default;\n}\n.zoom-overlay-open.zoom-overlay-transitioning .zoom-overlay{\n opacity: 0;\n}\n';$docsify.plugins=[].concat(e,$docsify.plugins)}();
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
+33 -27
View File
@@ -1,7 +1,18 @@
{
"name": "docsify",
"version": "3.0.0",
"version": "3.6.4",
"description": "A magical documentation generator.",
"author": {
"name": "qingwei-li",
"email": "cinwell.li@gmail.com",
"url": "https://github.com/QingWei-Li"
},
"homepage": "https://docsify.js.org",
"license": "MIT",
"repository": {
"type": "git",
"url": "git+https://github.com/QingWei-Li/docsify.git"
},
"main": "lib/docsify.js",
"files": [
"lib",
@@ -14,9 +25,26 @@
"dev": "node app.js & nodemon -w src -e js,css --exec 'npm run dev:build'",
"test": "eslint src"
},
"repository": {
"type": "git",
"url": "https://github.com/QingWei-Li/docsify.git"
"dependencies": {
"marked": "^0.3.6",
"prismjs": "^1.6.0",
"zoom-image": "^0.1.4"
},
"devDependencies": {
"cssnano": "^3.10.0",
"eslint": "^3.18.0",
"eslint-config-vue": "^2.0.2",
"eslint-plugin-vue": "^2.0.1",
"nodemon": "^1.11.0",
"postcss": "^5.2.16",
"postcss-salad": "^1.0.8",
"rollup": "^0.41.6",
"rollup-plugin-buble": "^0.15.0",
"rollup-plugin-commonjs": "^8.0.2",
"rollup-plugin-node-resolve": "^2.0.0",
"rollup-plugin-string": "^2.0.2",
"rollup-plugin-uglify": "^1.0.1",
"serve-static": "^1.12.1"
},
"keywords": [
"doc",
@@ -24,27 +52,5 @@
"documentation",
"creator",
"generator"
],
"author": "qingwei-li <cinwell.li@gmail.com> (https://github.com/QingWei-Li)",
"homepage": "https://docsify.js.org",
"license": "MIT",
"devDependencies": {
"cssnano": "^3.8.1",
"eslint": "^3.10.2",
"eslint-config-vue": "^2.0.1",
"eslint-plugin-vue": "^1.0.0",
"nodemon": "^1.11.0",
"postcss": "^5.2.6",
"postcss-salad": "^1.0.5",
"rollup": "^0.41.1",
"rollup-plugin-buble": "^0.15.0",
"rollup-plugin-commonjs": "^7.0.0",
"rollup-plugin-node-resolve": "^2.0.0",
"rollup-plugin-uglify": "^1.0.1",
"serve-static": "^1.11.1"
},
"dependencies": {
"marked": "^0.3.6",
"prismjs": "^1.5.1"
}
]
}
+4 -2
View File
@@ -15,8 +15,10 @@ const config = merge({
themeColor: '',
nameLink: window.location.pathname,
autoHeader: false,
executeScript: false,
ga: ''
executeScript: null,
noEmoji: false,
ga: '',
mergeNavbar: false
}, window.$docsify)
const script = document.currentScript ||
+52 -51
View File
@@ -2,17 +2,62 @@ import { isMobile } from '../util/env'
import * as dom from '../util/dom'
import { parse } from '../route/hash'
const nav = {}
let hoverOver = false
function highlight () {
const sidebar = dom.getNode('.sidebar')
const anchors = dom.findAll('.anchor')
const wrap = dom.find(sidebar, '.sidebar-nav')
let active = dom.find(sidebar, 'li.active')
const top = dom.body.scrollTop
let last
for (let i = 0, len = anchors.length; i < len; i += 1) {
const node = anchors[i]
if (node.offsetTop > top) {
if (!last) last = node
break
} else {
last = node
}
}
if (!last) return
const li = nav[last.getAttribute('data-id')]
if (!li || li === active) return
active && active.classList.remove('active')
li.classList.add('active')
active = li
// scroll into view
// https://github.com/vuejs/vuejs.org/blob/master/themes/vue/source/js/common.js#L282-L297
if (!hoverOver && dom.body.classList.contains('sticky')) {
const height = sidebar.clientHeight
const curOffset = 0
const cur = active.offsetTop + active.clientHeight + 40
const isInView = (
active.offsetTop >= wrap.scrollTop &&
cur <= wrap.scrollTop + height
)
const notThan = cur - curOffset < height
const top = isInView
? wrap.scrollTop
: notThan
? curOffset
: cur - height
sidebar.scrollTop = top
}
}
export function scrollActiveSidebar () {
if (isMobile) return
let hoverOver = false
const anchors = dom.findAll('.anchor')
const sidebar = dom.find('.sidebar')
const wrap = dom.find(sidebar, '.sidebar-nav')
const nav = {}
const sidebar = dom.getNode('.sidebar')
const lis = dom.findAll(sidebar, 'li')
let active = dom.find(sidebar, 'li.active')
for (let i = 0, len = lis.length; i < len; i += 1) {
const li = lis[i]
@@ -27,50 +72,6 @@ export function scrollActiveSidebar () {
nav[decodeURIComponent(href)] = li
}
function highlight () {
const top = dom.body.scrollTop
let last
for (let i = 0, len = anchors.length; i < len; i += 1) {
const node = anchors[i]
if (node.offsetTop > top) {
if (!last) last = node
break
} else {
last = node
}
}
if (!last) return
const li = nav[last.getAttribute('data-id')]
if (!li || li === active) return
active && active.classList.remove('active')
li.classList.add('active')
active = li
// scroll into view
// https://github.com/vuejs/vuejs.org/blob/master/themes/vue/source/js/common.js#L282-L297
if (!hoverOver && dom.body.classList.contains('sticky')) {
const height = sidebar.clientHeight
const curOffset = 0
const cur = active.offsetTop + active.clientHeight + 40
const isInView = (
active.offsetTop >= wrap.scrollTop &&
cur <= wrap.scrollTop + height
)
const notThan = cur - curOffset < height
const top = isInView
? wrap.scrollTop
: notThan
? curOffset
: cur - height
sidebar.scrollTop = top
}
}
dom.off('scroll', highlight)
dom.on('scroll', highlight)
dom.on(sidebar, 'mouseover', () => { hoverOver = true })
+12 -9
View File
@@ -7,19 +7,22 @@ const title = dom.$.title
* Toggle button
*/
export function btn (el) {
const toggle = () => dom.body.classList.toggle('close')
const toggle = _ => dom.body.classList.toggle('close')
el = dom.getNode(el)
dom.on(el, 'click', toggle)
dom.on(el, 'click', e => {
e.stopPropagation()
toggle()
})
if (isMobile) {
const sidebar = dom.getNode('.sidebar')
const sidebar = dom.getNode('.sidebar')
dom.on(sidebar, 'click', () => {
toggle()
setTimeout(() => getAndActive(sidebar, true, true), 0)
})
}
isMobile && dom.on(dom.body, 'click', _ =>
dom.body.classList.contains('close') && toggle()
)
dom.on(sidebar, 'click', _ =>
setTimeout((_ => getAndActive(sidebar, true, true), 0))
)
}
export function sticky () {
-3
View File
@@ -2,7 +2,6 @@ import progressbar from '../render/progressbar'
import { noop } from '../util/core'
const cache = {}
const RUN_VERSION = Date.now()
/**
* Simple ajax get
@@ -16,8 +15,6 @@ export function get (url, hasBar = false) {
xhr.addEventListener.apply(xhr, arguments)
}
url += (/\?(\w+)=/g.test(url) ? '&' : '?') + `v=${RUN_VERSION}`
if (cache[url]) {
return { then: cb => cb(cache[url]), abort: noop }
}
+14 -12
View File
@@ -1,14 +1,23 @@
import { get } from './ajax'
import { callHook } from '../init/lifecycle'
import { getRoot } from '../route/util'
import { getParentPath } from '../route/util'
import { noop } from '../util/core'
function loadNested (path, file, next, vm, first) {
path = first ? path : path.replace(/\/$/, '')
path = getParentPath(path)
if (!path) return
get(vm.$getFile(path + file))
.then(next, _ => loadNested(path, file, next, vm))
}
export function fetchMixin (proto) {
let last
proto._fetch = function (cb = noop) {
const { path } = this.route
const { loadNavbar, loadSidebar } = this.config
const root = getRoot(path)
// Abort last request
last && last.abort && last.abort()
@@ -26,25 +35,18 @@ export function fetchMixin (proto) {
const fn = result => { this._renderSidebar(result); cb() }
// Load sidebar
get(this.$getFile(root + loadSidebar))
// fallback root navbar when fail
.then(fn, _ => get(loadSidebar).then(fn))
loadNested(path, loadSidebar, fn, this, true)
},
_ => this._renderMain(null))
// Load nav
loadNavbar &&
get(this.$getFile(root + loadNavbar))
.then(
text => this._renderNav(text),
// fallback root navbar when fail
_ => get(loadNavbar).then(text => this._renderNav(text))
)
loadNested(path, loadNavbar, text => this._renderNav(text), this, true)
}
proto._fetchCover = function () {
const { coverpage } = this.config
const root = getRoot(this.route.path)
const root = getParentPath(this.route.path)
const path = this.$getFile(root + coverpage)
if (this.route.path !== '/' || !coverpage) {
+2 -1
View File
@@ -2,12 +2,13 @@ import * as util from './util'
import * as dom from './util/dom'
import * as render from './render/compiler'
import * as route from './route/hash'
import { slugify } from './render/slugify'
import { get } from './fetch/ajax'
import marked from 'marked'
import prism from 'prismjs'
export default function () {
window.Docsify = { util, dom, render, route, get }
window.Docsify = { util, dom, render, route, get, slugify }
window.marked = marked
window.Prism = prism
}
-1
View File
@@ -25,5 +25,4 @@ initGlobalAPI()
/**
* Run Docsify
*/
setTimeout(_ => new Docsify(), 0)
+32 -13
View File
@@ -2,7 +2,7 @@ import marked from 'marked'
import Prism from 'prismjs'
import { helper as helperTpl, tree as treeTpl } from './tpl'
import { genTree } from './gen-tree'
import { slugify, clearSlugCache } from './slugify'
import { slugify } from './slugify'
import { emojify } from './emojify'
import { toURL, parse } from '../route/hash'
import { getBasePath, isAbsolutePath, getPath } from '../route/util'
@@ -12,7 +12,7 @@ let markdownCompiler = marked
let contentBase = ''
let currentPath = ''
let renderer = new marked.Renderer()
const TOC = {}
const cacheTree = {}
let toc = []
/**
@@ -25,7 +25,7 @@ export const markdown = cached(text => {
html = markdownCompiler(text)
html = emojify(html)
clearSlugCache()
slugify.clear()
return html
})
@@ -34,7 +34,6 @@ markdown.renderer = renderer
markdown.init = function (config = {}, base = window.location.pathname) {
contentBase = getBasePath(base)
currentPath = parse().path
if (isFn(config)) {
markdownCompiler = config(marked, renderer)
@@ -53,10 +52,24 @@ markdown.update = function () {
* @link https://github.com/chjj/marked#overriding-renderer-methods
*/
renderer.heading = function (text, level) {
const nextToc = { level, title: text }
if (/{docsify-ignore}/g.test(text)) {
text = text.replace('{docsify-ignore}', '')
nextToc.title = text
nextToc.ignoreSubHeading = true
}
if (/{docsify-ignore-all}/g.test(text)) {
text = text.replace('{docsify-ignore-all}', '')
nextToc.title = text
nextToc.ignoreAllSubs = true
}
const slug = slugify(text)
const url = toURL(currentPath, { id: slug })
toc.push({ level, slug: url, title: text })
nextToc.slug = url
toc.push(nextToc)
return `<h${level} id="${slug}"><a href="${url}" data-id="${slug}" class="anchor"><span>${text}</span></a></h${level}>`
}
@@ -69,11 +82,14 @@ renderer.code = function (code, lang = '') {
renderer.link = function (href, title, text) {
let blank = ''
if (!/:|(\/{2})/.test(href)) {
href = toURL(href)
href = toURL(href, null, currentPath)
} else {
blank = ' target="_blank"'
}
return `<a href="${href}" title="${title || text}"${blank}>${text}</a>`
if (title) {
title = ` title="${title}"`
}
return `<a href="${href}"${title || ''}${blank}>${text}</a>`
}
renderer.paragraph = function (text) {
if (/^!&gt;/.test(text)) {
@@ -104,8 +120,9 @@ export function sidebar (text, level) {
html = markdown(text)
html = html.match(/<ul[^>]*>([\s\S]+)<\/ul>/g)[0]
} else {
const tree = genTree(toc, level)
const tree = cacheTree[currentPath] || genTree(toc, level)
html = treeTpl(tree, '<ul>')
cacheTree[currentPath] = tree
}
return html
@@ -116,12 +133,14 @@ export function sidebar (text, level) {
*/
export function subSidebar (el, level) {
if (el) {
toc[0] && toc[0].ignoreAllSubs && (toc = [])
toc[0] && toc[0].level === 1 && toc.shift()
const tree = genTree(TOC[currentPath] || toc, level)
toc.forEach((node, i) => {
node.ignoreSubHeading && toc.splice(i, 1)
})
const tree = cacheTree[currentPath] || genTree(toc, level)
el.parentNode.innerHTML += treeTpl(tree, '<ul class="app-sub-sidebar">')
}
if (toc.length) {
TOC[currentPath] = toc.slice()
cacheTree[currentPath] = tree
}
toc = []
}
+7 -3
View File
@@ -1,6 +1,10 @@
function replace (m, $1) {
return '<img class="emoji" src="https://assets-cdn.github.com/images/icons/emoji/' + $1 + '.png" alt="' + $1 + '" />'
}
export function emojify (text) {
return text
.replace(/<(pre|template)[^>]*?>([\s\S]+)<\/(pre|template)>/g, m => m.replace(/:/g, '__colon__'))
.replace(/:(\w+?):/ig, '<img class="emoji" src="https://assets-cdn.github.com/images/icons/emoji/$1.png" alt="$1" />')
return $docsify.noEmoji ? text : text
.replace(/<(pre|template|code)[^>]*?>[\s\S]+?<\/(pre|template|code)>/g, m => m.replace(/:/g, '__colon__'))
.replace(/:(\w+?):/ig, window.emojify || replace)
.replace(/__colon__/g, ':')
}
+1 -2
View File
@@ -15,8 +15,7 @@ export function genTree (toc, maxLevel) {
if (level > maxLevel) return
if (last[len]) {
last[len].children = last[len].children || []
last[len].children.push(headline)
last[len].children = (last[len].children || []).concat(headline)
} else {
headlines.push(headline)
}
+44 -12
View File
@@ -6,6 +6,8 @@ import * as tpl from './tpl'
import { markdown, sidebar, subSidebar, cover } from './compiler'
import { callHook } from '../init/lifecycle'
import { getBasePath, getPath, isAbsolutePath } from '../route/util'
import { isPrimitive } from '../util/core'
import { isMobile } from '../util/env'
function executeScript () {
const script = dom.findAll('.markdown-section>script')
@@ -28,15 +30,18 @@ function renderMain (html) {
this._renderTo('.markdown-section', html)
// Render sidebar with the TOC
!this.config.loadSidebar && this._renderSidebar()
// execute script
this.config.executeScript && executeScript()
if (!this.config.executeScript &&
// execute script
if (this.config.executeScript !== false &&
typeof window.Vue !== 'undefined' &&
!executeScript()) {
setTimeout(_ => {
const vueVM = window.__EXECUTE_RESULT__
vueVM && vueVM.$destroy && vueVM.$destroy()
window.__EXECUTE_RESULT__ = new window.Vue().$mount('#main')
}, 0)
} else {
this.config.executeScript && executeScript()
}
if (this.config.auto2top) {
@@ -44,6 +49,22 @@ function renderMain (html) {
}
}
function renderNameLink (vm) {
const el = dom.getNode('.app-name-link')
const nameLink = vm.config.nameLink
const path = vm.route.path
if (!el) return
if (isPrimitive(vm.config.nameLink)) {
el.setAttribute('href', nameLink)
} else if (typeof nameLink === 'object') {
const match = Object.keys(nameLink).find(key => path.indexOf(key) > -1)
el.setAttribute('href', nameLink[match])
}
}
export function renderMixin (proto) {
proto._renderTo = function (el, content, replace) {
const node = dom.getNode(el)
@@ -51,11 +72,11 @@ export function renderMixin (proto) {
}
proto._renderSidebar = function (text) {
const { maxLevel, subMaxLevel, autoHeader } = this.config
const { maxLevel, subMaxLevel, autoHeader, loadSidebar } = this.config
this._renderTo('.sidebar-nav', sidebar(text, maxLevel))
const active = getAndActive('.sidebar-nav', true, true)
subSidebar(active, subMaxLevel)
subSidebar(loadSidebar ? active : '', subMaxLevel)
// bind event
this.activeLink = active
scrollActiveSidebar()
@@ -101,10 +122,12 @@ export function renderMixin (proto) {
let path = m[1]
dom.toggleClass(el, 'add', 'has-mask')
if (isAbsolutePath(m[1])) {
if (!isAbsolutePath(m[1])) {
path = getPath(getBasePath(this.config.basePath), m[1])
}
el.style.backgroundImage = `url(${path})`
el.style.backgroundSize = 'cover'
el.style.backgroundPosition = 'center center'
}
html = html.replace(m[0], '')
}
@@ -115,6 +138,8 @@ export function renderMixin (proto) {
proto._updateRender = function () {
markdown.update()
// render name link
renderNameLink(this)
}
}
@@ -129,12 +154,8 @@ export function initRender (vm) {
let el = dom.find(id)
let html = ''
let navAppendToTarget = dom.body
navEl.classList.add('app-nav')
if (!config.repo) {
navEl.classList.add('no-badge')
}
if (!el) {
el = dom.create(id)
dom.appendTo(dom.body, el)
@@ -149,8 +170,19 @@ export function initRender (vm) {
html += tpl.main(config)
// Render main app
vm._renderTo(el, html, true)
if (config.mergeNavbar && isMobile) {
navAppendToTarget = dom.find('.sidebar')
} else {
navEl.classList.add('app-nav')
if (!config.repo) {
navEl.classList.add('no-badge')
}
}
// Add nav
dom.before(dom.body, navEl)
dom.before(navAppendToTarget, navEl)
if (config.themeColor) {
dom.$.head.innerHTML += tpl.theme(config.themeColor)
+1 -1
View File
@@ -22,6 +22,6 @@ export function slugify (str) {
return slug
}
export function clearSlugCache () {
slugify.clear = function () {
cache = {}
}
+2 -2
View File
@@ -16,7 +16,7 @@ export function corner (data) {
'<path d="M128.3,109.0 C113.8,99.7 119.0,89.6 119.0,89.6 C122.0,82.7 120.5,78.6 120.5,78.6 C119.2,72.0 123.4,76.3 123.4,76.3 C127.3,80.9 125.5,87.3 125.5,87.3 C122.9,97.6 130.6,101.9 134.4,103.2" fill="currentColor" style="transform-origin: 130px 106px;" class="octo-arm"></path>' +
'<path d="M115.0,115.0 C114.9,115.1 118.7,116.5 119.8,115.4 L133.7,101.6 C136.9,99.2 139.9,98.4 142.2,98.6 C133.8,88.0 127.5,74.4 143.8,58.0 C148.5,53.4 154.0,51.2 159.7,51.0 C160.3,49.4 163.2,43.6 171.4,40.1 C171.4,40.1 176.1,42.5 178.8,56.2 C183.1,58.6 187.2,61.8 190.9,65.4 C194.5,69.0 197.7,73.2 200.1,77.6 C213.8,80.2 216.3,84.9 216.3,84.9 C212.7,93.1 206.9,96.0 205.4,96.6 C205.1,102.4 203.0,107.8 198.3,112.5 C181.9,128.9 168.3,122.5 157.7,114.1 C157.9,116.9 156.7,120.9 152.7,124.9 L141.0,136.5 C139.8,137.7 141.6,141.9 141.8,141.8 Z" fill="currentColor" class="octo-body"></path>' +
'</svg>' +
'</a>`')
'</a>')
}
/**
@@ -31,7 +31,7 @@ export function main (config) {
'</button>' +
'<aside class="sidebar">' +
(config.name
? `<h1><a href="${config.nameLink}">${config.name}</a></h1>`
? `<h1><a class="app-name-link" data-nosearch>${config.name}</a></h1>`
: '') +
'<div class="sidebar-nav"></div>' +
'</aside>')
+6 -1
View File
@@ -64,12 +64,17 @@ export function parse (path = window.location.href) {
* to URL
* @param {string} path
* @param {object} qs query params
* @param {string} currentRoute optional current route
*/
export function toURL (path, params) {
export function toURL (path, params, currentRoute) {
const local = currentRoute && path[0] === '#'
const route = parse(replaceSlug(path))
route.query = merge({}, route.query, params)
path = route.path + stringifyQuery(route.query)
path = path.replace(/\.md(\?)|\.md$/, '$1')
if (local) path = currentRoute + path
return cleanPath('#/' + path)
}
+2 -1
View File
@@ -20,7 +20,7 @@ export function routeMixin (proto) {
const { config } = this
const base = getBasePath(config.basePath)
path = getAlias(path, config.alias)
path = config.alias ? getAlias(path, config.alias) : path
path = getFileName(path)
path = path === '/README.md' ? (config.homepage || path) : path
path = isAbsolutePath(path) ? path : getPath(base, path)
@@ -34,6 +34,7 @@ let lastRoute = {}
export function initRoute (vm) {
normalize()
lastRoute = vm.route = parse()
vm._updateRender()
on('hashchange', _ => {
normalize()
+7 -3
View File
@@ -45,10 +45,14 @@ export const isAbsolutePath = cached(path => {
return /(:|(\/{2}))/.test(path)
})
export const getRoot = cached(path => {
return /\/$/g.test(path) ? path : path.match(/(\S*\/)[^\/]+$/)[1]
export const getParentPath = cached(path => {
return /\/$/g.test(path)
? path
: (path = path.match(/(\S*\/)[^\/]+$/))
? path[1]
: ''
})
export const cleanPath = cached(path => {
return path.replace(/\/+/g, '/')
return path.replace(/([^:])\/{2,}/g, '$1/')
})
+5 -2
View File
@@ -10,7 +10,10 @@ const cacheNode = {}
*/
export function getNode (el, noCache = false) {
if (typeof el === 'string') {
el = noCache ? find(el) : (cacheNode[el] || find(el))
if (typeof window.Vue !== 'undefined') {
return find(el)
}
el = noCache ? find(el) : (cacheNode[el] || (cacheNode[el] = find(el)))
}
return el
@@ -62,7 +65,7 @@ export function on (el, type, handler) {
: el.addEventListener(type, handler)
}
export const off = function on (el, type, handler) {
export function off (el, type, handler) {
isFn(type)
? window.removeEventListener(el, type)
: el.removeEventListener(type, handler)
+153
View File
@@ -0,0 +1,153 @@
const AllGithubEmoji = ['+1', '100', '1234', '8ball', 'a', 'ab', 'abc', 'abcd',
'accept', 'aerial_tramway', 'airplane', 'alarm_clock', 'alien', 'ambulance',
'anchor', 'angel', 'anger', 'angry', 'anguished', 'ant', 'apple', 'aquarius',
'aries', 'arrow_backward', 'arrow_double_down', 'arrow_double_up', 'arrow_down',
'arrow_down_small', 'arrow_forward', 'arrow_heading_down', 'arrow_heading_up',
'arrow_left', 'arrow_lower_left', 'arrow_lower_right', 'arrow_right',
'arrow_right_hook', 'arrow_up', 'arrow_up_down', 'arrow_up_small', 'arrow_upper_left',
'arrow_upper_right', 'arrows_clockwise', 'arrows_counterclockwise', 'art',
'articulated_lorry', 'astonished', 'athletic_shoe', 'atm', 'b', 'baby', 'baby_bottle',
'baby_chick', 'baby_symbol', 'back', 'baggage_claim', 'balloon', 'ballot_box_with_check',
'bamboo', 'banana', 'bangbang', 'bank', 'bar_chart', 'barber', 'baseball', 'basketball',
'bath', 'bathtub', 'battery', 'bear', 'bee', 'beer', 'beers', 'beetle', 'beginner',
'bell', 'bento', 'bicyclist', 'bike', 'bikini', 'bird', 'birthday', 'black_circle',
'black_joker', 'black_large_square', 'black_medium_small_square', 'black_medium_square',
'black_nib', 'black_small_square', 'black_square_button', 'blossom', 'blowfish',
'blue_book', 'blue_car', 'blue_heart', 'blush', 'boar', 'boat', 'bomb', 'book',
'bookmark', 'bookmark_tabs', 'books', 'boom', 'boot', 'bouquet', 'bow', 'bowling',
'bowtie', 'boy', 'bread', 'bride_with_veil', 'bridge_at_night', 'briefcase',
'broken_heart', 'bug', 'bulb', 'bullettrain_front', 'bullettrain_side', 'bus',
'busstop', 'bust_in_silhouette', 'busts_in_silhouette', 'cactus', 'cake', 'calendar',
'calling', 'camel', 'camera', 'cancer', 'candy', 'capital_abcd', 'capricorn', 'car',
'card_index', 'carousel_horse', 'cat', 'cat2', 'cd', 'chart', 'chart_with_downwards_trend',
'chart_with_upwards_trend', 'checkered_flag', 'cherries', 'cherry_blossom', 'chestnut',
'chicken', 'children_crossing', 'chocolate_bar', 'christmas_tree', 'church', 'cinema',
'circus_tent', 'city_sunrise', 'city_sunset', 'cl', 'clap', 'clapper', 'clipboard',
'clock1', 'clock10', 'clock1030', 'clock11', 'clock1130', 'clock12', 'clock1230',
'clock130', 'clock2', 'clock230', 'clock3', 'clock330', 'clock4', 'clock430',
'clock5', 'clock530', 'clock6', 'clock630', 'clock7', 'clock730', 'clock8', 'clock830',
'clock9', 'clock930', 'closed_book', 'closed_lock_with_key', 'closed_umbrella',
'cloud', 'clubs', 'cn', 'cocktail', 'coffee', 'cold_sweat', 'collision', 'computer',
'confetti_ball', 'confounded', 'confused', 'congratulations', 'construction',
'construction_worker', 'convenience_store', 'cookie', 'cool', 'cop', 'copyright',
'corn', 'couple', 'couple_with_heart', 'couplekiss', 'cow', 'cow2', 'credit_card',
'crescent_moon', 'crocodile', 'crossed_flags', 'crown', 'cry', 'crying_cat_face',
'crystal_ball', 'cupid', 'curly_loop', 'currency_exchange', 'curry', 'custard',
'customs', 'cyclone', 'dancer', 'dancers', 'dango', 'dart', 'dash', 'date', 'de',
'deciduous_tree', 'department_store', 'diamond_shape_with_a_dot_inside', 'diamonds',
'disappointed', 'disappointed_relieved', 'dizzy', 'dizzy_face', 'do_not_litter',
'dog', 'dog2', 'dollar', 'dolls', 'dolphin', 'door', 'doughnut', 'dragon',
'dragon_face', 'dress', 'dromedary_camel', 'droplet', 'dvd', 'e-mail', 'ear',
'ear_of_rice', 'earth_africa', 'earth_americas', 'earth_asia', 'egg', 'eggplant',
'eight', 'eight_pointed_black_star', 'eight_spoked_asterisk', 'electric_plug',
'elephant', 'email', 'end', 'envelope', 'envelope_with_arrow', 'es', 'euro',
'european_castle', 'european_post_office', 'evergreen_tree', 'exclamation',
'expressionless', 'eyeglasses', 'eyes', 'facepunch', 'factory', 'fallen_leaf',
'family', 'fast_forward', 'fax', 'fearful', 'feelsgood', 'feet', 'ferris_wheel',
'file_folder', 'finnadie', 'fire', 'fire_engine', 'fireworks', 'first_quarter_moon',
'first_quarter_moon_with_face', 'fish', 'fish_cake', 'fishing_pole_and_fish',
'fist', 'five', 'flags', 'flashlight', 'flipper', 'floppy_disk', 'flower_playing_cards',
'flushed', 'foggy', 'football', 'footprints', 'fork_and_knife', 'fountain',
'four', 'four_leaf_clover', 'fr', 'free', 'fried_shrimp', 'fries', 'frog',
'frowning', 'fu', 'fuelpump', 'full_moon', 'full_moon_with_face', 'game_die',
'gb', 'gem', 'gemini', 'ghost', 'gift', 'gift_heart', 'girl', 'globe_with_meridians',
'goat', 'goberserk', 'godmode', 'golf', 'grapes', 'green_apple', 'green_book',
'green_heart', 'grey_exclamation', 'grey_question', 'grimacing', 'grin',
'grinning', 'guardsman', 'guitar', 'gun', 'haircut', 'hamburger', 'hammer',
'hamster', 'hand', 'handbag', 'hankey', 'hash', 'hatched_chick', 'hatching_chick',
'headphones', 'hear_no_evil', 'heart', 'heart_decoration', 'heart_eyes',
'heart_eyes_cat', 'heartbeat', 'heartpulse', 'hearts', 'heavy_check_mark',
'heavy_division_sign', 'heavy_dollar_sign', 'heavy_exclamation_mark', 'heavy_minus_sign',
'heavy_multiplication_x', 'heavy_plus_sign', 'helicopter', 'herb', 'hibiscus',
'high_brightness', 'high_heel', 'hocho', 'honey_pot', 'honeybee', 'horse',
'horse_racing', 'hospital', 'hotel', 'hotsprings', 'hourglass', 'hourglass_flowing_sand',
'house', 'house_with_garden', 'hurtrealbad', 'hushed', 'ice_cream', 'icecream',
'id', 'ideograph_advantage', 'imp', 'inbox_tray', 'incoming_envelope',
'information_desk_person', 'information_source', 'innocent', 'interrobang',
'iphone', 'it', 'izakaya_lantern', 'jack_o_lantern', 'japan', 'japanese_castle',
'japanese_goblin', 'japanese_ogre', 'jeans', 'joy', 'joy_cat', 'jp', 'key',
'keycap_ten', 'kimono', 'kiss', 'kissing', 'kissing_cat', 'kissing_closed_eyes',
'kissing_heart', 'kissing_smiling_eyes', 'koala', 'koko', 'kr', 'lantern',
'large_blue_circle', 'large_blue_diamond', 'large_orange_diamond', 'last_quarter_moon',
'last_quarter_moon_with_face', 'laughing', 'leaves', 'ledger', 'left_luggage',
'left_right_arrow', 'leftwards_arrow_with_hook', 'lemon', 'leo', 'leopard',
'libra', 'light_rail', 'link', 'lips', 'lipstick', 'lock', 'lock_with_ink_pen',
'lollipop', 'loop', 'loud_sound', 'loudspeaker', 'love_hotel', 'love_letter',
'low_brightness', 'm', 'mag', 'mag_right', 'mahjong', 'mailbox', 'mailbox_closed',
'mailbox_with_mail', 'mailbox_with_no_mail', 'man', 'man_with_gua_pi_mao',
'man_with_turban', 'mans_shoe', 'maple_leaf', 'mask', 'massage', 'meat_on_bone',
'mega', 'melon', 'memo', 'mens', 'metal', 'metro', 'microphone', 'microscope',
'milky_way', 'minibus', 'minidisc', 'mobile_phone_off', 'money_with_wings',
'moneybag', 'monkey', 'monkey_face', 'monorail', 'moon', 'mortar_board', 'mount_fuji',
'mountain_bicyclist', 'mountain_cableway', 'mountain_railway', 'mouse', 'mouse2',
'movie_camera', 'moyai', 'muscle', 'mushroom', 'musical_keyboard', 'musical_note',
'musical_score', 'mute', 'nail_care', 'name_badge', 'neckbeard', 'necktie',
'negative_squared_cross_mark', 'neutral_face', 'new', 'new_moon', 'new_moon_with_face',
'newspaper', 'ng', 'night_with_stars', 'nine', 'no_bell', 'no_bicycles', 'no_entry',
'no_entry_sign', 'no_good', 'no_mobile_phones', 'no_mouth', 'no_pedestrians',
'no_smoking', 'non-potable_water', 'nose', 'notebook', 'notebook_with_decorative_cover',
'notes', 'nut_and_bolt', 'o', 'o2', 'ocean', 'octocat', 'octopus', 'oden', 'office',
'ok', 'ok_hand', 'ok_woman', 'older_man', 'older_woman', 'on', 'oncoming_automobile',
'oncoming_bus', 'oncoming_police_car', 'oncoming_taxi', 'one', 'open_book',
'open_file_folder', 'open_hands', 'open_mouth', 'ophiuchus', 'orange_book',
'outbox_tray', 'ox', 'package', 'page_facing_up', 'page_with_curl', 'pager',
'palm_tree', 'panda_face', 'paperclip', 'parking', 'part_alternation_mark',
'partly_sunny', 'passport_control', 'paw_prints', 'peach', 'pear', 'pencil',
'pencil2', 'penguin', 'pensive', 'performing_arts', 'persevere', 'person_frowning',
'person_with_blond_hair', 'person_with_pouting_face', 'phone', 'pig', 'pig2',
'pig_nose', 'pill', 'pineapple', 'pisces', 'pizza', 'point_down', 'point_left',
'point_right', 'point_up', 'point_up_2', 'police_car', 'poodle', 'poop',
'post_office', 'postal_horn', 'postbox', 'potable_water', 'pouch', 'poultry_leg',
'pound', 'pouting_cat', 'pray', 'princess', 'punch', 'purple_heart', 'purse',
'pushpin', 'put_litter_in_its_place', 'question', 'rabbit', 'rabbit2', 'racehorse',
'radio', 'radio_button', 'rage', 'rage1', 'rage2', 'rage3', 'rage4', 'railway_car',
'rainbow', 'raised_hand', 'raised_hands', 'raising_hand', 'ram', 'ramen', 'rat',
'recycle', 'red_car', 'red_circle', 'registered', 'relaxed', 'relieved', 'repeat',
'repeat_one', 'restroom', 'revolving_hearts', 'rewind', 'ribbon', 'rice',
'rice_ball', 'rice_cracker', 'rice_scene', 'ring', 'rocket', 'roller_coaster',
'rooster', 'rose', 'rotating_light', 'round_pushpin', 'rowboat', 'ru', 'rugby_football',
'runner', 'running', 'running_shirt_with_sash', 'sa', 'sagittarius', 'sailboat',
'sake', 'sandal', 'santa', 'satellite', 'satisfied', 'saxophone', 'school',
'school_satchel', 'scissors', 'scorpius', 'scream', 'scream_cat', 'scroll',
'seat', 'secret', 'see_no_evil', 'seedling', 'seven', 'shaved_ice', 'sheep',
'shell', 'ship', 'shipit', 'shirt', 'shit', 'shoe', 'shower', 'signal_strength',
'six', 'six_pointed_star', 'ski', 'skull', 'sleeping', 'sleepy', 'slot_machine',
'small_blue_diamond', 'small_orange_diamond', 'small_red_triangle',
'small_red_triangle_down', 'smile', 'smile_cat', 'smiley', 'smiley_cat',
'smiling_imp', 'smirk', 'smirk_cat', 'smoking', 'snail', 'snake', 'snowboarder',
'snowflake', 'snowman', 'sob', 'soccer', 'soon', 'sos', 'sound', 'space_invader',
'spades', 'spaghetti', 'sparkle', 'sparkler', 'sparkles', 'sparkling_heart',
'speak_no_evil', 'speaker', 'speech_balloon', 'speedboat', 'squirrel', 'star',
'star2', 'stars', 'station', 'statue_of_liberty', 'steam_locomotive', 'stew',
'straight_ruler', 'strawberry', 'stuck_out_tongue', 'stuck_out_tongue_closed_eyes',
'stuck_out_tongue_winking_eye', 'sun_with_face', 'sunflower', 'sunglasses',
'sunny', 'sunrise', 'sunrise_over_mountains', 'surfer', 'sushi', 'suspect',
'suspension_railway', 'sweat', 'sweat_drops', 'sweat_smile', 'sweet_potato',
'swimmer', 'symbols', 'syringe', 'tada', 'tanabata_tree', 'tangerine', 'taurus',
'taxi', 'tea', 'telephone', 'telephone_receiver', 'telescope', 'tennis', 'tent',
'thought_balloon', 'three', 'thumbsdown', 'thumbsup', 'ticket', 'tiger', 'tiger2',
'tired_face', 'tm', 'toilet', 'tokyo_tower', 'tomato', 'tongue', 'top', 'tophat',
'tractor', 'traffic_light', 'train', 'train2', 'tram', 'triangular_flag_on_post',
'triangular_ruler', 'trident', 'triumph', 'trolleybus', 'trollface', 'trophy',
'tropical_drink', 'tropical_fish', 'truck', 'trumpet', 'tshirt', 'tulip',
'turtle', 'tv', 'twisted_rightwards_arrows', 'two', 'two_hearts', 'two_men_holding_hands',
'two_women_holding_hands', 'u5272', 'u5408', 'u55b6', 'u6307', 'u6708', 'u6709',
'u6e80', 'u7121', 'u7533', 'u7981', 'u7a7a', 'uk', 'umbrella', 'unamused',
'underage', 'unlock', 'up', 'us', 'v', 'vertical_traffic_light', 'vhs',
'vibration_mode', 'video_camera', 'video_game', 'violin', 'virgo', 'volcano',
'vs', 'walking', 'waning_crescent_moon', 'waning_gibbous_moon', 'warning',
'watch', 'water_buffalo', 'watermelon', 'wave', 'wavy_dash', 'waxing_crescent_moon',
'waxing_gibbous_moon', 'wc', 'weary', 'wedding', 'whale', 'whale2', 'wheelchair',
'white_check_mark', 'white_circle', 'white_flower', 'white_large_square',
'white_medium_small_square', 'white_medium_square', 'white_small_square',
'white_square_button', 'wind_chime', 'wine_glass', 'wink', 'wolf', 'woman',
'womans_clothes', 'womans_hat', 'womens', 'worried', 'wrench', 'x', 'yellow_heart',
'yen', 'yum', 'zap', 'zero', 'zzz']
// emoji from All-Github-Emoji-Icons
// https://github.com/scotch-io/All-Github-Emoji-Icons
window.emojify = function (match, $1) {
return AllGithubEmoji.indexOf($1) === -1
? match
: '<img class="emoji" src="https://assets-cdn.github.com/images/icons/emoji/' + $1 + '.png" alt="' + $1 + '" />'
}
+25
View File
@@ -0,0 +1,25 @@
function handleExternalScript () {
const container = Docsify.dom.getNode('#main')
const scripts = Docsify.dom.findAll(container, 'script')
for (let i = scripts.length; i--;) {
const script = scripts[i]
if (script && script.src) {
const newScript = document.createElement('script')
Array.prototype.slice.call(script.attributes).forEach(attribute => {
newScript[attribute.name] = attribute.value
})
script.parentNode.insertBefore(newScript, script)
script.parentNode.removeChild(script)
}
}
}
const install = function (hook) {
hook.doneEach(handleExternalScript)
}
window.$docsify.plugins = [].concat(install, window.$docsify.plugins)
+1 -1
View File
@@ -19,7 +19,7 @@ function init (id) {
function collect () {
init(window.$docsify.ga)
window.ga('set', 'page', location.href)
window.ga('set', 'page', location.hash)
window.ga('send', 'pageview')
}

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