Compare commits

..
368 Commits
Author SHA1 Message Date
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
qingwei.li 0455106a62 -> v3.0.0 2017-02-19 14:40:30 +08:00
qingwei.li 74ce0bf588 bump: 3.0.0 close #78 2017-02-19 14:40:16 +08:00
qingwei.li d355bb4ebe docs: add changeog 2017-02-19 14:38:38 +08:00
qingwei.li dbb92782cf feat(front-matter): add front matter[WIP] 2017-02-19 14:38:38 +08:00
qingwei.li 754f92ce8e fix(search) ignore empty link 2017-02-19 14:38:38 +08:00
qingwei.li fcb66e8bc7 fix(search): escape html 2017-02-19 14:38:38 +08:00
qingwei.li 2efd859f71 fix(search): fix default config 2017-02-19 14:38:38 +08:00
qingwei.li 515331763d docs(plugin): add search doc 2017-02-19 14:38:38 +08:00
qingwei.li 2351c3e68c feat(search): Localization for search placeholder, close #80 2017-02-19 14:38:38 +08:00
qingwei.li 079bd00395 refactor(plugins): update search plugin 2017-02-19 14:38:38 +08:00
qingwei.li 86594a3118 feat(themes): add loading info 2017-02-19 14:38:38 +08:00
qingwei.li a6d823b826 docs(markdown): update markdown config 2017-02-19 14:38:38 +08:00
qingwei.li 7b6a2ac404 fix(render): support html file 2017-02-19 14:38:38 +08:00
qingwei.li 3e7d6ab26c docs: add executeScript demo 2017-02-19 14:38:38 +08:00
qingwei.li 4b64386465 docs: move changelog to history 2017-02-19 14:38:38 +08:00
qingwei.li c7e09c34a7 fix(compiler): link 2017-02-19 14:38:38 +08:00
qingwei.li c108645e34 docs: add autoHeader 2017-02-19 14:38:38 +08:00
qingwei.li b7768b1b3c feat(render): add auto header 2017-02-19 14:38:38 +08:00
qingwei.li fd9c3bd19d docs: update 2017-02-19 14:38:38 +08:00
qingwei.li e2b7b976cf refactor(core): fix route path 2017-02-19 14:38:38 +08:00
qingwei.li 8cae16539d refactor(core): add scroll event 2017-02-19 14:38:38 +08:00
qingwei.li 27e7e749af refactor(core): and cover 2017-02-19 14:38:38 +08:00
qingwei.li fbd51afdcb refactor(core): and sidebar event 2017-02-19 14:38:38 +08:00
qingwei.li fe88c154b0 refactor(core): and markdown compiler 2017-02-19 14:38:38 +08:00
qingwei.li 30da0d5d46 refactor(core): add router 2017-02-19 14:38:38 +08:00
qingwei.li 8bee8f0213 refactor(core): add render 2017-02-19 14:38:38 +08:00
qingwei.li aad62b65f5 refactor(core): adjust directory structure: 2017-02-19 14:38:38 +08:00
qingwei.li e07d36f44e Merge branch 'master' of github.com:QingWei-Li/docsify 2017-02-15 20:02:02 +08:00
qingwei.li 5dcd6d43ea -> v2.4.3 2017-02-15 20:01:11 +08:00
qingwei.li 00e3609b25 bump: 2.4.3 2017-02-15 20:01:07 +08:00
qingwei.li a6d9669bfa docs: update package size 2017-02-15 20:00:56 +08:00
Jintzoandcinwell.li 94255e22b1 Correctly link Get Started (#77)
As `## docsify` is the new title of the `README.md`, *Get Started* should link to that.
2017-02-14 17:11:29 +08:00
Songandcinwell.li 00983ab796 fix emoji replacing error (#76) 2017-02-14 15:47:04 +08:00
qingwei.li 8e203b07ab -> v2.4.2 2017-02-14 10:23:14 +08:00
qingwei.li eff6d21539 bump: 2.4.2 2017-02-14 10:23:08 +08:00
qingwei.li dc536a3930 fix(index): load file path error 2017-02-14 10:22:44 +08:00
qingwei.li cc4ffb4ab7 -> v2.4.1 2017-02-13 23:23:25 +08:00
qingwei.li d62da2034f bump: 2.4.1 2017-02-13 23:23:13 +08:00
qingwei.li dd0c84bb40 fix(index): cover page 2017-02-13 23:21:27 +08:00
qingwei.li 02022af53c -> v2.4.0 2017-02-13 23:08:02 +08:00
qingwei.li 44d7257691 bump: 2.4.0 2017-02-13 23:07:54 +08:00
qingwei.li c6f760275c feat(hook): add doneEach 2017-02-13 23:06:30 +08:00
qingwei.li 558d73c2a8 -> v2.3.0 2017-02-13 22:52:23 +08:00
qingwei.li ec8b17bd43 bump 2.3.0 2017-02-13 22:51:31 +08:00
qingwei.li bf559b44dc fix(render): custom marked renderer 2017-02-13 22:50:49 +08:00
cinwell.liandGitHub 64bb5befeb Merge pull request #73 from QingWei-Li/feat/alias
2.3.0
2017-02-13 22:47:36 +08:00
qingwei.li 6ed8c2a51b Merge branch 'master' into feat/alias 2017-02-13 22:46:41 +08:00
Liu Yuyangandcinwell.li 434e8d1a36 merge marked renderer function instead of overiding it. (#74) 2017-02-13 22:44:43 +08:00
qingwei.li 7c6ab54ba7 docs(en) finish 2017-02-13 22:43:58 +08:00
cinwell.liandGitHub 287b0a6b30 Merge pull request #75 from liril-net/master
Add dark theme
2017-02-13 21:35:13 +08:00
lirilsu d98430cdb6 Add dark theme 2017-02-13 19:59:29 +08:00
qingwei.li 68c70509d1 docs(en) init english documents 2017-02-12 22:22:33 +08:00
qingwei.li 784173e4c8 fix(src): get alias 2017-02-12 22:04:29 +08:00
qingwei.li ce99a04f2e fix(src): get alias 2017-02-12 21:53:38 +08:00
qingwei.li 772972ce60 docs(zh-cn): finish chinese documents 2017-02-12 20:12:36 +08:00
qingwei.li f89d43ef52 docs(readme): add donate 2017-02-12 16:30:45 +08:00
qingwei.li a96c2b0103 doc(zh-cn): update all documents 2017-02-12 15:51:26 +08:00
qingwei.li a866744c45 fix(render): fix render link 2017-02-12 15:45:14 +08:00
qingwei.li 38ea660b78 fix(render): render link 2017-02-12 15:40:22 +08:00
qingwei.li 9e81a5975f feat(hook): support custom plugin 2017-02-12 15:36:46 +08:00
qingwei.li 6f87529256 fix(render): image url 2017-02-12 13:31:53 +08:00
qingwei.li fa54b52048 fix(themes): fix navbar style 2017-02-12 12:52:48 +08:00
qingwei.li 4864d1b26f fix(themes): update navbar style 2017-02-12 12:51:38 +08:00
qingwei.li 324301aaff fix(src): fix route 2017-02-12 08:43:32 +08:00
qingwei.li 6b30eb65eb feat(src): dynamic title and fix sidebar style 2017-02-11 19:04:12 +08:00
qingwei.li 0ff36c22bb fix(event): has no effect on a FF mobile browser, fixed #67 2017-02-11 14:54:02 +08:00
qingwei.li 19b66904fb docs: add alias 2017-02-11 10:21:38 +08:00
qingwei.li 24412cdaf0 feat(src): add alias feature 2017-02-11 10:17:05 +08:00
qingwei.li aedf16e433 -> v2.2.1 2017-02-11 09:39:44 +08:00
qingwei.li 41e4cb1b04 bump: 2.2.1 2017-02-11 09:39:31 +08:00
qingwei.li 9d3cc89aa9 fix(search): crash when not content, fixed #68 2017-02-11 09:36:48 +08:00
qingwei.li 50f5fc2b22 fix(event): scroll active sidebar 2017-02-11 09:36:48 +08:00
qingwei.li 3941304fda fix(search): not work in mobile 2017-02-11 09:36:48 +08:00
D.Yangandcinwell.li be6a97af92 add showcase of Mybatis-Plus (#69)
add a showcase
2017-02-10 16:56:05 +08:00
qingwei.li 55323a38b8 docs(changelog): update 2017-02-09 22:18:55 +08:00
qingwei.li 5b25e7daca -> v2.2.0 2017-02-09 22:17:29 +08:00
qingwei.li a4bd5fd295 bump: 2.2.0 2017-02-09 22:17:23 +08:00
cinwell.liandGitHub ac61bb0e75 feat(plugins): add Google Analytics plugin (#66) 2017-02-09 22:16:15 +08:00
qingwei.li 9605c18fff -> v2.1.0 2017-02-09 21:26:57 +08:00
qingwei.li dc35b051d3 bump: 2.1.0 2017-02-09 21:26:49 +08:00
qingwei.li 0ca1ece188 docs(README): fix typo 2017-02-09 21:24:14 +08:00
qingwei.li fc140ef957 fix(vue.css): update sidebar style 2017-02-09 21:24:14 +08:00
qingwei.li e1da2f8a84 docs(README): add search 2017-02-09 21:24:14 +08:00
qingwei.li eb5ff3e987 feat: add search, close #43 2017-02-09 21:24:14 +08:00
qingwei.li 12e2479014 fix: render name 2017-02-09 21:24:14 +08:00
qingwei.li 168d8475d5 -> v2.0.3 2017-02-07 20:18:28 +08:00
qingwei.li 7ba434e61d bump: 2.0.3 2017-02-07 20:18:25 +08:00
qingwei.li 8cd386ae49 fix: css var polyfill 2017-02-07 20:17:54 +08:00
qingwei.li 8c7e4d7866 fix: rendering emojis 2017-02-07 20:17:12 +08:00
qingwei.li cbaee21ded fix: css var polyfill 2017-02-07 19:54:09 +08:00
qingwei.li 543cbbce81 -> v2.0.2 2017-02-05 14:50:09 +08:00
qingwei.li 72c34152d4 bump: 2.0.2 2017-02-05 14:50:04 +08:00
qingwei.li 44708554f7 fix: button style in cover page 2017-02-05 14:48:57 +08:00
qingwei.li 6e35f6481a docs: update api 2017-02-05 13:53:36 +08:00
qingwei.li 115c80b2f2 -> v2.0.1 2017-02-05 13:50:36 +08:00
qingwei.li addb34d38a bump: 2.0.1 2017-02-05 13:47:32 +08:00
qingwei.li 1f12009a98 fix border style. 2017-02-05 13:47:03 +08:00
qingwei.li 4abcb02824 -> v2.0.0 2017-02-05 10:27:48 +08:00
qingwei.li d45e325d54 bump 2.0 2017-02-05 10:27:42 +08:00
qingwei.li f2f37eec46 Update version number 2017-02-05 10:26:25 +08:00
qingwei.li fef969f55d clean api 2017-02-05 10:26:25 +08:00
qingwei.li 5cc9f0514c feat: customize the theme color 2017-02-05 10:26:25 +08:00
qingwei.li ae1ad735d5 -> v1.10.5 2017-01-28 11:12:26 +08:00
qingwei.li a35a336d00 bump 1.10.5 2017-01-28 11:12:22 +08:00
qingwei.li 3ec7c89bbb fix initialize the Vue instance 2017-01-28 11:11:58 +08:00
qingwei.li 89f0b1fcbd -> v1.10.4 2017-01-27 15:14:23 +08:00
qingwei.li 6f5bb1a527 bump 1.10.4 2017-01-27 15:14:15 +08:00
qingwei.li 98ec020c7a fix execute script 2017-01-27 15:13:51 +08:00
qingwei.li bb13ddd5df -> v1.10.3 2017-01-27 12:45:42 +08:00
qingwei.li e69efb8954 bump 1.10.3 2017-01-27 12:45:16 +08:00
qingwei.li 0e5f28cf60 Add change log 2017-01-27 12:44:54 +08:00
qingwei.li 7db1f1034a Fix sidebar scroll, fixed #63 2017-01-27 12:44:05 +08:00
qingwei.li b0320416a5 compatible vuep, fixed QingWei-Li/vuep/issues/2 2017-01-27 12:01:36 +08:00
qingwei.li 4a77b8a7f3 -> v1.10.2 2017-01-25 21:39:42 +08:00
qingwei.li 00b13c5e86 bump 1.10.2 2017-01-25 21:39:32 +08:00
qingwei.li 82b7b8226d Fix render emojis again 2017-01-25 21:39:12 +08:00
qingwei.li c9739e71af -> v1.10.1 2017-01-25 21:17:54 +08:00
qingwei.li bda1b76ba5 bump 1.10.1 2017-01-25 21:17:43 +08:00
qingwei.li 11f77cd434 Fix render emojis 2017-01-25 21:16:53 +08:00
qingwei.li 6d42c6b04a -> v1.10.0 2017-01-25 15:08:40 +08:00
qingwei.li 46967e73bf bump 1.10.0 2017-01-25 15:08:28 +08:00
qingwei.li ccdc3c855a Support emoji, closed #61 2017-01-25 15:07:36 +08:00
qingwei.li 7c4b0b7c74 -> v1.9.0 2017-01-24 22:31:44 +08:00
qingwei.li 98d1b19bea bump 1.9.0 2017-01-24 22:31:27 +08:00
cinwell.liandGitHub 0709239c77 1.9 (#62)
* Destroys the vue instance when the route is changed

* Add new doc helper

* Update docs
2017-01-24 22:29:50 +08:00
qingwei.li 73cc43c6bd -> v1.8.0 2017-01-24 11:28:15 +08:00
qingwei.li 9d096b03a4 bump 1.8.0 2017-01-24 11:28:04 +08:00
qingwei.li 2af035ff45 Fix fallback sidebar 2017-01-24 10:18:58 +08:00
qingwei.li 3979f5cd3f Update change log 2017-01-24 10:07:14 +08:00
qingwei.li 9abae495ac Execute script when vue exists. 2017-01-24 10:06:38 +08:00
qingwei.li d179ade7df Using v-pre 2017-01-18 16:35:19 +08:00
qingwei.li d79c7655cd Update license 2017-01-18 16:34:05 +08:00
citycideandcinwell.li af5d2934e4 add Trilogy to showcase list (#58) 2017-01-17 08:05:12 +08:00
Antony Jonesandcinwell.li 129bd4d3a0 Add vudash to list of projects using docsify (#57) 2017-01-15 18:45:32 +08:00
qingwei.li abaf5c0849 -> v1.7.4 2017-01-13 23:33:20 +08:00
qingwei.li 336efb30cb bump 1.7.4 2017-01-13 23:33:04 +08:00
qingwei.li fb8bf89d73 Fix bugs caused by the previous version, fixed #56 2017-01-13 23:32:38 +08:00
qingwei.li 8630591bd2 -> v1.7.3 2017-01-13 23:06:31 +08:00
qingwei.li c47ff83073 bump 1.7.3 2017-01-13 23:06:18 +08:00
cinwell.liandGitHub 69e500bd33 Fix repo (#55)
* Fix option is an empty string

* Fix test

* Add hr style #54

* Tweak hr style
2017-01-13 23:05:05 +08:00
qingwei.li 000a1fcdf0 -> v1.7.2 2017-01-12 21:31:40 +08:00
qingwei.li b84544960f bump 1.7.2 2017-01-12 21:31:22 +08:00
qingwei.li 28a004840d Fix sidebar click event in mobile browser 2017-01-12 21:30:33 +08:00
qingwei.li ff44152d12 -> v1.7.1 2017-01-12 20:46:24 +08:00
qingwei.li b6bfad8579 bump 1.7.1 2017-01-12 20:46:04 +08:00
qingwei.li e93f6b95ea Fix sidebar style in mobile browser 2017-01-12 20:45:35 +08:00
qingwei.li 5c58629e69 Fix index.html 2017-01-12 20:34:47 +08:00
qingwei.li 55826691eb -> v1.7.0 2017-01-12 20:30:13 +08:00
qingwei.li 64093c0567 bump 1.7.0 2017-01-12 20:29:45 +08:00
qingwei.li c998fad98e Add docs 2017-01-12 20:28:59 +08:00
qingwei.li 0a2e1ddf11 Tweak active item in sidebar 2017-01-12 20:23:55 +08:00
qingwei.li 4a7df99224 Add name link 2017-01-12 20:16:18 +08:00
qingwei.li 6c6f687925 Merge branch 'feat/data-name' 2017-01-12 19:48:21 +08:00
qingwei.li ddc13aa280 Add changelog 2017-01-12 19:46:59 +08:00
qingwei.li f997280ab1 Fix sticky sidebar 2017-01-12 19:46:28 +08:00
qingwei.li 458e262a26 Tweak style 2017-01-12 18:44:41 +08:00
qingwei.li d971948f10 Add yarn.lock 2017-01-12 18:44:41 +08:00
qingwei.li a309d3041e Update docs 2017-01-12 18:44:41 +08:00
qingwei.li 557a165349 fixed custom cover background, fixed #52 2017-01-12 18:44:41 +08:00
Chao Leeandcinwell.li d9eedf609e add showcase at README.md (#53) 2017-01-12 11:32:45 +08:00
qingwei.li aa939147c6 Add name option 2017-01-11 18:11:49 +08:00
qingwei.li 67c1d0cd7d Add yarn.lock 2017-01-11 16:53:08 +08:00
qingwei.li 06892e6de4 Update docs 2017-01-11 16:22:17 +08:00
qingwei.li 439a1e6841 fixed custom cover background, fixed #52 2017-01-11 16:18:43 +08:00
qingwei.li f540e3c4fc Add bash/markdown highlight 2017-01-10 23:55:58 +08:00
qingwei.li 2ffef062db Update version number 2017-01-10 23:52:32 +08:00
qingwei.li db7db5af8b -> v1.6.1 2017-01-10 23:49:06 +08:00
qingwei.li a418096a29 bump 1.6.1 2017-01-10 23:48:49 +08:00
qingwei.li 90b490c9c1 Fixed sidebar bug when the coverpage exist 2017-01-10 23:48:12 +08:00
qingwei.li 7915027418 -> v1.6.0 2017-01-10 23:34:20 +08:00
qingwei.li 87b373b841 bump 1.6.0 2017-01-10 23:33:41 +08:00
qingwei.li 510ae37a04 Add doc 2017-01-10 23:32:25 +08:00
qingwei.li ef53a07f49 Add new markdown grammar & improve sidebar performance. 2017-01-10 23:16:55 +08:00
qingwei.li 9defe1bf7d -> v1.5.2 2017-01-10 14:40:36 +08:00
qingwei.li b87f6ae5e8 bump 1.5.2 2017-01-10 14:40:21 +08:00
qingwei.li b8b9dbc872 Fixed number at the beginning of the slug, fixed #51 2017-01-10 14:39:40 +08:00
qingwei.li f7779b01d9 -> v1.5.1 2017-01-09 17:50:54 +08:00
qingwei.li 1c935b2fd7 bump 1.5.1 2017-01-09 17:50:43 +08:00
cinwell.liandGitHub 114955558e Remove HTML tag when handling slug, fixed #49 (#50)
* Remove HTML tag when handling slug, fixed #49

* Fix slugify
2017-01-09 17:47:38 +08:00
qingwei.li 847cf3b656 Update readme 2017-01-05 10:33:48 +08:00
Sina Nedadahandehandcinwell.li 356b937d44 Clean up readme (#48)
* Readme/homepage cleanup

* Readme cleanup
2017-01-05 10:31:41 +08:00
qingwei.li 8df57f0bc2 -> v1.5.0 2017-01-04 21:49:51 +08:00
qingwei.li 73dfbf5be3 Update package size 2017-01-04 21:49:16 +08:00
qingwei.li ecba3f1b05 bump 1.5.0 2017-01-04 21:42:40 +08:00
qingwei.li e5452243b1 Update docs 2017-01-04 21:41:35 +08:00
qingwei.li 8b1000a4a5 feat: Markdown parser is configurable, #42 2017-01-04 21:41:08 +08:00
qingwei.li 897283418a init config by window. 2017-01-04 20:47:55 +08:00
qingwei.li 7be6baae7a Fix nav highlight 2017-01-04 20:04:15 +08:00
qingwei.li 24ab3d4d10 Update change log 2017-01-03 15:50:31 +08:00
qingwei.li 424a243c5c Fix slugify 2017-01-03 15:48:57 +08:00
rozboandcinwell.li 9ce47c48af add showcase and edit Development Tips (#47) 2017-01-02 07:31:03 +08:00
qingwei.li 4e7485aa1f Update version 2017-01-01 12:02:06 +08:00
qingwei.li cb592e7bf0 -> v1.4.3 2017-01-01 12:01:36 +08:00
qingwei.li 3c01d1f82d bump 1.4.3 2017-01-01 12:01:23 +08:00
qingwei.li 00253d3148 Tweak style 2017-01-01 12:01:01 +08:00
qingwei.li d23881ba7c Update version 2016-12-31 22:23:47 +08:00
qingwei.li f0a99c0d1d Update change log 2016-12-31 22:06:43 +08:00
qingwei.li b952a3a08c -> v1.4.2 2016-12-31 22:05:10 +08:00
qingwei.li 2bb8641303 bump 1.4.3 2016-12-31 22:04:54 +08:00
qingwei.li 66d7919fa9 Fix href type, fixed #46 2016-12-31 22:04:14 +08:00
qingwei.li 580767bf78 Clear dev.html 2016-12-31 15:12:28 +08:00
qingwei.li d6b996f4c1 Add changelog 2016-12-31 15:07:02 +08:00
qingwei.li b4e0d54d7b Fix menu toggle style 2016-12-31 14:53:27 +08:00
qingwei.li b15b286c5c -> v1.4.1 2016-12-31 14:16:54 +08:00
qingwei.li 5ab86271c2 bump 1.4.1 2016-12-31 14:16:39 +08:00
qingwei.li 9638eee50d fix generate slug, fixed #45 2016-12-31 14:16:15 +08:00
qingwei.li 375a1dd3e1 -> v1.4.0 2016-12-31 13:47:28 +08:00
qingwei.li 3069ad3928 bump 1.4.0 2016-12-31 13:47:16 +08:00
qingwei.li b287f57c86 Add custom cover background 2016-12-31 13:40:29 +08:00
qingwei.li e932ff66b9 max-sub-level => sub-max-level 2016-12-31 11:50:30 +08:00
nsinaandcinwell.li 7a10e4aecf Readme/homepage cleanup 2016-12-31 10:22:31 +08:00
qingwei.li 41e7ef6863 Add docs 2016-12-30 18:09:13 +08:00
qingwei.li 7ce166501b Add render sub menu 2016-12-30 17:58:39 +08:00
qingwei.li b9aeb4a922 Fix scroll highlight when Vue exist 2016-12-27 23:58:26 +08:00
qingwei.li 9ac8293c0a Update docs 2016-12-26 23:47:26 +08:00
qingwei.li aa3121eca2 Bye 🎅 2016-12-25 20:59:08 +08:00
qingwei.li 0e615abbdc -> v1.3.5 2016-12-25 20:13:21 +08:00
qingwei.li cb2b191ba1 bump 1.3.5 2016-12-25 20:13:11 +08:00
qingwei.li 6adcfffba9 fix vue 2016-12-25 20:12:03 +08:00
qingwei.li f165470265 -> v1.3.4 2016-12-25 18:34:14 +08:00
qingwei.li bbb7b4a9d6 bump 1.3.4 2016-12-25 18:33:57 +08:00
qingwei.li 540095ee35 Support vuep 2016-12-25 18:33:12 +08:00
qingwei.li bd354094c0 🎄 Merry Christmas 2016-12-24 20:32:04 +08:00
qingwei.li 6e81e66441 404.dev => dev 2016-12-24 19:50:41 +08:00
qingwei.li 67f9083ff7 Remove 404.html 2016-12-24 19:50:04 +08:00
qingwei.li 383b976ddd Update docs 2016-12-24 11:33:48 +08:00
qingwei.li 54ba970552 -> v1.3.3 2016-12-23 21:47:42 +08:00
qingwei.li 16623c9301 bump 1.3.3 2016-12-23 21:47:31 +08:00
qingwei.li 668c5ca714 fix lint 2016-12-23 21:47:15 +08:00
qingwei.li d0861d7427 Fixed cover rendering timing 2016-12-23 21:46:12 +08:00
qingwei.li 97669e0d28 Add similar projects into readme 2016-12-23 09:25:30 +08:00
qingwei.li a0408b7a38 -> v1.3.2 2016-12-23 01:20:57 +08:00
qingwei.li f917da8214 bump 1.3.2 2016-12-23 01:20:47 +08:00
qingwei.li 64309beee9 Fixed render link 2016-12-23 01:20:28 +08:00
qingwei.li 4c8c0349e6 -> v1.3.1 2016-12-23 00:25:05 +08:00
qingwei.li 91b6720219 bump 1.3.1 2016-12-23 00:24:45 +08:00
qingwei.li c93ba1ea16 Fixed cover page style 2016-12-23 00:24:24 +08:00
qingwei.li 4f5a150c17 update cdn 2016-12-22 01:03:52 +08:00
qingwei.li 801df6ae3e Update changelog
Update changelog
2016-12-22 00:30:30 +08:00
qingwei.li 6c2e7dca99 -> v1.3.0 2016-12-22 00:26:23 +08:00
qingwei.li a39eddba74 bump 1.3.0 2016-12-22 00:26:06 +08:00
cinwell.liandGitHub 50addfdac6 1.3 (#38)
* Add cover page

* Update doc

* Add kbd style, resolve #37

* headling can cliked, resolve #36

* Update change log, close #35

* Update docs
2016-12-22 00:24:54 +08:00
qingwei.li b14fcf7d1c Update readme 2016-12-20 22:34:13 +08:00
qingwei.li 3b02b8fc39 Update features 2016-12-20 22:32:56 +08:00
qingwei.li 039c7a7a6f Remove donate 2016-12-20 22:19:12 +08:00
qingwei.li 0101492dd4 Update doc 2016-12-20 22:04:55 +08:00
qingwei.li 60fc73c691 update cdn 2016-12-20 21:44:02 +08:00
qingwei.li 476d49bc1f -> v1.2.0 2016-12-20 21:20:18 +08:00
qingwei.li 73456e6fac bump 1.2.0 2016-12-20 21:20:08 +08:00
cinwell.liandGitHub f9d75ab931 Feat/1.2 (#33)
* Add homepage option, fixed #30

* Add custom basePath support, resolve #31
2016-12-20 21:18:52 +08:00
qingwei.li f93f9ceb09 Add cdn 2016-12-20 10:20:56 +08:00
qingwei.li b57712dd5a Add .nojekyll 2016-12-19 23:05:47 +08:00
qingwei.li f2d894932b -> v1.1.7 2016-12-19 21:53:42 +08:00
qingwei.li 48912a0b79 bump 1.1.7 2016-12-19 21:53:25 +08:00
qingwei.li 73a193d602 Optimize progress bar 2016-12-19 21:52:33 +08:00
qingwei.li 30b6644f21 fix typo 2016-12-19 20:38:35 +08:00
qingwei.li d343ff5b21 Update badges 2016-12-18 19:43:58 +08:00
qingwei.li 3bf932a81c -> v1.1.6 2016-12-18 15:37:57 +08:00
qingwei.li c8bb66955d bump 1.1.6 2016-12-18 15:37:47 +08:00
qingwei.li e5e1e07e1a Fixed highlight sidebar using chinese ids 2016-12-18 15:37:24 +08:00
cinwell.liandGitHub 9ba989c86c Add logo (#28)
* Fix table style

* Add logo

* Update index.html

* Update doc
2016-12-18 15:30:50 +08:00
qingwei.li ab34cc97f9 -> v1.1.5 2016-12-18 10:50:37 +08:00
qingwei.li 3fbcd876ae bump 1.1.5 2016-12-18 10:50:02 +08:00
qingwei.li 3af5ca5cd4 Correct calculation of whether the mobile browser 2016-12-18 10:49:21 +08:00
qingwei.li 74ee0cf6bc Add table style 2016-12-18 10:37:34 +08:00
qingwei.li 46dd542b48 -> v1.1.4 2016-12-17 16:08:45 +08:00
qingwei.li cc7bdf5df2 bump 1.1.4 2016-12-17 15:56:55 +08:00
qingwei.li 9a1db6ed43 Fix chinese auchor link 2016-12-17 15:56:01 +08:00
qingwei.li 9d30ac7435 -> v1.1.3 2016-12-17 15:38:59 +08:00
qingwei.li f8a68b87c7 bump 1.1.3 2016-12-17 15:38:00 +08:00
qingwei.li 7dc47cc4d4 Optimize progress bar again 2016-12-17 15:37:32 +08:00
qingwei.li 7d995d8362 Update readme 2016-12-17 15:25:03 +08:00
qingwei.li 1fdfaf0b6b -> v1.1.2 2016-12-17 15:18:04 +08:00
qingwei.li fe33e2d506 bump 1.1.2 2016-12-17 15:17:20 +08:00
qingwei.li 6463dd3bae Optimize progress bar again 2016-12-17 15:14:52 +08:00
qingwei.li 299c31dff9 Fix auto2top in mobile 2016-12-17 15:08:44 +08:00
qingwei.li aa1d84b513 1.1.1 2016-12-17 09:07:15 +08:00
qingwei.li 14a4c2f77d bump 1.1.1 2016-12-17 09:01:41 +08:00
qingwei.li e58c17fdc6 Optimize progress bar 2016-12-17 09:01:21 +08:00
qingwei.li 8b719238e6 -> v1.1.0 2016-12-16 22:38:53 +08:00
qingwei.li 7f0b1089c0 bump 1.1.0 2016-12-16 22:38:44 +08:00
cinwell.liandGitHub 2610e25040 Add progress bar and auto2top (#27)
* Add progress bar

* Add abort ajax

* Remove console

* Add cache folder

* Add auto2top
2016-12-16 22:37:21 +08:00
cinwell.li ec53f1e307 Add Beerpay's badge 2016-12-15 19:11:15 +08:00
qingwei.li 670cc68a28 -> v1.0.3 2016-12-13 22:27:36 +08:00
qingwei.li 844ba3e022 bump 1.0.3 2016-12-13 22:27:26 +08:00
qingwei.li 9092b22246 Fix cache sidebar content 2016-12-13 22:26:56 +08:00
qingwei.li d175ba6913 -> v1.0.2 2016-12-13 22:12:18 +08:00
qingwei.li 2574778605 bump 1.0.2 2016-12-13 22:11:50 +08:00
cinwell.liandGitHub 44a255103c Fix/1.0.2 (#25)
* Fix regular expression, fixed #23

* Fix repeat binding events

* Add content cache

* Add changelog
2016-12-13 22:10:58 +08:00
123 changed files with 12634 additions and 1519 deletions
+5 -1
View File
@@ -1,6 +1,10 @@
{
"extends": ["vue"],
"env": {
"browser": true
},
"globals": {
"XMLHttpRequest": true
"Docsify": true,
"$docsify": true
}
}
+1 -1
View File
@@ -1,4 +1,4 @@
.DS_Store
*.log
node_modules
yarn.lock
/themes
+3
View File
@@ -1,3 +1,6 @@
sudo: false
cache:
directories:
- $HOME/.yarn-cache
language: node_js
node_js: stable
-12
View File
@@ -1,12 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<link rel="stylesheet" href="/themes/vue.css">
</head>
<body class="">
<div id="app"></div>
</body>
<script src="/lib/docsify.js" data-repo="qingwei-li/docsify" data-sidebar-toggle data-router data-load-sidebar></script>
</html>
+62 -57
View File
@@ -1,74 +1,79 @@
## 1.0.1
### Bug fixes
- `img` style
## 1.0.0
## Features
- Support hash router
# 3.4.1 / 2017-03-10
### Bug fixes
- Improved scrolling on mobile
* 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)
## 0.7.0
### Breaking change
- `themes/` was removed, only exists in the npm package.
# 3.4.0 / 2017-03-09
### Bug fixes
- Fix style.
- Fix sidebar animation again.
* feat(zoom-image): add plugin
## 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.
# 3.3.0 / 2017-03-07
## 0.6.0
### Features
- Navbar support dropdown list, #6
- Sidebar with toggle
* 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))
### Bug fixes
- Fix ineffective option, fixed #10
# 3.2.0 / 2017-02-28
## 0.5.0
### Features
- Custom sidebars and navbars by markdown file
* 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)
## 0.4.2
### Bug fixes
- Correct catch ajax error
# 3.1.2 / 2017-02-27
## 0.4.1
### Bug fixes
- catch ajax error
* fix(search): dont search nameLink, fixed [#102](https://github.com/QingWei-Li/docsify/issues/102)
## 0.4.0
### Features
- Custom sidebar
# 3.1.1 / 2017-02-24
### Bug fixes
- Fix undefined language
* 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)
## 0.3.1
### Bug fixes
- Strip HTML tag when rendering the headings
# 3.1.0 / 2017-02-22
## 0.3.0
### Features
- Add minified css files
- Add max level option
- Add pure.css
* fix(search): incorrect anchor link, fixed [#90](https://github.com/QingWei-Li/docsify/issues/90)
* feat(emoji): add emoji plugin
## 0.2.1
### Bug fixes
- Fix vue.css
# 3.0.5 / 2017-02-21
## 0.2.0
### Bug fixes
- Fix route
- Remove dynamic title
* 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)
## 0.1.0
### Features
- Add buble.css
# 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`)
+512
View File
@@ -0,0 +1,512 @@
### 2.4.3
> 2017-02-15
#### Bug fixes
* 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
### 2.4.1
> 2017-02-13
#### Bug fixes
* fix(index): cover page
### 2.4.0
> 2017-02-13
#### Features
* feat(hook): add `doneEach`
### 2.3.0
> 2017-02-13
#### Features
* 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
### 2.2.1
> 2017-02-11
#### Bug fixes
* 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>
```
### 2.1.0
#### Features
* 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
### 2.0.3
#### Bug fixes
* fix: rendering emojis
* fix: css var polyfill
### 2.0.2
#### Bug fixes
* fix button style in cover page.
### 2.0.1
#### Bug fixes
* border style.
### 2.0.0
#### Features
* Customize the theme color
#### Break change
* Remove `data-router`, `data-sidebar`, `data-sidebar-toggle` APIs
### 1.10.5
#### Bug fixes
* fix initialize the Vue instance
### 1.10.4
#### Bug fixes
* fix execute script
### 1.10.3
#### Bug fixes
* 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
### 1.10.1
#### Bug fixes
* Fix render emojis
### 1.10.0
#### Features
* Support emoji :laughing:
### 1.9.0
#### Bug fixes
* Destroys the vue instance when the route is changed
#### Features
* Add `!>` and `?>` doc helper.
#### Break change
* Remove `!` doc helper.
### 1.8.0
#### Bug fixes
* Using `v-pre` skip compilation.
### Features
* Execute script when vue exists.
### 1.7.4
#### Bug fixes
* Fix bugs caused by the previous version
### 1.7.3
#### Bug fixes
* Add `hr` style
* Fixed option is an empty string
### 1.7.2
#### Bug fixes
* Fix sidebar click event in mobile browser.
### 1.7.1
#### Bug fixes
* Fix sidebar style in mobile browser.
### 1.7.0
#### Bug fixes
* Fixed custom cover background, fixed [#52](https://github.com/QingWei-Li/docsify/issues/52)
* Fixed sticky sidebar
### Features
* Add `name` and `nameLink`
### 1.6.1
#### Bug fixes
* 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>`
### 1.5.2
#### Bug fixes
* Fixed number at the beginning of the slug
### 1.5.1
#### Bug fixes
* Remove HTML tag when handling slug
### 1.5.0
#### Bug fixes
* Fix slugify.
* Fix nav highlight.
#### Features
* Initialize the configuration by `window.$docsify`.
* Markdown parser is configurable.
### 1.4.3
#### Bug fixes
* Tweak style.
### 1.4.2
#### Bug fixes
* Fix toggle button style.
* Support `mailto`, `tel`, etc. href type
* Fix scroll to top.
### 1.4.1
#### Bug fixes
* Fix generate slug.
### 1.4.0 Happly new year 🎉
#### Features
* Display TOC in the custom sidebar, `data-sub-max-level`.
* Custom background in coverpage.
#### Bug fixes
* Fix scroll highlight when Vue exist.
### 1.3.5
#### Bug fixes
* Fix vue
### 1.3.4
#### Bug fixes
* Supports [vuep](https://github.com/QingWei-Li/vuep)
### 1.3.3
#### Bug fixes
* Fixed cover rendering timing
### 1.3.2
#### Bug fixes
* Fixed render link
### 1.3.1
#### Bug fixes
* 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
#### Bug fixes
* sidebar highlight
#### break change
* Navbar no longer fixed at the top
### 1.2.0
#### Features
* custom basePath
* custom homepage
### 1.1.7
#### Bug fixes
* Optimize progress bar
### 1.1.6
#### Features
* Add logo 😂
#### Bug fixes
* 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
### 1.1.4
#### Bug fixes
* Fixed chinese auchor link
### 1.1.3
#### Bug fixes
* Optimize progress bar again
### 1.1.2
#### Bug fixes
* 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
### 1.0.3
#### Bug fixes
- Fix cache
### 1.0.2
#### Bug fixes
* 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
### 1.0.0
#### Features
* Support hash router
#### Bug fixes
* Improved scrolling on mobile
### 0.7.0
#### Breaking change
* `themes/` was removed, only exists in the npm package.
#### Bug fixes
* 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.
### 0.6.0
#### Features
* Navbar support dropdown list, [#6](https://github.com/QingWei-Li/docsify/issues/6)
* Sidebar with toggle
#### Bug fixes
* Fix ineffective option, fixed [#10](https://github.com/QingWei-Li/docsify/issues/10)
### 0.5.0
#### Features
* Custom sidebars and navbars by markdown file
### 0.4.2
#### Bug fixes
* Correct catch ajax error
### 0.4.1
#### Bug fixes
* catch ajax error
### 0.4.0
#### Features
* Custom sidebar
#### Bug fixes
* Fix undefined language
### 0.3.1
#### Bug fixes
* Strip HTML tag when rendering the headings
### 0.3.0
#### Features
* Add minified css files
* Add max level option
* Add pure.css
### 0.2.1
#### Bug fixes
* Fix vue.css
### 0.2.0
#### Bug fixes
* Fix route
* Remove dynamic title
### 0.1.0
#### Features
* Add buble.css
+1 -1
View File
@@ -1,6 +1,6 @@
MIT License
Copyright (c) 2016 cinwell.li
Copyright (c) 2016 - 2017 cinwell.li
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
+61 -30
View File
@@ -1,62 +1,93 @@
# docsify
[![Build Status](https://travis-ci.org/QingWei-Li/docsify.svg?branch=master)](https://travis-ci.org/QingWei-Li/docsify)
[![npm](https://img.shields.io/npm/v/docsify.svg)](https://www.npmjs.com/package/docsify)
<p align="center">
<a href="https://docsify.js.org">
<img alt="docsify" src="./media/docsify.png">
</a>
</p>
>🃏 A magical documentation site generator.
<p align="center">
A magical documentation site generator.
</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://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
- Easy and lightweight
- Custom themes
- No build
- 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 `404.html` and `README.md` into `/docs`.
404.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">
</head>
<body></body>
<body>
<div id="app"></div>
</body>
<script src="//unpkg.com/docsify"></script>
</html>
```
Or Create a `index.html` and using `hash router`.
## Browser Support
index.html
```html
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="//unpkg.com/docsify/themes/vue.css">
</head>
<body></body>
<script src="//unpkg.com/docsify" data-router></script>
</html>
```
Modern browsers and Internet Explorer 10+.
## Showcase
These open-source projects are using docsify to generate their sites. Pull requests welcome : )
- [docsify](https://docsify.js.org) - A magical documentation site generator.
- [Snipaste](https://docs.snipaste.com/) - A new way to boost your productivity.
These open-source projects are using docsify to generate their sites. Pull requests welcome :blush:
## How to contribute
| 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 |
## Similar projects
| Project | Description |
|---|---|
| [docute](https://github.com/egoist/docute) | 📜 Effortlessly documentation done right |
| [docpress](https://github.com/docpress/docpress) | Documentation website generator |
## Contributing
- Fork it!
- Run `npm i && npm run dev`
- open `localhost:3000`
- Create your feature branch: `git checkout -b my-new-feature`
- Commit your changes: `git commit -am 'Add some feature'`
- Push to the branch: `git push origin my-new-feature`
- Submit a pull request
## Development
```bash
npm i && npm run dev
open http://localhost:3000
```
## License
MIT
+1 -1
View File
@@ -5,7 +5,7 @@ var fs = require('fs')
http.createServer(function (req, res) {
serveStatic('.')(req, res, function () {
res.writeHead(404, { 'Content-Type': 'text/html' })
res.end(fs.readFileSync('404.dev.html'))
res.end(fs.readFileSync('dev.html'))
})
}).listen(3000, '0.0.0.0')
+11 -2
View File
@@ -2,8 +2,17 @@ var fs = require('fs')
var cssnano = require('cssnano').process
var resolve = require('path').resolve
var postcss = require('postcss')
var isProd = process.argv[process.argv.length - 1] !== '--dev'
var processor = postcss([require('postcss-salad')])
var processor = postcss([require('postcss-salad')({
features: {
precss: {
properties: {
preserve: true
}
}
}
})])
var saveMin = function (file, content) {
fs.writeFileSync(resolve(__dirname, '../lib/themes/', file), content)
@@ -26,7 +35,7 @@ list.forEach(function (file) {
.then(function (result) {
save(file, result.css)
console.log('salad - ' + file)
cssnano(loadLib(file))
isProd && cssnano(loadLib(file))
.then(function (result) {
saveMin(file, result.css)
console.log('cssnao - ' + file)
+43 -9
View File
@@ -2,13 +2,20 @@ 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'
var build = function (opts) {
rollup
.rollup({
entry: 'src/' + opts.entry,
plugins: [buble()].concat(opts.plugins || [])
plugins: (opts.plugins || []).concat([
string({ include: '**/*.css' }),
buble(),
commonjs(),
nodeResolve()
])
})
.then(function (bundle) {
var dest = 'lib/' + (opts.output || opts.entry)
@@ -16,7 +23,7 @@ var build = function (opts) {
console.log(dest)
bundle.write({
format: 'iife',
moduleName: opts.moduleName || 'Docsify',
moduleName: opts.moduleName || 'D',
dest: dest
})
})
@@ -26,12 +33,39 @@ var build = function (opts) {
}
build({
entry: 'index.js',
output: 'docsify.js',
plugins: [commonjs(), nodeResolve()]
entry: 'core/index.js',
output: 'docsify.js'
})
build({
entry: 'index.js',
output: 'docsify.min.js',
plugins: [commonjs(), nodeResolve(), uglify()]
var plugins = [
{ name: 'search', entry: 'search/index.js', moduleName: 'Search' },
{ name: 'ga', entry: 'ga.js', moduleName: 'GA' },
{ name: 'emoji', entry: 'emoji.js', moduleName: 'Emoji' },
{ name: 'external-script', entry: 'external-script.js', moduleName: 'ExternalScript' },
{ name: 'front-matter', entry: 'front-matter/index.js', moduleName: 'FrontMatter' },
{ name: 'zoom-image', entry: 'zoom-image.js', moduleName: 'ZoomImage' }
]
plugins.forEach(item => {
build({
entry: 'plugins/' + item.entry,
output: 'plugins/' + item.name + '.js',
moduleName: 'D.' + item.moduleName
})
})
if (isProd) {
build({
entry: 'core/index.js',
output: 'docsify.min.js',
plugins: [uglify()]
})
plugins.forEach(item => {
build({
entry: 'plugins/' + item.entry,
output: 'plugins/' + item.name + '.min.js',
moduleName: 'D.' + item.moduleName,
plugins: [uglify()]
})
})
}
+34
View File
@@ -0,0 +1,34 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>docsify</title>
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<link rel="stylesheet" href="/themes/vue.css" title="vue">
<link rel="stylesheet" href="/themes/dark.css" title="dark" disabled>
<link rel="stylesheet" href="/themes/buble.css" title="buble" disabled>
</head>
<body>
<nav data-cloak>
<a href="#/">EN</a>
<a href="#/zh-cn/">中文</a>
</nav>
<div id="app"></div>
</body>
<script>
window.$docsify = {
alias: {
'/zh-cn/changelog': '/changelog',
'/changelog': 'https://raw.githubusercontent.com/QingWei-Li/docsify/master/CHANGELOG'
},
executeScript: true
}
</script>
<script
src="/lib/docsify.js"
data-name="docsify"
data-base-path="/docs/"
data-load-sidebar
data-sub-max-level="2"
data-auto2top></script>
</html>
View File
+18 -213
View File
@@ -1,222 +1,27 @@
# docsify
## docsify
> A magical documentation site generator.
## What is it
docsify generates your documentation website on the fly. Unlike GitBook, it does not generate static html files. Instead, it smartly loads and parses your Markdown files and displays them as website. All you need to do is create an `index.html` to start and [deploy it on GitHub Pages](/deploy).
See the [Quick start](/quickstart) for more details.
## Features
- Easy and lightweight
- Custom themes
- No build
## Quick Start
* 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+
### Create a project
First create a project, then create a `docs` folder
```shell
mkdir my-project && cd my-project
mkdir docs && cd docs
```
## Examples
### Create entry file
Create a `404.html` file
Check out the [Showcase](https://github.com/QingWei-Li/docsify/#showcase) to docsify in use.
```html
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="//unpkg.com/docsify/themes/vue.css">
</head>
<body>
<div id="app"></div>
</body>
<script src="//unpkg.com/docsify"></script>
</html>
```
## Donate
Create `README.md` as the main page
```
# Title
## balabala
```
### Deploy!
Push and open the **GitHub Pages** feature
![image](https://cloud.githubusercontent.com/assets/7565692/20639058/e65e6d22-b3f3-11e6-9b8b-6309c89826f2.png)
## CLI
Easy to setup and preivew a docs.
### Install
```shell
npm i docsify-cli -g
```
### Setup
Setup a boilerplate docs
```shell
docsify init docs
```
### Preview
Preview and serve your docs using
```shell
docsify serve docs
```
Read more [docsify-cli](https://github.com/QingWei-Li/docsify-cli)
## Themes
Currently available `vue.css` and `buble.css`
```html
<link rel="stylesheet" href="//unpkg.com/docsify/themes/vue.css">
<link rel="stylesheet" href="//unpkg.com/docsify/themes/buble.css">
```
Minified files
```html
<link rel="stylesheet" href="//unpkg.com/docsify/lib/themes/vue.css">
<link rel="stylesheet" href="//unpkg.com/docsify/lib/themes/buble.css">
```
## More
### Multiple pages
If you need other pages, directly create the markdown file, such as `guide.md` is `/guide`.
### Navbar
Code in `404.html`
```html
<nav>
<a href="/docsify/">En</a>
<a href="/docsify/zh-cn">中文</a>
</nav>
```
### Options
#### repo
Display the [GitHub Corner](http://tholman.com/github-corners/) widget.
```html
<script src="//unpkg.com/docsify" data-repo="your/repo"></script>
```
#### max-level
Toc level.
```html
<script src="//unpkg.com/docsify" data-max-level="6"></script>
```
#### el
Root element.
```html
<script src="//unpkg.com/docsify" data-el="#app"></script>
```
#### sidebar-toggle
Sidebar with toggle
```html
<script src="//unpkg.com/docsify" data-sidebar-toggle></script>
```
#### sidebar
Custom sidebar. if it'set, the TOC will be disabeld. Bind global variables on the `data-sidebar`.
![image](https://cloud.githubusercontent.com/assets/7565692/20647425/de5ab1c2-b4ce-11e6-863a-135868f2f9b4.png)
```html
<script>
window.sidebar = [
{ slug: '/', title: 'Home' },
{
slug: '/pageA',
title: 'page A',
children: [
{ slug: '/pageA/childrenB', title: 'children B' }
]
},
{ slug: '/PageC', title: 'Page C' }
]
</script>
<script src="/lib/docsify.js" data-sidebar="sidebar"></script>
```
#### load-sidebar
Load sidebar markdown file. If it is configured, load the current directory `_sidebar.md` by default. If the file isn't exist, sidebar will appear TOC.
```html
<script src="/lib/docsify.js" data-load-sidebar></script>
```
You can specify a file:
```html
<script src="/lib/docsify.js" data-load-sidebar="_sidebar.md"></script>
```
The contents of the file can be:
```markdown
- [Home](/)
- [Installation](/installation)
- Essentials
- [Getting Started](/getting-started)
- [Dynamic Route Matching](/dynamic-matching)
- [Nested Routes](/nested-routes)
- [Programmatic Navigation](/navigation)
- [Named Routes](/named-routes)
- [Named Views](/named-views)
- [Redirect and Alias](/redirect-and-alias)
- [HTML5 History Mode](/history-mode)
```
#### load-navbar
Load navbar markdown file. If it is configured, load the current directory `_navbar.md` by default.
```html
<script src="/lib/docsify.js" data-load-navbar></script>
```
You can specify a file:
```html
<script src="/lib/docsify.js" data-load-navbar="_navbar.md"></script>
```
The contents of the file can be:
```markdown
- [en](/)
- [chinese](/zh-cn)
```
If you write a sub level list, it will generate a dropdown list.
```markdown
- [download](/download)
- language
- [en](/)
- [chinese](/zh-cn)
```
### router
Hash router. You can replace `404.html` with `index.html`.
```html
<script src="/lib/docsify.js" data-router></script>
```
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:
+13
View File
@@ -0,0 +1,13 @@
![logo](_media/icon.svg)
# docsify <small>3.4</small>
> A magical documentation site generator.
- Simple and lightweight (~16kB gzipped)
- No statically built html files
- Multiple themes
[GitHub](https://github.com/QingWei-Li/docsify/)
[Get Started](#docsify)
Binary file not shown.

After

Width:  |  Height:  |  Size: 82 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 81 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 69 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB

+30
View File
@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="122px" height="94px" viewBox="0 0 122 94" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<!-- Generator: Sketch 41.2 (35397) - http://www.bohemiancoding.com/sketch -->
<title>icon</title>
<desc>Created with Sketch.</desc>
<defs>
<path d="M144.453286,104 C177.038086,104 203.453286,77.5848002 203.453286,45 C203.453286,12.4151998 177.038086,-14 144.453286,-14 C111.868486,-14 114.603207,13.6754846 114.603207,46.2602848 C114.603207,78.845085 111.868486,104 144.453286,104 Z" id="path-1"></path>
<filter x="-50%" y="-50%" width="200%" height="200%" filterUnits="objectBoundingBox" id="filter-2">
<feOffset dx="7" dy="-10" in="SourceAlpha" result="shadowOffsetInner1"></feOffset>
<feComposite in="shadowOffsetInner1" in2="SourceAlpha" operator="arithmetic" k2="-1" k3="1" result="shadowInnerInner1"></feComposite>
<feColorMatrix values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.1 0" type="matrix" in="shadowInnerInner1"></feColorMatrix>
</filter>
</defs>
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="icon" transform="translate(-98.000000, 2.000000)">
<g id="body" transform="translate(159.000000, 45.000000) rotate(-90.000000) translate(-159.000000, -45.000000) ">
<use fill="#2ECE53" fill-rule="evenodd" xlink:href="#path-1"></use>
<use fill="black" fill-opacity="1" filter="url(#filter-2)" xlink:href="#path-1"></use>
<use stroke="#0E1320" stroke-width="4" xlink:href="#path-1"></use>
</g>
<circle id="left-eye" fill="#000000" cx="139" cy="38" r="7"></circle>
<circle id="right-eye" fill="#000000" cx="183" cy="38" r="7"></circle>
<g id="light" transform="translate(112.000000, 10.000000)" fill="#FFFFFF">
<circle cx="2" cy="28" r="2"></circle>
<path d="M12.2551528,-1.65016666 C12.1154537,-2.17684986 12.4455583,-2.60381096 13.011574,-2.60381096 L14.9928363,-2.60381096 C15.5502953,-2.60381096 16.1214654,-2.16566487 16.2594657,-1.64268776 C16.2594657,-1.64268776 17.4280152,2.48668594 17.9030739,6.45786647 C18.3781327,10.429047 18.3171359,10.4652901 18.3171359,12.1782569 C18.3171359,16.9413523 16.2076398,26.4389164 16.2076398,26.4389164 C16.0941814,26.9676035 15.558852,27.396189 14.9928363,27.396189 L13.011574,27.396189 C12.454115,27.396189 12.1166642,26.9691757 12.2568366,26.4301177 C12.2568366,26.4301177 13.4260575,22.2288768 13.9640759,17.9859148 C14.5020943,13.7429529 14.309594,15.2982629 14.5626609,12.3723978 C14.9355337,8.06138047 12.2551528,-1.65016666 12.2551528,-1.65016666 Z" id="light-line" transform="translate(15.271433, 12.396189) scale(-1, 1) rotate(-48.000000) translate(-15.271433, -12.396189) "></path>
</g>
<path d="M159.5,78.3050108 C169.164983,78.3050108 177,70.4699939 177,60.8050108 C177,51.1400277 169.688728,56.4616841 160.023745,56.4616841 C150.358762,56.4616841 142,51.1400277 142,60.8050108 C142,70.4699939 149.835017,78.3050108 159.5,78.3050108 Z" id="mouth" fill="#000000"></path>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 3.2 KiB

+22
View File
@@ -0,0 +1,22 @@
- Getting started
- [Quick start](/quickstart)
- [Writing more pages](/more-pages)
- [Custom navbar](/custom-navbar)
- [Cover page](/cover)
- Customization
- [Configuration](/configuration)
- [Themes](/themes)
- [List of Plugins](/plugins)
- [Write a Plugin](/write-a-plugin)
- [Markdown configuration](/markdown)
- [Language highlighting](/language-highlight)
- Guide
- [Deploy](/deploy)
- [Helpers](/helpers)
- [Vue compatibility](/vue)
- [CDN](/cdn)
- [Offline Mode(PWA)](/pwa)
- [Changelog](/changelog)
+47
View File
@@ -0,0 +1,47 @@
# CDN
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">
<!-- load script -->
<script src="//unpkg.com/docsify/lib/docsify.js"></script>
```
Alternatively, use [compressed files](#compressed-files).
## Specific version
```html
<!-- load css -->
<link rel="stylesheet" href="//unpkg.com/docsify@2.0.0/themes/vue.css">
<!-- load script -->
<script src="//unpkg.com/docsify@2.0.0/lib/docsify.js"></script>
```
## Compressed file
```html
<!-- load css -->
<link rel="stylesheet" href="//unpkg.com/docsify/lib/themes/vue.css">
<!-- load script -->
<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.
+297
View File
@@ -0,0 +1,297 @@
# Configuration
**docsify** supports two different ways of configuration. You can configure the `window.$docsify` or write configuration on the script tag via `data-*` attributes.
```html
<!-- by $docsify -->
<script>
window.$docsify = {
repo: 'QingWei-Li/docsify',
maxLevel: 3,
coverpage: true
}
</script>
<!-- or data-* -->
<script
src="//unpkg.com/docsify"
data-repo="QingWei-Li/docsify"
data-max-level="3"
data-coverpage>
</script>
```
Both ways are compatible. However, the first way is recommended. It is clear and can be configured in a separate file.
!> In `window.$docsfiy`, the options should be written by camelCase.
## el
- Type: `String`
- Default: `#app`
The DOM element to be mounted on initialization. It can be a CSS selector string or an actual HTMLElement.
```js
window.$docsify = {
el: '#app'
}
```
## repo
- Type: `String`
- Default: `null`
Configure the repository url or a string of `username/repo` can add the [GitHub Corner](http://tholman.com/github-corners/) widget in the top right corner of the site.
```js
window.$docsify = {
repo: 'QingWei-Li/docsify',
// or
repo: 'https://github.com/QingWei-Li/docsify/'
}
```
## max-level
- Type: `Number`
- Default: `6`
Maximum Table of content level.
```js
window.$docsify = {
maxLevel: 4
}
```
## load-navbar
- Type: `Boolean|String`
- Default: `false`
Loads navbar from the Markdown file `_navbar.md` if **true**, or else from the path specified.
```js
window.$docsify = {
// load from _navbar.md
loadNavbar: true,
// load from nav.md
loadNavbar: 'nav.md'
}
```
## load-sidebar
- Type: `Boolean|String`
- Default: `false`
Loads sidebar from the Markdown file `_sidebar.md` if **true**, or else from the path specified.
```js
window.$docsify = {
// load from _sidebar.md
loadSidebar: true,
// load from summary.md
loadSidebar: 'summary.md'
}
```
## sub-max-level
- Type: `Number`
- Default: `0`
Add table of contents (TOC) in custom sidebar.
```js
window.$docsify = {
subMaxLevel: 2
}
```
## auto2top
- Type: `Boolean`
- Default: `false`
Scrolls to the top of the screen when the route is changed.
```js
window.$docsify = {
auto2top: true
}
```
## homepage
- Type: `String`
- Default: `README.md`
`README.md` in your docs folder will be treated as homepage for your website, but sometimes you may need to serve another file as your homepage.
```js
window.$docsify = {
// Change to /home.md
homepage: 'home.md',
// Or use the readme in your repo
homepage: 'https://raw.githubusercontent.com/QingWei-Li/docsify/master/README.md'
}
```
## base-path
- Type: `String`
Base path of the website. You can set it to another directory or another domain name.
```js
window.$docsify = {
basePath: '/path/',
// Load the files from another site
basePath: 'https://docsify.js.org/',
// Even can load files from other repo
basePath: 'https://raw.githubusercontent.com/ryanmcdermott/clean-code-javascript/master/'
}
```
## coverpage
- Type: `Boolean|String`
- Default: `false`
Activate the [cover feature](/cover). If true, it will load from `_coverpage.md`.
```js
window.$docsify = {
coverpage: true,
// Custom file name
coverpage: 'cover.md'
}
```
## name
- Type: `String`
Website name as it appears in the sidebar.
```js
window.$docsify = {
name: 'docsify'
}
```
## name-link
- Type: `String`
- Default: `window.location.pathname`
The name of the link.
```js
window.$docsify = {
nameLink: '/',
// For each route
nameLink: {
'/zh-cn/': '/zh-cn/',
'/': '/'
}
}
```
## markdown
- Type: `Function`
See [Markdown configuration](/markdown).
```js
window.$docsify = {
// object
markdown: {
smartypants: true,
renderer: {
link: function() {
// ...
}
}
},
// function
markdown: function (marked, renderer) {
// ...
return marked
}
}
```
## theme-color
- Type: `String`
Customize the theme color. Use [CSS3 variables](https://developer.mozilla.org/en-US/docs/Web/CSS/Using_CSS_variables) feature and polyfill in old browser.
```js
window.$docsify = {
themeColor: '#3F51B5'
}
```
## alias
- Type: `Object`
Set the route alias. You can freely manage routing rules.
```js
window.$docsify = {
alias: {
'/zh-cn/changelog': '/changelog',
'/changelog': 'https://raw.githubusercontent.com/QingWei-Li/docsify/master/CHANGELOG'
}
}
```
## auto-header
- type: `Boolean`
If `loadSidebar` and `autoHeader` are both enabled, for each link in `_sidebar.md`, prepend a header to the page before converting it to html. Compare [#78](https://github.com/QingWei-Li/docsify/issues/78).
```js
window.$docsify = {
loadSidebar: true,
autoHeader: true
}
```
## execute-script
- type: `Boolean`
Execute the script on the page. Only parse the first script tag([demo](themes)). If Vue is present, it is turned on by default.
```js
window.$docsify = {
executeScript: true
}
```
```markdown
## This is test
<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?id=external-script) plugin.
+56
View File
@@ -0,0 +1,56 @@
# Cover
Activate the cover feature by setting `coverpage` to **true**, compare [coverpage configuration](configuration#coverpage).
## Basic usage
Set `coverpage` to **true**, and create a `_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>
> A magical documentation site generator.
- Simple and lightweight (~16kB gzipped)
- No statically built html files
- Multiple themes
[GitHub](https://github.com/QingWei-Li/docsify/)
[Get Started](#docsify)
```
!> 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 a background image:
```markdown
<!-- _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)
```
+95
View File
@@ -0,0 +1,95 @@
# Custom navbar
## 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>
<a href="#/zh-cn/">中文</a>
</nav>
<div id="app"></div>
</body>
```
## 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#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](/)
- [chinese](/zh-cn/)
```
!> You need to create a `.nojekyll` in `./docs` to prevent GitHub Pages from ignoring files that begin with an underscore.
`_navbar.md` is loaded from each level directory. If the current directory doesn't have `_navbar.md`, it will fall back to the parent directory. If, for example, the current path is `/guide/quick-start`, the `_navbar.md` will be loaded from `/guide/_navbar.md`.
## 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)
- Configuration
- [Configuration](/configuration)
- [Themes](/themes)
- [Using plugins](/plugins)
- [Markdown configuration](/markdown)
- [Language highlight](/language-highlight)
```
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/)
```
+33
View File
@@ -0,0 +1,33 @@
# Deploy
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 for your Github repository:
* `docs/` folder
* master branch
* gh-pages branch
It is recommended that you save your files to the `./docs` subfolder of the `master` branch of your repository. Then select `master branch /docs folder` as your Github Pages source in your repositories' settings page.
![github pages](_images/deploy-github-pages.png)
!> You can also save files in the root directory and select `master branch`.
## VPS
Try following 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 @@
# Doc helper
docsify extends Markdown syntax to make your documents more readable.
## important content
Important content like:
```markdown
!> **Time** is money, my friend!
```
is rendered as:
!> **Time** is money, my friend!
## General tips
General tips like:
```markdown
?> *TODO* unit test
```
are rendered as:
?> *TODO* unit test
+33 -10
View File
@@ -2,22 +2,45 @@
<html lang="en">
<head>
<meta charset="UTF-8">
<title>docsify - A magical documentation site generator.</title>
<title>docsify</title>
<link rel="icon" href="_media/favicon.ico">
<meta name="keywords" content="doc,docs,documentation,gitbook,creator,generator,github,jekyll,github-pages">
<meta name="description" content="A magical documentation generator.">
<meta name="google-site-verification" content="6t0LoIeFksrjF4c9sqUEsVXiQNxLp2hgoqo0KryT-sE" />
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<link rel="stylesheet" href="//unpkg.com/docsify/lib/themes/vue.css">
<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>
</head>
<body>
<nav>
<nav data-cloak>
<a href="#/">En</a>
<a href="#/zh-cn">中文</a>
<a href="#/zh-cn/">中文</a>
</nav>
<div id="app"></div>
</body>
<script
src="//unpkg.com/docsify/lib/docsify.min.js"
data-repo="qingwei-li/docsify"
data-max-level="3"
data-sidebar-toggle
data-router></script>
<script>
window.$docsify = {
name: 'docsify',
maxLevel: 4,
subMaxLevel: 2,
auto2top: true,
coverpage: true,
loadSidebar: true,
executeScript: true,
alias: {
'/zh-cn/changelog': '/changelog',
'/changelog': 'https://raw.githubusercontent.com/QingWei-Li/docsify/master/CHANGELOG'
}
}
if (typeof navigator.serviceWorker !== 'undefined') {
navigator.serviceWorker.register('sw.js')
}
</script>
<script src="//unpkg.com/docsify/lib/docsify.min.js"></script>
<script src="//unpkg.com/docsify/lib/plugins/search.min.js"></script>
<script src="//unpkg.com/prismjs/components/prism-bash.min.js"></script>
<script src="//unpkg.com/prismjs/components/prism-markdown.min.js"></script>
<script src="//unpkg.com/prismjs/components/prism-nginx.min.js"></script>
</html>
+11
View File
@@ -0,0 +1,11 @@
# language highlight
**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/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>
```
?> Check the [component files](https://github.com/PrismJS/prism/tree/gh-pages/components) list for more options.
+30
View File
@@ -0,0 +1,30 @@
# Markdown configuration
**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 = {
markdown: {
smartypants: true,
renderer: {
link: function() {
// ...
}
}
}
}
```
?> Configuration Options Reference [marked documentation](https://github.com/chjj/marked#options-1)
Even you can completely customize the parsing rules.
```js
window.$docsify = {
markdown: function(marked, renderer) {
// ...
return marked
}
}
```
+70
View File
@@ -0,0 +1,70 @@
# More pages
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
```
Matching routes
```text
docs/README.md => http://domain.com
docs/guide.md => http://domain.com/guide
docs/zh-cn/README.md => http://domain.com/zh-cn/
docs/zh-cn/guide.md => http://domain.com/zh-cn/guide
```
## Custom sidebar
By default, the table of contents in the sidebar is automatically generated based on your markdown files. If you need a custom sidebar, then you can create your own `_sidebar.md` (see [this documentation's sidebar](https://github.com/QingWei-Li/docsify/blob/master/docs/_sidebar.md) for an example):
First, you need to set `loadSidebar` to **true**. Details are available in the [configuration paragraph](configuration#load-sidebar).
```html
<!-- index.html -->
<script>
window.$docsify = {
loadSidebar: true
}
</script>
<script src="//unpkg.com/docsify/lib/docsify.min.js"></script>
```
Create the `_sidebar.md`:
```markdown
<!-- docs/_sidebar.md -->
- [Home](/)
- [Guide](/guide)
```
!> You need to create a `.nojekyll` in `./docs` to prevent GitHub Pages from ignoring files that begin with an underscore.
`_sidebar.md` is loaded from each level directory. If the current directory doesn't have `_sidebar.md`, it will fall back to the parent directory. If, for example, the current path is `/guide/quick-start`, the `_sidebar.md` will be loaded from `/guide/_sidebar.md`.
## Table of Contents
A custom sidebar can also automatically generate a table of contents by setting a `subMaxLevel`, compare [sub-max-level configuration](configuration#sub-max-level).
```html
<!-- index.html -->
<script>
window.$docsify = {
loadSidebar: true,
subMaxLevel: 2
}
</script>
<script src="//unpkg.com/docsify/lib/docsify.min.js"></script>
```
+95
View File
@@ -0,0 +1,95 @@
# List of Plugins
## Full text search
By default, the hyperlink on the current page is recognized and the content is saved in `localStorage`. You can also specify the path to the files.
```html
<script>
window.$docsify = {
search: 'auto', // default
search : [
'/', // => /README.md
'/guide', // => /guide.md
'/get-started', // => /get-started.md
'/zh-cn/', // => /zh-cn/README.md
],
// complete configuration parameters
search: {
maxAge: 86400000, // Expiration time, the default one day
paths: [], // or 'auto'
placeholder: 'Type to search',
// Localization
placeholder: {
'/zh-cn/': '搜索',
'/': 'Type to search'
},
noData: 'No Results!',
// Localization
noData: {
'/zh-cn/': '找不到结果',
'/': '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
Install the plugin and configure the track id.
```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>
```
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/lib/plugins/front-matter.min.js"></script>
```
## emoji
The default is to support parsing emoji. For example `:100:` will be parsed to :100:. But it is not precise because there is no matching non-emoji string. If you need to correctly parse the emoji string, you need install this plugin.
```html
<script src="//unpkg.com/docsify/lib/plugins/emoji.min.js"></script>
```
## External Script
If the script on the page is an external one (imports a js file via `src` attribute), you'll need this plugin to make it work.
```html
<script src="//unpkg.com/docsify/lib/plugins/external-script.min.js"></script>
```
## Zoom image
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.
+87
View File
@@ -0,0 +1,87 @@
# Quick start
It is recommended to install `docsify-cli` globally, which helps initializing and previewing the website locally.
```bash
npm i docsify-cli -g
```
## Initialize
If you want to write the documentation in the `./docs` subdirectory, you can use the `init` command.
```bash
docsify init ./docs
```
## Writing content
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
You can easily update the documentation in `./docs/README.md`, of course you can add [more pages](more-pages).
## Preview your site
Run the local server with `docsify serve`. You can preview your site in your browser on `http://localhost:3000`.
```bash
docsify serve docs
```
?> For more use cases of `docsify-cli`, head over to the [docsify-cli documentation](https://github.com/QingWei-Li/docsify-cli).
## Manual initialization
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>
<meta charset="UTF-8">
<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>
```
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 dialog
If you want, you can show a loading dialog before docsify starts to render your documentation:
```html
<!-- index.html -->
<div id="app">Please wait...</div>
```
You should set the `data-app` attribute if you changed `el`:
```html
<!-- index.html -->
<div data-app id="main">Please wait...</div>
<script>
window.$docsify = {
el: '#main'
}
</script>
```
Compare [el configuration](/configuration#el).
+84
View File
@@ -0,0 +1,84 @@
/* ===========================================================
* docsify sw.js
* ===========================================================
* Copyright 2016 @huxpro
* Licensed under Apache 2.0
* Register service worker.
* ========================================================== */
const RUNTIME = 'docsify'
const HOSTNAME_WHITELIST = [
self.location.hostname,
'raw.githubusercontent.com',
'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 */ })
)
}
})
+53
View File
@@ -0,0 +1,53 @@
# Themes
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">
```
!> Compressed files are available in `/lib/themes/`.
```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">
```
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>
</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>
+95
View File
@@ -0,0 +1,95 @@
# 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.
## Basic usage
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.
*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>
```
You can manually initialize a Vue instance.
*README.md*
```markdown
# Vue demo
<div>hello {{ msg }}</div>
<script>
new Vue({
el: '#main',
data: { msg: 'Vue' }
})
</script>
```
!> In a Markdown file, only the script within the first script tag is executed.
## Combine Vuep to write playground
[Vuep](https://github.com/QingWei-Li/vuep) is a component for rendering Vue components with live editor and preview. Supports Vue component spec and JSX.
*index.html*
```html
<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*
```markdown
# Vuep
<vuep template="#example"></vuep>
<script type="text/x-template" id="example">
<template>
<div>Hello, {{ name }}!</div>
</template>
<script>
module.exports = {
data: function () {
return { name: 'Vue' }
}
}
</script>
</script>
```
?> 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
})
}
]
}
```
-223
View File
@@ -1,223 +0,0 @@
# docsify
> 无需构建快速生成文档页
## 特性
- 无需构建,写完 markdown 直接发布
- 支持自定义主题
- 容易使用并且轻量
## 快速上手
### 创建项目
新建一个空项目,接着创建一个 `docs` 目录并进入到 docs 目录下
```shell
mkdir my-project && cd my-project
mkdir docs && cd docs
```
### 创建入口文件
创建一个 `404.html` 文件,内容为
```html
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="//unpkg.com/docsify/themes/vue.css">
</head>
<body>
<div id="app"></div>
</body>
<script src="//unpkg.com/docsify"></script>
</html>
```
新建 `README.md` 文件,作为主页面
```
# Title
## balabala
```
### 部署!
将项目 `push` 到 GitHub 仓库后到设置页面开启 **GitHub Pages** 功能,选择 `docs/` 选项
![image](https://cloud.githubusercontent.com/assets/7565692/20639058/e65e6d22-b3f3-11e6-9b8b-6309c89826f2.png)
## 命令行工具
方便快速创建文档目录,会读取项目的 `package.json` 里的选项作为 docsify 的配置,支持本地预览。
### 安装
```shell
npm i docsify-cli -g
```
### 初始化文档
默认初始化在当前目录,推荐将文档放在 `docs` 目录下
```shell
docsify init docs
```
### 启动本地服务
启动一个 server 方便预览,打开 http://localhost:3000
```shell
docsify serve docs
```
更多选项参考 [docsify-cli](https://github.com/QingWei-Li/docsify-cli)
## 主题
目前提供 vue.css 和 buble.css,直接修改 `404.html` 里的 cdn 地址即可
```html
<link rel="stylesheet" href="//unpkg.com/docsify/themes/vue.css">
<link rel="stylesheet" href="//unpkg.com/docsify/themes/buble.css">
```
压缩版
```html
<link rel="stylesheet" href="//unpkg.com/docsify/lib/themes/vue.css">
<link rel="stylesheet" href="//unpkg.com/docsify/lib/themes/buble.css">
```
## 更多功能
### 多页面
`README.md` 作为主页面,如果需要其他页面,直接在文档目录下创建对应的 `*.md` 文件,例如创建一个 `guide.md` 那么对应的路由就是 `/guide`
### 导航
导航需要自己写在 `404.html` 文件里,效果参考本文档
```html
<nav>
<a href="/docsify/">En</a>
<a href="/docsify/zh-cn">中文</a>
</nav>
```
### CDN
目前可用的 CDN 有 [UNPKG](unpkg.com/docsify),如果觉得访问较慢可以将文件放到 Pages 的目录下。
### 配置参数
#### repo
参考本文档的右上角的 GitHub 图标,如果要开启的话,将 `404.html` 里的 script 改成
```html
<script src="//unpkg.com/docsify" data-repo="your/repo"></script>
```
#### max-level
目录最大展开层级,默认值为 6
```html
<script src="//unpkg.com/docsify" data-max-level="6"></script>
```
#### el
替换节点元素,默认为 `#app`
```html
<script src="//unpkg.com/docsify" data-el="#app"></script>
```
#### sidebar-toggle
Sidebar 开关按钮
```html
<script src="//unpkg.com/docsify" data-sidebar-toggle></script>
```
#### sidebar
设置后 TOC 功能将不可用,适合导航较多的文档,`data-sidebar` 传入全局变量名。
![image](https://cloud.githubusercontent.com/assets/7565692/20647425/de5ab1c2-b4ce-11e6-863a-135868f2f9b4.png)
```html
<script>
window.sidebar = [
{ slug: '/', title: 'Home' },
{
slug: '/pageA',
title: 'page A',
children: [
{ slug: '/pageA/childrenB', title: 'children B' }
]
},
{ slug: '/PageC', title: 'Page C' }
]
</script>
<script src="/lib/docsify.js" data-sidebar="sidebar"></script>
```
#### load-sidebar
读取侧边栏配置文件,如果配置,默认加载当前目录下的 `_sidebar.md`。如果文件不存在,会显示 TOC 作为侧边栏内容。如果你有二级目录,也应该放置一份配置文件。
```html
<script src="/lib/docsify.js" data-load-sidebar></script>
```
你可以指定侧边栏文件名
```html
<script src="/lib/docsify.js" data-load-sidebar="_sidebar.md"></script>
```
`_sidebar.md` 的内容可以是这样的
```markdown
- [Home](/)
- [Installation](/installation)
- Essentials
- [Getting Started](/getting-started)
- [Dynamic Route Matching](/dynamic-matching)
- [Nested Routes](/nested-routes)
- [Programmatic Navigation](/navigation)
- [Named Routes](/named-routes)
- [Named Views](/named-views)
- [Redirect and Alias](/redirect-and-alias)
- [HTML5 History Mode](/history-mode)
```
#### load-navbar
读取导航配置文件,如果配置,默认加载当前目录下的 `_navbar.md`。如果文件不存在,会显示 html 里定义的导航栏。
```html
<script src="/lib/docsify.js" data-load-navbar></script>
```
你可以指定导航栏文件名
```html
<script src="/lib/docsify.js" data-load-navbar="_navbar.md"></script>
```
`_navbar.md` 的内容可以是这样
```markdown
- [en](/)
- [中文](/zh-cn)
```
当然也支持二级列表,将生成一个下拉列表
```markdown
- [download](/download)
- language
- [en](/)
- [中文](/zh-cn)
```
### router
开启 hash router 功能,此时可以创建 `index.html` 作为入口文件,同时多页面切换不会重新加载资源。资源路径会被替换成 `/#/` 的形式。
```html
<script src="/lib/docsify.js" data-router></script>
```
+28
View File
@@ -0,0 +1,28 @@
## docsify
> 一个神奇的文档网站生成工具
## 是什么
docsify 是一个动态生成文档网站的工具。不同于 GitBook、Hexo 的地方是它不会生成将 `.md` 转成 `.html` 文件,所有转换工作都是在运行时进行。
这将非常实用,如果只是需要快速的搭建一个小型的文档网站,或者不想因为生成的一堆 `.html` 文件“污染” commit 记录,只需要创建一个 `index.html` 就可以开始写文档而且直接[部署在 GitHub Pages](zh-cn/deploy)。
查看[快速开始](zh-cn/quickstart)了解详情。
## 特性
- 无需构建,写完文档直接发布
- 容易使用并且轻量 (~16kB gzipped)
- 智能的全文搜索
- 提供多套主题
- 丰富的 API
- 支持 Emoji
- 兼容 IE10+
## 例子
可以查看 [Showcase](https://github.com/QingWei-Li/docsify/#showcase) 来了解使用 docsify 的文档项目。
## 捐赠
如果你觉得 docsify 对你有帮助,或者想对我微小的工作一点资瓷,欢迎给我[捐赠](https://github.com/QingWei-Li/donate)。
+22
View File
@@ -0,0 +1,22 @@
- 入门
- [快速开始](zh-cn/quickstart)
- [多页文档](zh-cn/more-pages)
- [定制导航栏](zh-cn/custom-navbar)
- [封面](zh-cn/cover)
- 定制化
- [配置项](zh-cn/configuration)
- [主题](zh-cn/themes)
- [插件列表](zh-cn/plugins)
- [开发插件](zh-cn/write-a-plugin)
- [Markdown 配置](zh-cn/markdown)
- [代码高亮](zh-cn/language-highlight)
- 指南
- [部署](zh-cn/deploy)
- [文档助手](zh-cn/helpers)
- [兼容 Vue](zh-cn/vue)
- [CDN](zh-cn/cdn)
- [离线模式(PWA)](zh-cn/pwa)
- [Changelog](zh-cn/changelog)
+48
View File
@@ -0,0 +1,48 @@
# CDN
推荐使用 [unpkg](//unpkg.com) —— 能及时获取到最新版。
## 获取最新版本
根据 UNPKG 的规则,不指定特定版本号时将引入最新版。
```html
<!-- 引入 css -->
<link rel="stylesheet" href="//unpkg.com/docsify/themes/vue.css">
<!-- 引入 script -->
<script src="//unpkg.com/docsify/lib/docsify.js"></script>
```
## 获取指定版本
如果担心频繁地版本更新又可能引入未知 Bug,我们也可以使用具体的版本。规则是 `//unpkg.com/docsify@VERSION/`
```html
<!-- 引入 css -->
<link rel="stylesheet" href="//unpkg.com/docsify@2.0.0/themes/vue.css">
<!-- 引入 script -->
<script src="//unpkg.com/docsify@2.0.0/lib/docsify.js"></script>
```
!> 指定 *VERSION*`latest` 可以强制每次都请求最新版本。
## 压缩版
CSS 的压缩文件位于 `/lib/themes/` 目录下
```html
<link rel="stylesheet" href="//unpkg.com/docsify/lib/themes/vue.css">
```
JS 的压缩文件是原有文件路径的基础上加 `.min`后缀
```html
<script src="//unpkg.com/docsify/lib/docsify.min.js"></script>
```
## 其他 CDN
[jsDelivr](http://www.jsdelivr.com/projects/docsify) 也是可用的,具体用法参考其文档。
+307
View File
@@ -0,0 +1,307 @@
# 配置项
docsify 有两种配置参数的方式。一种是配置在 `window.$docsify` 里,另一种是给 `script` 标签添加 `data-*` 属性。
```html
<!-- 方法 1 -->
<script>
window.$docsify = {
repo: 'QingWei-Li/docsify',
maxLevel: 3,
coverpage: true
}
</script>
<!-- 方法 2 -->
<script
src="//unpkg.com/docsify"
data-repo="QingWei-Li/docsify"
data-max-level="3"
data-coverpage>
</script>
```
两种方式可以共存,推荐第一种做法——直接配置 `window.$docsify` 对象——这会让你的配置更加清晰,同时也可以方便的将配置单独写到另一个文件里。
!> 通过 `window.$docsify` 配置属性,需要将属性改成驼峰命名法。通过 `data-*` 属性配置,保持短横线的命名规则。
## el
- 类型:`String`
- 默认值:`#app`
docsify 初始化的挂载元素,可以是一个 CSS 选择器,默认为 `#app` 如果不存在就直接绑定在 `body` 上。
```js
window.$docsify = {
el: '#app'
}
```
## repo
- 类型:`String`
- 默认值: `null`
配置仓库地址或者 `username/repo` 的字符串,会在页面右上角渲染一个 [GitHub Corner](http://tholman.com/github-corners/) 挂件。
```js
window.$docsify = {
repo: 'QingWei-Li/docsify',
// or
repo: 'https://github.com/QingWei-Li/docsify/'
}
```
## max-level
- 类型:`Number`
- 默认值: `6`
默认情况下会抓取文档中所有标题渲染成目录,可配置最大支持渲染的标题层级。
```js
window.$docsify = {
maxLevel: 4
}
```
## load-navbar
- 类型:`Boolean|String`
- 默认值: `false`
加载自定义导航栏,参考[定制导航栏](zh-cn/custom-navbar) 了解用法。设置为 `true` 后会加载 `_navbar.md` 文件,也可以自定义加载的文件名。
```js
window.$docsify = {
// 加载 _navbar.md
loadNavbar: true,
// 加载 nav.md
loadNavbar: 'nav.md'
}
```
## load-sidebar
- 类型:`Boolean|String`
- 默认值: `false`
加载自定义侧边栏,参考[多页文档](zh-cn/more-pages)。设置为 `true` 后会加载 `_sidebar.md` 文件,也可以自定义加载的文件名。
```js
window.$docsify = {
// 加载 _sidebar.md
loadSidebar: true,
// 加载 summary.md
loadSidebar: 'summary.md'
}
```
## sub-max-level
- 类型:`Number`
- 默认值: `0`
自定义侧边栏后默认不会再生成目录,你也可以通过设置生成目录的最大层级开启这个功能。
```js
window.$docsify = {
subMaxLevel: 2
}
```
## auto2top
- 类型:`Boolean`
- 默认值: `false`
切换页面后是否自动跳转到页面顶部。
```js
window.$docsify = {
auto2top: true
}
```
## homepage
- 类型:`String`
- 默认值: `README.md`
设置首页文件加载路径。适合不想将 `README.md` 作为入口文件渲染,或者是文档存放在其他位置的情况使用。
```js
window.$docsify = {
// 入口文件改为 /home.md
homepage: 'home.md',
// 文档和仓库根目录下的 README.md 内容一致
homepage: 'https://raw.githubusercontent.com/QingWei-Li/docsify/master/README.md'
}
```
## base-path
- 类型:`String`
文档加载的根路径,可以是二级路径或者是其他域名的路径。
```js
window.$docsify = {
basePath: '/path/',
// 直接渲染其他域名的文档
basePath: 'https://docsify.js.org/',
// 甚至直接渲染其他仓库 readme
basePath: 'https://raw.githubusercontent.com/ryanmcdermott/clean-code-javascript/master/'
}
```
## coverpage
- 类型:`Boolean|String`
- 默认值: `false`
启用[封面页](/zh-cn/cover)。开启后是加载 `_coverpage.md` 文件,也可以自定义文件名。
```js
window.$docsify = {
coverpage: true,
// 自定义文件名
coverpage: 'cover.md'
}
```
## name
- 类型:`String`
文档标题,会显示在侧边栏顶部。
```js
window.$docsify = {
name: 'docsify'
}
```
## name-link
- 类型:`String`
- 默认值:`window.location.pathname`
点击文档标题后跳转的链接地址。
```js
window.$docsify = {
nameLink: '/',
// 按照路由切换
nameLink: {
'/zh-cn/': '/zh-cn/',
'/': '/'
}
}
```
## markdown
- 类型: `Object|Function`
参考 [Markdown 配置](/zh-cn/markdown)。
```js
window.$docsify = {
// object
markdown: {
smartypants: true,
renderer: {
link: function() {
// ...
}
}
},
// function
markdown: function (marked, renderer) {
// ...
return marked
}
}
```
## theme-color
- 类型:`String`
替换主题色。利用 [CSS3 支持变量](https://developer.mozilla.org/en-US/docs/Web/CSS/Using_CSS_variables)的特性,对于老的浏览器有 polyfill 处理。
```js
window.$docsify = {
themeColor: '#3F51B5'
}
```
## alias
- 类型:`Object`
定义路由别名,可以更自由的定义路由规则。
```js
window.$docsify = {
alias: {
'/zh-cn/changelog': '/changelog',
'/changelog': 'https://raw.githubusercontent.com/QingWei-Li/docsify/master/CHANGELOG'
}
}
```
## auto-header
- 类型:`Boolean`
同时设置 `loadSidebar``autoHeader` 后,可以根据 `_sidebar.md` 的内容自动为每个页面增加标题。[#78](https://github.com/QingWei-Li/docsify/issues/78)
```js
window.$docsify = {
loadSidebar: true,
autoHeader: true
}
```
## execute-script
- 类型:`Boolean`
执行文档里的 script 标签里的脚本,只执行第一个 script ([demo](zh-cn/themes))。 如果 Vue 存在,则自动开启。
```js
window.$docsify = {
executeScript: true
}
```
```markdown
## This is test
<script>
console.log(2333)
</script>
```
注意如果执行的是一个外链脚本,比如 jsfiddle 的内嵌 demo,请确保引入 [external-script](zh-cn/plugins?id=外链脚本-external-script) 插件。
+58
View File
@@ -0,0 +1,58 @@
# 封面
通过设置 `coverpage` 参数,可以开启渲染封面的功能。具体用法见[配置项#coverpage](zh-cn/configuration#coverpage)。
## 基本用法
封面的生成同样是从 markdown 文件渲染来的。开启渲染封面功能后在文档根目录创建 `_coverpage.md` 文件。渲染效果如本文档。
*index.html*
```html
<script>
window.$docsify = {
coverpage: true
}
</script>
<script src="//unpkg.com/docsify"></script>
```
*_coverpage.md*
```markdown
![logo](_media/icon.svg)
# docsify
> A magical documentation site generator.
- Simple and lightweight (~12kb gzipped)
- Multiple themes
- Not build static html files
[GitHub](https://github.com/QingWei-Li/docsify/)
[Get Started](#quick-start)
```
!> 一份文档只会在根目录下加载封面,其他页面或者二级目录下都不会加载。
## 自定义背景
目前的背景是随机生成的渐变色,我们自定义背景色或者背景图。在文档末尾用添加图片的 Markdown 语法设置背景。
*_coverpage.md*
```markdown
# docsify
[GitHub](https://github.com/QingWei-Li/docsify/)
[Get Started](#quick-start)
<!-- 背景图片 -->
![](_media/bg.png)
<!-- 背景色 -->
![color](#f0f0f0)
```
+67
View File
@@ -0,0 +1,67 @@
# 自定义导航栏
我们可以直接在 HTML 里定义导航栏,要注意链接要以 `#/` 开头。
*index.html*
```html
<body>
<nav>
<a href="#/">EN</a>
<a href="#/zh-cn/">中文</a>
</nav>
<div id="app"></div>
</body>
```
## 配置文件
那我们可以通过 Markdown 文件来配置导航。首先配置 `loadNavbar`,默认加载的文件为 `_navbar.md`。具体配置规则见[配置项#load-navbar](zh-cn/configuration#load-navbar)。
*index.html*
```html
<script>
window.$docsify = {
loadNavbar: true
}
</script>
<script src="//unpkg.com/docsify"></script>
```
*_navbar.md*
```markdown
- [En](/)
- [中文](/zh-cn/)
```
`_navbar.md` 加载逻辑和 `sidebar` 文件一致,从每层目录下获取。例如当前路由为 `/zh-cn/custom-navbar` 那么是从 `/zh-cn/_navbar.md` 获取导航栏。
## 嵌套
如果导航内容过多,可以写成嵌套的列表,会被渲染成下拉列表的形式。
*_navbar.md*
```markdown
- 基础
- [快速开始](zh-cn/quickstart)
- [多页文档](zh-cn/more-pages)
- [定制导航栏](zh-cn/custom-navbar)
- [封面](zh-cn/cover)
- 配置
- [配置项](zh-cn/configuration)
- [主题](zh-cn/themes)
- [使用插件](zh-cn/plugins)
- [Markdown 配置](zh-cn/markdown)
- [代码高亮](zh-cn/language-highlight)
```
效果图
![嵌套导航栏](_images/zh-cn/nested-navbar.png "嵌套导航栏")
+34
View File
@@ -0,0 +1,34 @@
# 部署
和 GitBook 生成的文档一样,我们可以直接把文档网站部署到 GitHub Pages 或者 VPS 上。
## GitHub Pages
GitHub Pages 支持从三个地方读取文件
- `docs/` 目录
- master 分支
- gh-pages 分支
我们推荐直接将文档放在 `docs/` 目录下,在设置页面开启 **GitHub Pages** 功能并选择 `master branch /docs folder` 选项。
![github pages](_images/deploy-github-pages.png)
!> 可以将文档放在根目录下,然后选择 **master 分支** 作为文档目录。
## VPS
和部署所有静态网站一样,只需将服务器的访问根目录设定为 `index.html` 文件。
例如 nginx 的配置
```nginx
server {
listen 80;
server_name your.domain.com;
location / {
alias /path/to/dir/of/docs;
index index.html;
}
}
```
+26
View File
@@ -0,0 +1,26 @@
# 文档助手
docsify 扩展了一些 Markdown 语法,可以让文档更易读。
## 强调内容
适合显示重要的提示信息,语法为 `!> 内容`
```markdown
!> 一段重要的内容,可以和其他 **Markdown** 语法混用。
```
!> 一段重要的内容,可以和其他 **Markdown** 语法混用。
## 普通提示
普通的提示信息,比如写 TODO 或者参考内容等。
```markdown
?> *TODO* 完善示例
```
?> *TODO* 完善示例
+11
View File
@@ -0,0 +1,11 @@
# 代码高亮
内置的代码高亮工具是 [Prism](https://github.com/PrismJS/prism),默认支持 CSS、JavaScript 和 HTML。如果需要高亮其语言——例如 PHP——可以手动引入代码高亮插件。
```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>
```
?> 其他的语言高亮插件可以查看[Prims 仓库](https://github.com/PrismJS/prism/tree/gh-pages/components)。
+30
View File
@@ -0,0 +1,30 @@
# Markdown 配置
内置的 Markdown 解析器是 [marked](https://github.com/chjj/marked),可以修改它的配置。同时可以直接配置 `renderer`
```js
window.$docsify = {
markdown: {
smartypants: true,
renderer: {
link: function() {
// ...
}
}
}
}
```
?> 完整配置参数参考 [marked 文档](https://github.com/chjj/marked#options-1)
当然也可以完全定制 Markdown 解析规则。
```js
window.$docsify = {
markdown: function(marked, renderer) {
// ...
return marked
}
}
```
+66
View File
@@ -0,0 +1,66 @@
# 多页文档
如果需要创建多个页面,或者需要多级路由的网站,在 docsify 里也能很容易的实现。例如创建一个 `guide.md` 文件,那么对应的路由就是 `/#/guide`
假设你的目录结构如下:
```text
-| docs/
-| README.md
-| guide.md
-| zh-cn/
-| README.md
-| guide.md
```
那么对应的访问页面将是
```text
docs/README.md => http://domain.com
docs/guide.md => http://domain.com/guide
docs/zh-cn/README.md => http://domain.com/zh-cn/
docs/zh-cn/guide.md => http://domain.com/zh-cn/guide
```
## 定制侧边栏
默认情况下,侧边栏会根据当前文档的标题生成目录。也可以设置文档链接,通过 Markdown 文件生成,效果如当前的文档的侧边栏。
首先配置 `loadSidebar` 选项,具体配置规则见[配置项#load-sidebar](zh-cn/configuration#load-sidebar)。
```html
<script>
window.$docsify = {
loadSidebar: true
}
</script>
<script src="//unpkg.com/docsify"></script>
```
接着创建 `_sidebar.md` 文件,内容如下
```markdown
- [首页](zh-cn/)
- [指南](zh-cn/guide)
```
!> 需要在文档根目录创建 `.nojekyll` 命名的空文件,阻止 GitHub Pages 忽略命名是下划线开头的文件。
`_sidebar.md` 的加载逻辑是从每层目录下获取文件,如果当前目录不存在该文件则回退到上一级目录。例如当前路径为 `/zh-cn/more-pages` 则从 `/zh-cn/_sidebar.md` 获取文件,如果不存在则从 `/_sidebar.md` 获取。
## 显示目录
自定义侧边栏同时也可以开启目录功能。设置 `subMaxLevel` 配置项,具体介绍见 [配置项#sub-max-level](zh-cn/configuration#sub-max-level)。
```html
<script>
window.$docsify = {
loadSidebar: true,
subMaxLevel: 2
}
</script>
<script src="//unpkg.com/docsify"></script>
```
+89
View File
@@ -0,0 +1,89 @@
# 插件列表
## 全文搜索 - Search
全文搜索插件会根据当前页面上的超链接获取文档内容,在 `localStorage` 内建立文档索引。默认过期时间为一天,当然我们可以自己指定需要缓存的文件列表或者配置过期时间。
```html
<script>
window.$docsify = {
search: 'auto', // 默认值
search : [
'/', // => /README.md
'/guide', // => /guide.md
'/get-started', // => /get-started.md
'/zh-cn/', // => /zh-cn/README.md
],
// 完整配置参数
search: {
maxAge: 86400000, // 过期时间,单位毫秒,默认一天
paths: [], // or 'auto'
placeholder: 'Type to search',
// 支持本地化
placeholder: {
'/zh-cn/': '搜索',
'/': 'Type to search'
},
noData: 'No Results!',
// 支持本地化
noData: {
'/zh-cn/': '找不到结果',
'/': 'No Results'
}
}
}
</script>
<script src="//unpkg.com/docsify"></script>
<script src="//unpkg.com/docsify/lib/plugins/search.js"></script>
```
## 谷歌统计 - Google Analytics
需要配置 track id 才能使用。
```html
<script>
window.$docsify = {
ga: 'UA-XXXXX-Y'
}
</script>
<script src="//unpkg.com/docsify"></script>
<script src="//unpkg.com/docsify/lib/plugins/ga.js"></script>
```
也可以通过 `data-ga` 配置 id。
```html
<script src="//unpkg.com/docsify" data-ga="UA-XXXXX-Y"></script>
<script src="//unpkg.com/docsify/lib/plugins/ga.js"></script>
```
## emoji
默认是提供 emoji 解析的,能将类似 `:100:` 解析成 :100:。但是它不是精准的,因为没有处理非 emoji 的字符串。如果你需要正确解析 emoji 字符串,你可以引入这个插件。
```html
<script src="//unpkg.com/docsify/lib/plugins/emoji.js"></script>
```
## 外链脚本 - External Script
如果文档里的 script 是内联脚本,可以直接执行;而如果是外链脚本(即 js 文件内容由 `src` 属性引入),则需要使用此插件。
```html
<script src="//unpkg.com/docsify/lib/plugins/external-script.js"></script>
```
## 图片缩放 - Zoom image
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 体验一下。
+83
View File
@@ -0,0 +1,83 @@
# 快速开始
推荐安装 `docsify-cli` 工具,可以方便创建及本地预览文档网站。
```bash
npm i docsify-cli -g
```
## 初始化项目
如果想在项目的 `./docs` 目录里写文档,直接通过 `init` 初始化项目。
```bash
docsify init ./docs
```
## 开始写文档
初始化成功后,可以看到 `./docs` 目录下创建的几个文件
- `index.html` 入口文件
- `README.md` 会做为主页内容渲染
- `.nojekyll` 用于阻止 GitHub Pages 会忽略掉下划线开头的文件
直接编辑 `docs/README.md` 就能更新网站内容,当然也可以[写多个页面](zh-cn/more-pages)。
## 本地预览网站
运行一个本地服务器通过 `docsify serve` 可以方便的预览效果,而且提供 LiveReload 功能,可以让实时的预览。默认访问 http://localhost:3000 。
```bash
docsify serve docs
```
?> 更多命令行工具用法,参考 [docsify-cli 文档](https://github.com/QingWei-Li/docsify-cli)。
## 手动初始化
如果不喜欢 npm 或者觉得安装工具太麻烦,我们其实只需要直接创建一个 `index.html` 文件。
*index.html*
```html
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="//unpkg.com/docsify/themes/vue.css">
</head>
<body>
<div id="app"></div>
</body>
<script src="//unpkg.com/docsify"></script>
</html>
```
如果系统里安装 Python 的话,也可以很轻易的启动一个静态服务器。
```bash
cd docs && python -m SimpleHTTPServer 3000
```
## Loading 提示
初始化时会显示 `Loading...` 内容,你可以自定义提示信息。
*index.html*
```html
<div id="app">加载中</div>
```
如果更改了 `el` 的配置,需要将该元素加上 `data-app` 属性。
*index.html*
```html
<div data-app id="main">加载中</div>
<script>
window.$docsify = {
el: '#main'
}
</script>
```
+47
View File
@@ -0,0 +1,47 @@
# 主题
目前提供三套主题可供选择,模仿 [Vue](//vuejs.org) 和 [buble](//buble.surge.sh) 官网订制的主题样式。还有 [@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">
```
!> CSS 的压缩文件位于 `/lib/themes/`
如果你有其他想法或者想开发别的主题,欢迎提 [PR](https://github.com/QingWei-Li/docsify/pulls)。
#### 点击切换主题
<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>
</div>
<style>
.demo-theme-preview a {
padding-right: 10px;
}
.demo-theme-preview a:hover {
text-decoration: underline;
cursor: pointer;
}
</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>
+87
View File
@@ -0,0 +1,87 @@
# 兼容 Vue
你可以直接在 Markdown 文件里写 Vue 代码,它将被执行。我们可以用它写一些 Vue 的 Demo 或者示例代码。
## 基础用法
`index.html` 里引入 Vue。
```html
<script src="//unpkg.com/vue"></script>
<script src="//unpkg.com/docsify"></script>
```
接着就可以愉快地在 Markdown 里写 Vue 了。默认会执行 `new Vue({ el: '#main' })` 创建示例。
*README.md*
```markdown
# Vue 介绍
`v-for` 的用法
```html
<ul>
<li v-for="i in 10">{{ i }}</li>
</ul>
``
<ul>
<li v-for="i in 10">{{ i }}</li>
</ul>
```
当然你也可以手动初始化 Vue,这样你可以自定义一些配置。
*README.md*
```markdown
# Vue 的基本用法
<div>hello {{ msg }}</div>
<script>
new Vue({
el: '#main',
data: { msg: 'Vue' }
})
</script>
```
!> 一个 Markdown 文件里只有第一个 `script` 标签内的内容会被执行。
## 搭配 Vuep 写 Playground
[Vuep](https://github.com/QingWei-Li/vuep) 是一个提供在线编辑和预览效果的 Vue 组件,搭配 docsify 可以直接在文档里写 Vue 的示例代码,支持 Vue component spec 和 JSX。
*index.html*
```html
<script src="//unpkg.com/vue"></script>
<script src="//unpkg.com/vuep"></script>
<script src="//unpkg.com/docsify"></script>
```
*README.md*
```markdown
# Vuep 使用
<vuep template="#example"></vuep>
<script 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
})
}
]
}
```
+1344 -371
View File
File diff suppressed because it is too large Load Diff
+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
+25
View File
@@ -0,0 +1,25 @@
this.D = this.D || {};
(function () {
'use strict';
function handleExternalScript () {
var container = Docsify.dom.getNode('#main');
var script = Docsify.dom.find(container, 'script');
if (script && script.src) {
var newScript = document.createElement('script');['src', 'async', 'defer'].forEach(function (attribute) {
newScript[attribute] = script[attribute];
});
script.parentNode.removeChild(script);
container.appendChild(newScript);
}
}
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 i(){var i=Docsify.dom.getNode("#main"),n=Docsify.dom.find(i,"script");if(n&&n.src){var c=document.createElement("script");["src","async","defer"].forEach(function(i){c[i]=n[i]}),n.parentNode.removeChild(n),i.appendChild(c)}}var n=function(n){n.doneEach(i)};window.$docsify.plugins=[].concat(n,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
+41
View File
@@ -0,0 +1,41 @@
this.D = this.D || {};
(function () {
'use strict';
// From https://github.com/egoist/vue-ga/blob/master/src/index.js
function appendScript () {
var script = document.createElement('script');
script.async = true;
script.src = 'https://www.google-analytics.com/analytics.js';
document.body.appendChild(script);
}
function init (id) {
if (!window.ga) {
appendScript();
window.ga = window.ga || function () {
(window.ga.q = window.ga.q || []).push(arguments);
};
window.ga.l = Number(new Date());
window.ga('create', id, 'auto');
}
}
function collect () {
init(window.$docsify.ga);
window.ga('set', 'page', location.href);
window.ga('send', 'pageview');
}
var install = function (hook) {
if (!window.$docsify.ga) {
console.error('[Docsify] ga is required.');
return
}
hook.beforeEach(collect);
};
window.$docsify.plugins = [].concat(install, window.$docsify.plugins);
}());
+1
View File
@@ -0,0 +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)}();
+290
View File
@@ -0,0 +1,290 @@
this.D = this.D || {};
(function () {
'use strict';
var INDEXS = {};
var helper;
function escapeHtml (string) {
var entityMap = {
'&': '&amp;',
'<': '&lt;',
'>': '&gt;',
'"': '&quot;',
'\'': '&#39;',
'/': '&#x2F;'
};
return String(string).replace(/[&<>"'\/]/g, function (s) { return entityMap[s]; })
}
function getAllPaths () {
var paths = [];
helper.dom.findAll('a:not([data-nosearch])')
.map(function (node) {
var href = node.href;
var originHref = node.getAttribute('href');
var path = helper.route.parse(href).path;
if (path &&
paths.indexOf(path) === -1 &&
!helper.route.isAbsolutePath(originHref)) {
paths.push(path);
}
});
return paths
}
function saveData (maxAge) {
localStorage.setItem('docsify.search.expires', Date.now() + maxAge);
localStorage.setItem('docsify.search.index', JSON.stringify(INDEXS));
}
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: slugify(token.text) });
index[slug] = { slug: slug, title: token.text, body: '' };
} else {
if (!slug) { return }
if (!index[slug]) {
index[slug] = { slug: slug, title: '', body: '' };
} else {
if (index[slug].body) {
index[slug].body += '\n' + (token.text || '');
} else {
index[slug].body = token.text;
}
}
}
});
slugify.clear();
return index
}
function search (keywords) {
var matchingResults = [];
var data = [];
Object.keys(INDEXS).forEach(function (key) {
data = data.concat(Object.keys(INDEXS[key]).map(function (page) { return INDEXS[key][page]; }));
});
keywords = keywords.trim().split(/[\s\-\\\/]+/);
var loop = function ( i ) {
var post = data[i];
var isMatch = false;
var resultStr = '';
var postTitle = post.title && post.title.trim();
var postContent = post.body && post.body.trim();
var postUrl = post.slug || '';
if (postTitle && postContent) {
keywords.forEach(function (keyword, i) {
var regEx = new RegExp(keyword, 'gi');
var indexTitle = -1;
var indexContent = -1;
indexTitle = postTitle && postTitle.search(regEx);
indexContent = postContent && postContent.search(regEx);
if (indexTitle < 0 && indexContent < 0) {
isMatch = false;
} else {
isMatch = true;
if (indexContent < 0) { indexContent = 0; }
var start = 0;
var end = 0;
start = indexContent < 11 ? 0 : indexContent - 10;
end = start === 0 ? 70 : indexContent + keyword.length + 60;
if (end > postContent.length) { end = postContent.length; }
var matchContent = '...' +
escapeHtml(postContent)
.substring(start, end)
.replace(regEx, ("<em class=\"search-keyword\">" + keyword + "</em>")) +
'...';
resultStr += matchContent;
}
});
if (isMatch) {
var matchingPost = {
title: escapeHtml(postTitle),
content: resultStr,
url: postUrl
};
matchingResults.push(matchingPost);
}
}
};
for (var i = 0; i < data.length; i++) loop( i );
return matchingResults
}
function init$1 (config, vm) {
helper = Docsify;
var isAuto = config.paths === 'auto';
var isExpired = localStorage.getItem('docsify.search.expires') < Date.now();
INDEXS = JSON.parse(localStorage.getItem('docsify.search.index'));
if (isExpired) {
INDEXS = {};
} else if (!isAuto) {
return
}
var paths = isAuto ? getAllPaths() : config.paths;
var len = paths.length;
var count = 0;
paths.forEach(function (path) {
if (INDEXS[path]) { return count++ }
helper
.get(vm.$getFile(path))
.then(function (result) {
INDEXS[path] = genIndex(path, result);
len === ++count && saveData(config.maxAge);
});
});
}
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 style = dom.create('style', code);
dom.appendTo(dom.head, style);
}
function tpl (opts) {
var html =
"<input type=\"search\" />" +
'<div class="results-panel"></div>' +
'</div>';
var el = dom.create('div', html);
var aside = dom.find('aside');
dom.toggleClass(el, 'search');
dom.before(aside, el);
}
function bindEvents () {
var $search = dom.find('div.search');
var $input = dom.find($search, 'input');
var $panel = dom.find($search, '.results-panel');
var doSearch = function (value) {
if (!value) {
$panel.classList.remove('show');
$panel.innerHTML = '';
return
}
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_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);
});
}
function updatePlaceholder (text, path) {
var $input = dom.getNode('.search input[type="search"]');
if (typeof text === 'string') {
$input.placeholder = text;
} else {
var match = Object.keys(text).find(function (key) { return path.indexOf(key) > -1; });
$input.placeholder = text[match];
}
}
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();
tpl(opts);
bindEvents();
}
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
};
var install = function (hook, vm) {
var util = Docsify.util;
var opts = vm.config.search || CONFIG;
if (Array.isArray(opts)) {
CONFIG.paths = opts;
} else if (typeof opts === 'object') {
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';
hook.mounted(function (_) {
init$$1(CONFIG);
!isAuto && init$1(CONFIG, vm);
});
hook.doneEach(function (_) {
update(CONFIG, vm);
isAuto && init$1(CONFIG, vm);
});
};
window.$docsify.plugins = [].concat(install, window.$docsify.plugins);
}());
+1
View File
@@ -0,0 +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 d.dom.findAll("a:not([data-nosearch])").map(function(n){var t=n.href,o=n.getAttribute("href"),a=d.route.parse(t).path;a&&e.indexOf(a)===-1&&!d.route.isAbsolutePath(o)&&e.push(a)}),e}function t(e){localStorage.setItem("docsify.search.expires",Date.now()+e),localStorage.setItem("docsify.search.index",JSON.stringify(g))}function o(e,n){void 0===n&&(n="");var t,o=window.marked.lexer(n),a=window.Docsify.slugify,i=Docsify.route.toURL,r={};return o.forEach(function(n){if("heading"===n.type&&n.depth<=2)t=i(e,{id:a(n.text)}),r[t]={slug:t,title:n.text,body:""};else{if(!t)return;r[t]?r[t].body?r[t].body+="\n"+(n.text||""):r[t].body=n.text:r[t]={slug:t,title:"",body:""}}}),a.clear(),r}function a(n){var t=[],o=[];Object.keys(g).forEach(function(e){o=o.concat(Object.keys(g[e]).map(function(n){return g[e][n]}))}),n=n.trim().split(/[\s\-\\\\/]+/);for(var a=function(a){var i=o[a],r=!1,s="",c=i.title&&i.title.trim(),l=i.body&&i.body.trim(),u=i.slug||"";if(c&&l&&(n.forEach(function(n,t){var o=new RegExp(n,"gi"),a=-1,i=-1;if(a=c&&c.search(o),i=l&&l.search(o),a<0&&i<0)r=!1;else{r=!0,i<0&&(i=0);var u=0,f=0;u=i<11?0:i-10,f=0===u?70:i+n.length+60,f>l.length&&(f=l.length);var p="..."+e(l).substring(u,f).replace(o,'<em class="search-keyword">'+n+"</em>")+"...";s+=p}}),r)){var f={title:e(c),content:s,url:u};t.push(f)}},i=0;i<o.length;i++)a(i);return t}function i(e,a){d=Docsify;var i="auto"===e.paths,r=localStorage.getItem("docsify.search.expires")<Date.now();if(g=JSON.parse(localStorage.getItem("docsify.search.index")),r)g={};else if(!i)return;var s=i?n():e.paths,c=s.length,l=0;s.forEach(function(n){return g[n]?l++:void d.get(a.$getFile(n)).then(function(a){g[n]=o(n,a),c===++l&&t(e.maxAge)})})}function r(){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=h.create("style",e);h.appendTo(h.head,n)}function s(e){var n='<input type="search" /><div class="results-panel"></div></div>',t=h.create("div",n),o=h.find("aside");h.toggleClass(t,"search"),h.before(o,t)}function c(){var e,n=h.find("div.search"),t=h.find(n,"input"),o=h.find(n,".results-panel"),i=function(e){if(!e)return o.classList.remove("show"),void(o.innerHTML="");var n=a(e),t="";n.forEach(function(e){t+='<div class="matching-post">\n <h2><a href="'+e.url+'">'+e.title+"</a></h2>\n <p>"+e.content+"</p>\n</div>"}),o.classList.add("show"),o.innerHTML=t||'<p class="empty">'+y+"</p>"};h.on(n,"click",function(e){return"A"!==e.target.tagName&&e.stopPropagation()}),h.on(t,"input",function(n){clearTimeout(e),e=setTimeout(function(e){return i(n.target.value.trim())},100)})}function l(e,n){var t=h.getNode('.search input[type="search"]');if("string"==typeof e)t.placeholder=e;else{var o=Object.keys(e).find(function(e){return n.indexOf(e)>-1});t.placeholder=e[o]}}function u(e,n){if("string"==typeof e)y=e;else{var t=Object.keys(e).find(function(e){return n.indexOf(e)>-1});y=e[t]}}function f(e){h=Docsify.dom,r(),s(e),c()}function p(e,n){l(e.placeholder,n.route.path),u(e.noData,n.route.path)}var d,h,g={},y="",m={placeholder:"Type to search",noData:"No Results!",paths:"auto",maxAge:864e5},v=function(e,n){var t=Docsify.util,o=n.config.search||m;Array.isArray(o)?m.paths=o:"object"==typeof o&&(m.paths=Array.isArray(o.paths)?o.paths:"auto",m.maxAge=t.isPrimitive(o.maxAge)?o.maxAge:m.maxAge,m.placeholder=o.placeholder||m.placeholder,m.noData=o.noData||m.noData);var a="auto"===m.paths;e.mounted(function(e){f(m),!a&&i(m,n)}),e.doneEach(function(e){p(m,n),a&&i(m,n)})};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
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 9.6 KiB

+10 -7
View File
@@ -1,6 +1,6 @@
{
"name": "docsify",
"version": "1.0.1",
"version": "3.4.1",
"description": "A magical documentation generator.",
"main": "lib/docsify.js",
"files": [
@@ -10,8 +10,9 @@
],
"scripts": {
"build": "rm -rf lib themes && node build/build.js && mkdir lib/themes && mkdir themes && node build/build-css.js",
"dev": "node app.js & nodemon -w src --exec 'npm run build'",
"test": "eslint src test"
"dev:build": "rm -rf lib themes && mkdir themes && node build/build.js --dev && node build/build-css.js --dev",
"dev": "node app.js & nodemon -w src -e js,css --exec 'npm run dev:build'",
"test": "eslint src"
},
"repository": {
"type": "git",
@@ -35,15 +36,17 @@
"nodemon": "^1.11.0",
"postcss": "^5.2.6",
"postcss-salad": "^1.0.5",
"rollup": "^0.36.3",
"rollup-plugin-buble": "^0.14.0",
"rollup-plugin-commonjs": "^5.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-string": "^2.0.2",
"rollup-plugin-uglify": "^1.0.1",
"serve-static": "^1.11.1"
},
"dependencies": {
"marked": "^0.3.6",
"prismjs": "^1.5.1"
"prismjs": "^1.5.1",
"zoom-image": "^0.1.4"
}
}
+44
View File
@@ -0,0 +1,44 @@
import { merge, hyphenate, isPrimitive } from './util/core'
const config = merge({
el: '#app',
repo: '',
maxLevel: 6,
subMaxLevel: 0,
loadSidebar: null,
loadNavbar: null,
homepage: 'README.md',
coverpage: '',
basePath: '',
auto2top: false,
name: '',
themeColor: '',
nameLink: window.location.pathname,
autoHeader: false,
executeScript: null,
ga: ''
}, window.$docsify)
const script = document.currentScript ||
[].slice.call(document.getElementsByTagName('script'))
.filter(n => /docsify\./.test(n.src))[0]
if (script) {
for (const prop in config) {
const val = script.getAttribute('data-' + hyphenate(prop))
if (isPrimitive(val)) {
config[prop] = val === '' ? true : val
}
}
if (config.loadSidebar === true) config.loadSidebar = '_sidebar.md'
if (config.loadNavbar === true) config.loadNavbar = '_navbar.md'
if (config.coverpage === true) config.coverpage = '_coverpage.md'
if (config.repo === true) config.repo = ''
if (config.name === true) config.name = ''
}
window.$docsify = config
export default config
+22
View File
@@ -0,0 +1,22 @@
import { isMobile } from '../util/env'
import { body, on } from '../util/dom'
import * as sidebar from './sidebar'
import { scrollIntoView } from './scroll'
export function eventMixin (proto) {
proto.$resetEvents = function () {
scrollIntoView(this.route.query.id)
sidebar.getAndActive('nav')
}
}
export function initEvent (vm) {
// Bind toggle button
sidebar.btn('button.sidebar-toggle')
// Bind sticky effect
if (vm.config.coverpage) {
!isMobile && on('scroll', sidebar.sticky)
} else {
body.classList.add('sticky')
}
}
+90
View File
@@ -0,0 +1,90 @@
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
const sidebar = dom.getNode('.sidebar')
const lis = dom.findAll(sidebar, 'li')
for (let i = 0, len = lis.length; i < len; i += 1) {
const li = lis[i]
const a = li.querySelector('a')
if (!a) continue
let href = a.getAttribute('href')
if (href !== '/') {
href = parse(href).query.id
}
nav[decodeURIComponent(href)] = li
}
dom.off('scroll', highlight)
dom.on('scroll', highlight)
dom.on(sidebar, 'mouseover', () => { hoverOver = true })
dom.on(sidebar, 'mouseleave', () => { hoverOver = false })
}
export function scrollIntoView (id) {
const section = dom.find('#' + id)
section && section.scrollIntoView()
}
const scrollEl = dom.$.scrollingElement || dom.$.documentElement
export function scroll2Top (offset = 0) {
scrollEl.scrollTop = offset === true ? 0 : Number(offset)
}
+68
View File
@@ -0,0 +1,68 @@
import { isMobile } from '../util/env'
import * as dom from '../util/dom'
import { getHash } from '../route/hash'
const title = dom.$.title
/**
* Toggle button
*/
export function btn (el) {
const toggle = () => dom.body.classList.toggle('close')
el = dom.getNode(el)
dom.on(el, 'click', toggle)
const sidebar = dom.getNode('.sidebar')
dom.on(sidebar, 'click', () => {
isMobile && toggle()
setTimeout(() => getAndActive(sidebar, true, true), 0)
})
}
export function sticky () {
const cover = dom.getNode('section.cover')
if (!cover) return
const coverHeight = cover.getBoundingClientRect().height
if (window.pageYOffset >= coverHeight || cover.classList.contains('hidden')) {
dom.toggleClass(dom.body, 'add', 'sticky')
} else {
dom.toggleClass(dom.body, 'remove', 'sticky')
}
}
/**
* Get and active link
* @param {string|element} el
* @param {Boolean} isParent acitve parent
* @param {Boolean} autoTitle auto set title
* @return {element}
*/
export function getAndActive (el, isParent, autoTitle) {
el = dom.getNode(el)
const links = dom.findAll(el, 'a')
const hash = '#' + getHash()
let target
links
.sort((a, b) => b.href.length - a.href.length)
.forEach(a => {
const href = a.getAttribute('href')
const node = isParent ? a.parentNode : a
if (hash.indexOf(href) === 0 && !target) {
target = a
dom.toggleClass(node, 'add', 'active')
} else {
dom.toggleClass(node, 'remove', 'active')
}
})
if (autoTitle) {
dom.$.title = target ? `${target.innerText} - ${title}` : title
}
return target
}
+51
View File
@@ -0,0 +1,51 @@
import progressbar from '../render/progressbar'
import { noop } from '../util/core'
const cache = {}
/**
* Simple ajax get
* @param {string} url
* @param {boolean} [hasBar=false] has progress bar
* @return { then(resolve, reject), abort }
*/
export function get (url, hasBar = false) {
const xhr = new XMLHttpRequest()
const on = function () {
xhr.addEventListener.apply(xhr, arguments)
}
if (cache[url]) {
return { then: cb => cb(cache[url]), abort: noop }
}
xhr.open('GET', url)
xhr.send()
return {
then: function (success, error = noop) {
if (hasBar) {
const id = setInterval(_ => progressbar({
step: Math.floor(Math.random() * 5 + 1)
}), 500)
on('progress', progressbar)
on('loadend', evt => {
progressbar(evt)
clearInterval(id)
})
}
on('error', error)
on('load', ({ target }) => {
if (target.status >= 400) {
error(target)
} else {
cache[url] = target.response
success(target.response)
}
})
},
abort: _ => xhr.readyState !== 4 && xhr.abort()
}
}
+74
View File
@@ -0,0 +1,74 @@
import { get } from './ajax'
import { callHook } from '../init/lifecycle'
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
// Abort last request
last && last.abort && last.abort()
last = get(this.$getFile(path), true)
// Current page is html
this.isHTML = /\.html$/g.test(path)
// Load main content
last.then(text => {
this._renderMain(text)
if (!loadSidebar) return cb()
const fn = result => { this._renderSidebar(result); cb() }
// Load sidebar
loadNested(path, loadSidebar, fn, this, true)
},
_ => this._renderMain(null))
// Load nav
loadNavbar &&
loadNested(path, loadNavbar, text => this._renderNav(text), this, true)
}
proto._fetchCover = function () {
const { coverpage } = this.config
const root = getParentPath(this.route.path)
const path = this.$getFile(root + coverpage)
if (this.route.path !== '/' || !coverpage) {
this._renderCover()
return
}
this.coverIsHTML = /\.html$/g.test(path)
get(path)
.then(text => this._renderCover(text))
}
proto.$fetch = function (cb = noop) {
this._fetchCover()
this._fetch(result => {
this.$resetEvents()
callHook(this, 'doneEach')
cb()
})
}
}
export function initFetch (vm) {
vm.$fetch(_ => callHook(vm, 'ready'))
}
+14
View File
@@ -0,0 +1,14 @@
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, slugify }
window.marked = marked
window.Prism = prism
}
+28
View File
@@ -0,0 +1,28 @@
import { initMixin } from './init'
import { routeMixin } from './route'
import { renderMixin } from './render'
import { fetchMixin } from './fetch'
import { eventMixin } from './event'
import initGlobalAPI from './global-api'
function Docsify () {
this._init()
}
const proto = Docsify.prototype
initMixin(proto)
routeMixin(proto)
renderMixin(proto)
fetchMixin(proto)
eventMixin(proto)
/**
* Global API
*/
initGlobalAPI()
/**
* Run Docsify
*/
setTimeout(_ => new Docsify(), 0)
+27
View File
@@ -0,0 +1,27 @@
import config from '../config'
import { initLifecycle, callHook } from './lifecycle'
import { initRender } from '../render'
import { initRoute } from '../route'
import { initEvent } from '../event'
import { initFetch } from '../fetch'
import { isFn } from '../util/core'
export function initMixin (proto) {
proto._init = function () {
const vm = this
vm.config = config || {}
initLifecycle(vm) // Init hooks
initPlugin(vm) // Install plugins
callHook(vm, 'init')
initRender(vm) // Render base DOM
initEvent(vm) // Bind events
initRoute(vm) // Add hashchange eventListener
initFetch(vm) // Fetch data
callHook(vm, 'mounted')
}
}
function initPlugin (vm) {
[].concat(vm.config.plugins).forEach(fn => isFn(fn) && fn(vm._lifecycle, vm))
}
+48
View File
@@ -0,0 +1,48 @@
import { noop } from '../util/core'
export function initLifecycle (vm) {
const hooks = [
'init',
'mounted',
'beforeEach',
'afterEach',
'doneEach',
'ready'
]
vm._hooks = {}
vm._lifecycle = {}
hooks.forEach(hook => {
const arr = vm._hooks[hook] = []
vm._lifecycle[hook] = fn => arr.push(fn)
})
}
export function callHook (vm, hook, data, next = noop) {
let newData = data
const queue = vm._hooks[hook]
const step = function (index) {
const hook = queue[index]
if (index >= queue.length) {
next(newData)
} else {
if (typeof hook === 'function') {
if (hook.length === 2) {
hook(data, result => {
newData = result
step(index + 1)
})
} else {
const result = hook(data)
newData = result !== undefined ? result : newData
step(index + 1)
}
} else {
step(index + 1)
}
}
}
step(0)
}
+140
View File
@@ -0,0 +1,140 @@
import marked from 'marked'
import Prism from 'prismjs'
import { helper as helperTpl, tree as treeTpl } from './tpl'
import { genTree } from './gen-tree'
import { slugify } from './slugify'
import { emojify } from './emojify'
import { toURL, parse } from '../route/hash'
import { getBasePath, isAbsolutePath, getPath } from '../route/util'
import { isFn, merge, cached } from '../util/core'
let markdownCompiler = marked
let contentBase = ''
let currentPath = ''
let renderer = new marked.Renderer()
const cacheTree = {}
let toc = []
/**
* Compile markdown content
*/
export const markdown = cached(text => {
let html = ''
if (!text) return text
html = markdownCompiler(text)
html = emojify(html)
slugify.clear()
return html
})
markdown.renderer = renderer
markdown.init = function (config = {}, base = window.location.pathname) {
contentBase = getBasePath(base)
if (isFn(config)) {
markdownCompiler = config(marked, renderer)
} else {
renderer = merge(renderer, config.renderer)
marked.setOptions(merge(config, { renderer }))
}
}
markdown.update = function () {
currentPath = parse().path
}
/**
* render anchor tag
* @link https://github.com/chjj/marked#overriding-renderer-methods
*/
renderer.heading = function (text, level) {
const slug = slugify(text)
const url = toURL(currentPath, { id: slug })
toc.push({ level, slug: url, title: text })
return `<h${level} id="${slug}"><a href="${url}" data-id="${slug}" class="anchor"><span>${text}</span></a></h${level}>`
}
// highlight code
renderer.code = function (code, lang = '') {
const hl = Prism.highlight(code, Prism.languages[lang] || Prism.languages.markup)
return `<pre v-pre data-lang="${lang}"><code class="lang-${lang}">${hl}</code></pre>`
}
renderer.link = function (href, title, text) {
let blank = ''
if (!/:|(\/{2})/.test(href)) {
href = toURL(href)
} else {
blank = ' target="_blank"'
}
if (title) {
title = ` title="${title}"`
}
return `<a href="${href}"${title}${blank}>${text}</a>`
}
renderer.paragraph = function (text) {
if (/^!&gt;/.test(text)) {
return helperTpl('tip', text)
} else if (/^\?&gt;/.test(text)) {
return helperTpl('warn', text)
}
return `<p>${text}</p>`
}
renderer.image = function (href, title, text) {
let url = href
const titleHTML = title ? ` title="${title}"` : ''
if (!isAbsolutePath(href)) {
url = getPath(contentBase, href)
}
return `<img src="${url}" data-origin="${href}" alt="${text}"${titleHTML}>`
}
/**
* Compile sidebar
*/
export function sidebar (text, level) {
let html = ''
if (text) {
html = markdown(text)
html = html.match(/<ul[^>]*>([\s\S]+)<\/ul>/g)[0]
} else {
const tree = cacheTree[currentPath] || genTree(toc, level)
html = treeTpl(tree, '<ul>')
cacheTree[currentPath] = tree
}
return html
}
/**
* Compile sub sidebar
*/
export function subSidebar (el, level) {
if (el) {
toc[0] && toc[0].level === 1 && toc.shift()
const tree = cacheTree[currentPath] || genTree(toc, level)
el.parentNode.innerHTML += treeTpl(tree, '<ul class="app-sub-sidebar">')
cacheTree[currentPath] = tree
}
toc = []
}
/**
* Compile cover page
*/
export function cover (text) {
const cacheToc = toc.slice()
const html = markdown(text)
toc = cacheToc.slice()
return html
}
+10
View File
@@ -0,0 +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|code)[^>]*?>[\s\S]+?<\/(pre|template|code)>/g, m => m.replace(/:/g, '__colon__'))
.replace(/:(\w+?):/ig, window.emojify || replace)
.replace(/__colon__/g, ':')
}
+26
View File
@@ -0,0 +1,26 @@
/**
* gen toc tree
* @link https://github.com/killercup/grock/blob/5280ae63e16c5739e9233d9009bc235ed7d79a50/styles/solarized/assets/js/behavior.coffee#L54-L81
* @param {Array} toc
* @param {Number} maxLevel
* @return {Array}
*/
export function genTree (toc, maxLevel) {
const headlines = []
const last = {}
toc.forEach(headline => {
const level = headline.level || 1
const len = level - 1
if (level > maxLevel) return
if (last[len]) {
last[len].children = (last[len].children || []).concat(headline)
} else {
headlines.push(headline)
}
last[level] = headline
})
return headlines
}
+185
View File
@@ -0,0 +1,185 @@
import * as dom from '../util/dom'
import { getAndActive, sticky } from '../event/sidebar'
import { scrollActiveSidebar, scroll2Top } from '../event/scroll'
import cssVars from '../util/polyfill/css-vars'
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'
function executeScript () {
const script = dom.findAll('.markdown-section>script')
.filter(s => !/template/.test(s.type))[0]
if (!script) return false
const code = script.innerText.trim()
if (!code) return false
setTimeout(_ => {
window.__EXECUTE_RESULT__ = new Function(code)()
}, 0)
}
function renderMain (html) {
if (!html) {
// TODO: Custom 404 page
html = 'not found'
}
this._renderTo('.markdown-section', html)
// Render sidebar with the TOC
!this.config.loadSidebar && this._renderSidebar()
// 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) {
scroll2Top(this.config.auto2top)
}
}
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)
if (node) node[replace ? 'outerHTML' : 'innerHTML'] = content
}
proto._renderSidebar = function (text) {
const { maxLevel, subMaxLevel, autoHeader, loadSidebar } = this.config
this._renderTo('.sidebar-nav', sidebar(text, maxLevel))
const active = getAndActive('.sidebar-nav', true, true)
subSidebar(loadSidebar ? active : '', subMaxLevel)
// bind event
this.activeLink = active
scrollActiveSidebar()
if (autoHeader && active) {
const main = dom.getNode('#main')
const firstNode = main.children[0]
if (firstNode && firstNode.tagName !== 'H1') {
const h1 = dom.create('h1')
h1.innerText = active.innerText
dom.before(main, h1)
}
}
}
proto._renderNav = function (text) {
text && this._renderTo('nav', markdown(text))
getAndActive('nav')
}
proto._renderMain = function (text) {
callHook(this, 'beforeEach', text, result => {
const html = this.isHTML ? result : markdown(result)
callHook(this, 'afterEach', html, text => renderMain.call(this, text))
})
}
proto._renderCover = function (text) {
const el = dom.getNode('.cover')
if (!text) {
dom.toggleClass(el, 'remove', 'show')
return
}
dom.toggleClass(el, 'add', 'show')
let html = this.coverIsHTML ? text : cover(text)
const m = html.trim().match('<p><img.*?data-origin="(.*?)"[^a]+alt="(.*?)">([^<]*?)</p>$')
if (m) {
if (m[2] === 'color') {
el.style.background = m[1] + (m[3] || '')
} else {
let path = m[1]
dom.toggleClass(el, 'add', 'has-mask')
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], '')
}
this._renderTo('.cover-main', html)
sticky()
}
proto._updateRender = function () {
markdown.update()
// render name link
renderNameLink(this)
}
}
export function initRender (vm) {
const config = vm.config
// Init markdown compiler
markdown.init(config.markdown, config.basePath)
const id = config.el || '#app'
const navEl = dom.find('nav') || dom.create('nav')
let el = dom.find(id)
let html = ''
navEl.classList.add('app-nav')
if (!config.repo) {
navEl.classList.add('no-badge')
}
if (!el) {
el = dom.create(id)
dom.appendTo(dom.body, el)
}
if (config.repo) {
html += tpl.corner(config.repo)
}
if (config.coverpage) {
html += tpl.cover()
}
html += tpl.main(config)
// Render main app
vm._renderTo(el, html, true)
// Add nav
dom.before(dom.body, navEl)
if (config.themeColor) {
dom.$.head.innerHTML += tpl.theme(config.themeColor)
// Polyfll
cssVars(config.themeColor)
}
dom.toggleClass(dom.body, 'ready')
}
+41
View File
@@ -0,0 +1,41 @@
import * as dom from '../util/dom'
let barEl
let timeId
/**
* Init progress component
*/
function init () {
const div = dom.create('div')
div.classList.add('progress')
dom.appendTo(dom.body, div)
barEl = div
}
/**
* Render progress bar
*/
export default function ({ loaded, total, step }) {
let num
!barEl && init()
if (step) {
num = parseInt(barEl.style.width || 0, 10) + step
num = num > 80 ? 80 : num
} else {
num = Math.floor(loaded / total * 100)
}
barEl.style.opacity = 1
barEl.style.width = num >= 95 ? '100%' : num + '%'
if (num >= 95) {
clearTimeout(timeId)
timeId = setTimeout(_ => {
barEl.style.opacity = 0
barEl.style.width = '0%'
}, 200)
}
}
+27
View File
@@ -0,0 +1,27 @@
let cache = {}
const re = /[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,.\/:;<=>?@\[\]^`{|}~]/g
export function slugify (str) {
if (typeof str !== 'string') return ''
let slug = str.toLowerCase().trim()
.replace(/<[^>\d]+>/g, '')
.replace(re, '')
.replace(/\s/g, '-')
.replace(/-+/g, '-')
.replace(/^(\d)/, '_$1')
let count = cache[slug]
count = cache.hasOwnProperty(slug) ? (count + 1) : 0
cache[slug] = count
if (count) {
slug = slug + '-' + count
}
return slug
}
slugify.clear = function () {
cache = {}
}
+86
View File
@@ -0,0 +1,86 @@
import { isMobile } from '../util/env'
/**
* Render github corner
* @param {Object} data
* @return {String}
*/
export function corner (data) {
if (!data) return ''
if (!/\/\//.test(data)) data = 'https://github.com/' + data
data = data.replace(/^git\+/, '')
return (
`<a href="${data}" class="github-corner" aria-label="View source on Github">` +
'<svg viewBox="0 0 250 250" aria-hidden="true">' +
'<path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z"></path>' +
'<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>')
}
/**
* Render main content
*/
export function main (config) {
const aside = (
'<button class="sidebar-toggle">' +
'<div class="sidebar-toggle-button">' +
'<span></span><span></span><span></span>' +
'</div>' +
'</button>' +
'<aside class="sidebar">' +
(config.name
? `<h1><a class="app-name-link" data-nosearch>${config.name}</a></h1>`
: '') +
'<div class="sidebar-nav"></div>' +
'</aside>')
return (isMobile ? `${aside}<main>` : `<main>${aside}`) +
'<section class="content">' +
'<article class="markdown-section" id="main"></article>' +
'</section>' +
'</main>'
}
/**
* Cover Page
*/
export function cover () {
const SL = ', 100%, 85%'
const bgc = 'linear-gradient(to left bottom, ' +
`hsl(${Math.floor(Math.random() * 255) + SL}) 0%,` +
`hsl(${Math.floor(Math.random() * 255) + SL}) 100%)`
return `<section class="cover" style="background: ${bgc}">` +
'<div class="cover-main"></div>' +
'<div class="mask"></div>' +
'</section>'
}
/**
* Render tree
* @param {Array} tree
* @param {String} tpl
* @return {String}
*/
export function tree (toc, tpl = '') {
if (!toc || !toc.length) return ''
toc.forEach(node => {
tpl += `<li><a class="section-link" href="${node.slug}">${node.title}</a></li>`
if (node.children) {
tpl += `<li><ul class="children">${tree(node.children)}</li></ul>`
}
})
return tpl
}
export function helper (className, content) {
return `<p class="${className}">${content.slice(5).trim()}</p>`
}
export function theme (color) {
return `<style>:root{--theme-color: ${color};}</style>`
}
+75
View File
@@ -0,0 +1,75 @@
import { merge, cached } from '../util/core'
import { parseQuery, stringifyQuery, cleanPath } from './util'
export * from './util'
function replaceHash (path) {
const i = window.location.href.indexOf('#')
window.location.replace(
window.location.href.slice(0, i >= 0 ? i : 0) + '#' + path
)
}
const replaceSlug = cached(path => {
return path
.replace('#', '?id=')
.replace(/\?(\w+)=/g, (_, slug) => slug === 'id' ? '?id=' : `&${slug}=`)
})
/**
* Normalize the current url
*
* @example
* domain.com/docs/ => domain.com/docs/#/
* domain.com/docs/#/#slug => domain.com/docs/#/?id=slug
*/
export function normalize () {
let path = getHash()
path = replaceSlug(path)
if (path.charAt(0) === '/') return replaceHash(path)
replaceHash('/' + path)
}
export function getHash () {
// We can't use window.location.hash here because it's not
// consistent across browsers - Firefox will pre-decode it!
const href = window.location.href
const index = href.indexOf('#')
return index === -1 ? '' : href.slice(index + 1)
}
/**
* Parse the url
* @param {string} [path=window.location.herf]
* @return {object} { path, query }
*/
export function parse (path = window.location.href) {
let query = ''
const queryIndex = path.indexOf('?')
if (queryIndex >= 0) {
query = path.slice(queryIndex + 1)
path = path.slice(0, queryIndex)
}
const hashIndex = path.indexOf('#')
if (hashIndex) {
path = path.slice(hashIndex + 1)
}
return { path, query: parseQuery(query) }
}
/**
* to URL
* @param {string} path
* @param {object} qs query params
*/
export function toURL (path, params) {
const route = parse(replaceSlug(path))
route.query = merge({}, route.query, params)
path = route.path + stringifyQuery(route.query)
return cleanPath('#/' + path)
}
+52
View File
@@ -0,0 +1,52 @@
import { normalize, parse } from './hash'
import { getBasePath, getPath, isAbsolutePath } from './util'
import { on } from '../util/dom'
function getAlias (path, alias) {
return alias[path] ? getAlias(alias[path], alias) : path
}
function getFileName (path) {
return /\.(md|html)$/g.test(path)
? path
: /\/$/g.test(path)
? `${path}README.md`
: `${path}.md`
}
export function routeMixin (proto) {
proto.route = {}
proto.$getFile = function (path) {
const { config } = this
const base = getBasePath(config.basePath)
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)
return path
}
}
let lastRoute = {}
export function initRoute (vm) {
normalize()
lastRoute = vm.route = parse()
vm._updateRender()
on('hashchange', _ => {
normalize()
vm.route = parse()
vm._updateRender()
if (lastRoute.path === vm.route.path) {
vm.$resetEvents()
return
}
vm.$fetch()
lastRoute = vm.route
})
}
+58
View File
@@ -0,0 +1,58 @@
import { cached } from '../util/core'
const decode = decodeURIComponent
const encode = encodeURIComponent
export function parseQuery (query) {
const res = {}
query = query.trim().replace(/^(\?|#|&)/, '')
if (!query) {
return res
}
// Simple parse
query.split('&').forEach(function (param) {
const parts = param.replace(/\+/g, ' ').split('=')
res[parts[0]] = decode(parts[1])
})
return res
}
export function stringifyQuery (obj) {
const qs = []
for (const key in obj) {
qs.push(`${encode(key)}=${encode(obj[key])}`.toLowerCase())
}
return qs.length ? `?${qs.join('&')}` : ''
}
export const getBasePath = cached(base => {
return /^(\/|https?:)/g.test(base)
? base
: cleanPath(window.location.pathname + '/' + base)
})
export function getPath (...args) {
return cleanPath(args.join('/'))
}
export const isAbsolutePath = cached(path => {
return /(:|(\/{2}))/.test(path)
})
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, '/')
})
+55
View File
@@ -0,0 +1,55 @@
/**
* Create a cached version of a pure function.
*/
export function cached (fn) {
const cache = Object.create(null)
return function cachedFn (str) {
const hit = cache[str]
return hit || (cache[str] = fn(str))
}
}
/**
* Hyphenate a camelCase string.
*/
export const hyphenate = cached(str => {
return str.replace(/([A-Z])/g, m => '-' + m.toLowerCase())
})
/**
* Simple Object.assign polyfill
*/
export const merge = Object.assign || function (to) {
const hasOwn = Object.prototype.hasOwnProperty
for (let i = 1; i < arguments.length; i++) {
const from = Object(arguments[i])
for (const key in from) {
if (hasOwn.call(from, key)) {
to[key] = from[key]
}
}
}
return to
}
/**
* Check if value is primitive
*/
export function isPrimitive (value) {
return typeof value === 'string' || typeof value === 'number'
}
/**
* Perform no operation.
*/
export function noop () {}
/**
* Check if value is function
*/
export function isFn (obj) {
return typeof obj === 'function'
}
+83
View File
@@ -0,0 +1,83 @@
import { isFn } from '../util/core'
const cacheNode = {}
/**
* Get Node
* @param {String|Element} el
* @param {Boolean} noCache
* @return {Element}
*/
export function getNode (el, noCache = false) {
if (typeof el === 'string') {
if (typeof window.Vue !== 'undefined') {
return find(el)
}
el = noCache ? find(el) : (cacheNode[el] || (cacheNode[el] = find(el)))
}
return el
}
export const $ = document
export const body = $.body
export const head = $.head
/**
* Find element
* @example
* find('nav') => document.querySelector('nav')
* find(nav, 'a') => nav.querySelector('a')
*/
export function find (el, node) {
return node ? el.querySelector(node) : $.querySelector(el)
}
/**
* Find all elements
* @example
* findAll('a') => [].slice.call(document.querySelectorAll('a'))
* findAll(nav, 'a') => [].slice.call(nav.querySelectorAll('a'))
*/
export function findAll (el, node) {
return [].slice.call(node ? el.querySelectorAll(node) : $.querySelectorAll(el))
}
export function create (node, tpl) {
node = $.createElement(node)
if (tpl) node.innerHTML = tpl
return node
}
export function appendTo (target, el) {
return target.appendChild(el)
}
export function before (target, el) {
return target.insertBefore(el, target.children[0])
}
export function on (el, type, handler) {
isFn(type)
? window.addEventListener(el, type)
: el.addEventListener(type, handler)
}
export function off (el, type, handler) {
isFn(type)
? window.removeEventListener(el, type)
: el.removeEventListener(type, handler)
}
/**
* Toggle class
*
* @example
* toggleClass(el, 'active') => el.classList.toggle('active')
* toggleClass(el, 'add', 'active') => el.classList.add('active')
*/
export function toggleClass (el, type, val) {
el && el.classList[val ? type : 'toggle'](val || type)
}
+5
View File
@@ -0,0 +1,5 @@
export const UA = window.navigator.userAgent.toLowerCase()
export const isIE = UA && /msie|trident/.test(UA)
export const isMobile = document.body.clientWidth <= 600
+2
View File
@@ -0,0 +1,2 @@
export * from './core'
export * from './env'

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