diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 0000000..a3b8548 --- /dev/null +++ b/.eslintignore @@ -0,0 +1,5 @@ +.git +packages/docsify-server-renderer/build.js +node_modules +build +server.js \ No newline at end of file diff --git a/.eslintrc b/.eslintrc index d5691ad..a8f7cd0 100644 --- a/.eslintrc +++ b/.eslintrc @@ -1,6 +1,20 @@ { - "extends": ["vue"], + "extends": "xo-space/browser", + "rules": { + "semi": [2, "never"], + "no-return-assign": "off", + "no-unused-expressions": "off", + "no-new-func": "off", + "no-multi-assign": "off", + "no-mixed-operators": "off", + "max-params": "off", + "no-script-url": "off", + "camelcase": "off", + "no-warning-comments": "off" + }, "globals": { - "XMLHttpRequest": true + "Docsify": true, + "$docsify": true, + "process": true } } diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 0000000..35d6b90 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,38 @@ +--- +name: Bug report +about: Create a report to help us improve + +--- + + + + + +## Bug Report + +#### Steps to reproduce + + + +#### What is current behaviour + + + +#### What is the expected behaviour + + + +#### Other relevant information + + +- [ ] Bug does still occur when all/other plugins are disabled? + +- Your OS: +- Node.js version: +- npm/yarn version: +- Browser version: +- Docsify version: +- Docsify plugins: + + diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 0000000..501e4de --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,25 @@ +--- +name: Feature request +about: Suggest an idea for this project + +--- + + + + + +## Feature request + +#### What problem does this feature solve? + + + +#### What does the proposed API look like? + + + +#### How should this be implemented in your opinion? + + + +#### Are you willing to work on this yourself? diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..bb31bd4 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,54 @@ + + + + + + +**Summary** + +**What kind of change does this PR introduce?** (check at least one) + +- [ ] Bugfix +- [ ] Feature +- [ ] Code style update +- [ ] Refactor +- [ ] Docs +- [ ] Build-related changes +- [ ] Other, please describe: + +If changing the UI of default theme, please provide the **before/after** screenshot: + +**Does this PR introduce a breaking change?** (check one) + +- [ ] Yes +- [ ] No + +If yes, please describe the impact and migration path for existing applications: + +**The PR fulfills these requirements:** + +- [ ] When resolving a specific issue, it's referenced in the PR's title (e.g. `fix #xxx[,#xxx]`, where "xxx" is the issue number) + +You have tested in the following browsers: (Providing a detailed version will be better.) + +- [ ] Chrome +- [ ] Firefox +- [ ] Safari +- [ ] Edge +- [ ] IE + +If adding a **new feature**, the PR's description includes: + +- [ ] A convincing reason for adding this feature +- [ ] Related documents have been updated +- [ ] Related tests have been updated + +To avoid wasting your time, it's best to open a **feature request issue** first and wait for approval before working on it. + + +**Other information:** + +--- + +* [ ] DO NOT include files inside `lib` directory. + diff --git a/.gitignore b/.gitignore index ee8a519..ea4b5b8 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,9 @@ -.DS_Store *.log +.DS_Store +.idea node_modules -/themes \ No newline at end of file +themes/ +lib/ + +# exceptions +!.gitkeep \ No newline at end of file diff --git a/.npmignore b/.npmignore new file mode 100644 index 0000000..41b1431 --- /dev/null +++ b/.npmignore @@ -0,0 +1,5 @@ +.eslintignore +.eslintrc +.github/ +.gitignore +.travis.yml diff --git a/.travis.yml b/.travis.yml index fb0b83e..87576c5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,3 @@ sudo: false -cache: - directories: - - $HOME/.yarn-cache language: node_js node_js: stable diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..b7d6eb8 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "prettier.eslintIntegration": true +} diff --git a/CHANGELOG.md b/CHANGELOG.md index feadcdd..267d402 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,274 +1,753 @@ -## 1.10.2 -### Bug fixes -- Fix render emojis again + +## [4.9.4](https://github.com/docsifyjs/docsify/compare/v4.9.2...v4.9.4) (2019-05-05) -## 1.10.1 -### Bug fixes -- Fix render emojis -## 1.10.0 -### Features -- Support emoji :laughing: -## 1.9.0 + +## [4.9.2](https://github.com/docsifyjs/docsify/compare/v4.9.1...v4.9.2) (2019-04-21) + + +### Bug Fixes + +* re-render gitalk when router changed ([11ea1f8](https://github.com/docsifyjs/docsify/commit/11ea1f8)) -### Bug fixes -- Destroys the vue instance when the route is changed ### Features -- Add `!>` and `?>` doc helper. -### Break change -- Remove `!` doc helper. +* allows relative path, fixed [#590](https://github.com/docsifyjs/docsify/issues/590) ([31654f1](https://github.com/docsifyjs/docsify/commit/31654f1)) + + + + +## [4.9.1](https://github.com/docsifyjs/docsify/compare/v4.9.0...v4.9.1) (2019-02-21) + + +### Bug Fixes + +* github assets url ([#774](https://github.com/docsifyjs/docsify/issues/774)) ([140bf10](https://github.com/docsifyjs/docsify/commit/140bf10)) + + + + +# [4.9.0](https://github.com/docsifyjs/docsify/compare/v4.8.6...v4.9.0) (2019-02-19) + + +### Bug Fixes + +* task list rendering (Fix [#749](https://github.com/docsifyjs/docsify/issues/749)) ([#757](https://github.com/docsifyjs/docsify/issues/757)) ([69ef489](https://github.com/docsifyjs/docsify/commit/69ef489)) +* upgrade npm-run-all ([049726e](https://github.com/docsifyjs/docsify/commit/049726e)) -## 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 +* **search-plugin:** add namespace option ([#706](https://github.com/docsifyjs/docsify/issues/706)) ([28beff8](https://github.com/docsifyjs/docsify/commit/28beff8)) +* Add new theme "dolphin" ([#735](https://github.com/docsifyjs/docsify/issues/735)) ([c3345ba](https://github.com/docsifyjs/docsify/commit/c3345ba)) +* Provide code fragments feature ([#748](https://github.com/docsifyjs/docsify/issues/748)) ([1447c8a](https://github.com/docsifyjs/docsify/commit/1447c8a)) -## 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. + +## [4.8.6](https://github.com/docsifyjs/docsify/compare/v4.8.5...v4.8.6) (2018-11-12) -## 1.7.0 -### Bug fixes -- Fixed custom cover background, fixed #52 -- Fixed sticky sidebar +### Bug Fixes -## Features -- Add `name` and `nameLink` +* IE10 compatibility ([#691](https://github.com/docsifyjs/docsify/issues/691)) ([4db8cd6](https://github.com/docsifyjs/docsify/commit/4db8cd6)) -## 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 `

content

` -## 1.5.2 -### Bug fixes -- Fixed number at the beginning of the slug + +## [4.8.5](https://github.com/docsifyjs/docsify/compare/v4.8.4...v4.8.5) (2018-11-02) -## 1.5.1 -### Bug fixes -- Remove HTML tag when handling slug -## 1.5.0 +### Bug Fixes -### Bug fixes -- Fix slugify. -- Fix nav highlight. +* expose version info for Docsify, fixed [#641](https://github.com/docsifyjs/docsify/issues/641) ([aa719e3](https://github.com/docsifyjs/docsify/commit/aa719e3)) + + + + +## [4.8.4](https://github.com/docsifyjs/docsify/compare/v4.8.3...v4.8.4) (2018-11-01) + + +### Bug Fixes + +* **cover:** Compatible with legacy styles, fixed [#677](https://github.com/docsifyjs/docsify/issues/677) ([#678](https://github.com/docsifyjs/docsify/issues/678)) ([1a945d4](https://github.com/docsifyjs/docsify/commit/1a945d4)) + + + + + +## [4.8.3](https://github.com/docsifyjs/docsify/compare/v4.8.2...v4.8.3) (2018-11-01) + +Fix the last release files has the old version marked... + + + +## [4.8.2](https://github.com/docsifyjs/docsify/compare/v4.8.1...v4.8.2) (2018-11-01) + +### Bug Fixes + +- cover button style, fixed [#670](https://github.com/docsifyjs/docsify/issues/670), fixed [#665](https://github.com/docsifyjs/docsify/issues/665) ([#675](https://github.com/docsifyjs/docsify/issues/675)) ([fcd1087](https://github.com/docsifyjs/docsify/commit/fcd1087)) +- update match regex ([#669](https://github.com/docsifyjs/docsify/issues/669)) ([2edf47e](https://github.com/docsifyjs/docsify/commit/2edf47e)) +- use copy of cached value ([#668](https://github.com/docsifyjs/docsify/issues/668)) ([5fcf210](https://github.com/docsifyjs/docsify/commit/5fcf210)) +- **compiler:** import prism-markup-templating, fixed [#672](https://github.com/docsifyjs/docsify/issues/672) ([#676](https://github.com/docsifyjs/docsify/issues/676)) ([fdd8826](https://github.com/docsifyjs/docsify/commit/fdd8826)) ### Features -- Initialize the configuration by `window.$docsify`. -- Markdown parser is configurable. -## 1.4.3 -### Bug fixes -- Tweak style. +- add heading config id ([#671](https://github.com/docsifyjs/docsify/issues/671)) ([ab19b13](https://github.com/docsifyjs/docsify/commit/ab19b13)) -## 1.4.2 + -### Bug fixes -- Fix toggle button style. -- Support `mailto`, `tel`, etc. href type -- Fix scroll to top. +## [4.8.1](https://github.com/docsifyjs/docsify/compare/v4.8.0...v4.8.1) (2018-10-31) +### Bug Fixes -## 1.4.1 -### Bug fixes -- Fix generate slug. +- ssr package dep, fixed [#605](https://github.com/docsifyjs/docsify/issues/605) ([2bc880d](https://github.com/docsifyjs/docsify/commit/2bc880d)) +- **compiler:** extra quotes for codeblock ([4f588e0](https://github.com/docsifyjs/docsify/commit/4f588e0)) +- **compiler:** prevent render of html code in paragraph, fixed [#663](https://github.com/docsifyjs/docsify/issues/663) ([d35059d](https://github.com/docsifyjs/docsify/commit/d35059d)) -## 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. +- upgrade PrismJS, fixed [#534](https://github.com/docsifyjs/docsify/issues/534) ([4805cb5](https://github.com/docsifyjs/docsify/commit/4805cb5)) -## 1.3.5 -### Bug fixes -- Fix vue + -## 1.3.4 -### Bug fixes +# [4.8.0](https://github.com/docsifyjs/docsify/compare/v4.7.1...v4.8.0) (2018-10-31) -- Supports [vuep](https://github.com/QingWei-Li/vuep) +### Bug Fixes -## 1.3.3 -### Bug fixes -- Fixed cover rendering timing +- Cache TOC for later usage in the case of cached file html ([#649](https://github.com/docsifyjs/docsify/issues/649)) ([9e86017](https://github.com/docsifyjs/docsify/commit/9e86017)) +- improve external script plugin ([#632](https://github.com/docsifyjs/docsify/issues/632)) ([50c2434](https://github.com/docsifyjs/docsify/commit/50c2434)) +- missing variable declaration ([#660](https://github.com/docsifyjs/docsify/issues/660)) ([1ce37bd](https://github.com/docsifyjs/docsify/commit/1ce37bd)) +- Remove target for mailto links ([#652](https://github.com/docsifyjs/docsify/issues/652)) ([18f0f03](https://github.com/docsifyjs/docsify/commit/18f0f03)) +- Update getAllPath query selector ([#653](https://github.com/docsifyjs/docsify/issues/653)) ([f6f4e32](https://github.com/docsifyjs/docsify/commit/f6f4e32)) +- Update vue.styl ([#634](https://github.com/docsifyjs/docsify/issues/634)) ([bf060be](https://github.com/docsifyjs/docsify/commit/bf060be)) -## 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 `` style -- headling can be cliked -### Bug fixes -- sidebar highlight +- Add docsify version to $window.docsify object ([#641](https://github.com/docsifyjs/docsify/issues/641)) ([94bc415](https://github.com/docsifyjs/docsify/commit/94bc415)), closes [#521](https://github.com/docsifyjs/docsify/issues/521) +- **compiler:** support embedded mermaid ([#629](https://github.com/docsifyjs/docsify/issues/629)) ([42ea8af](https://github.com/docsifyjs/docsify/commit/42ea8af)) +- Add hideOtherSidebarContent option ([#661](https://github.com/docsifyjs/docsify/issues/661)) ([4a23c4a](https://github.com/docsifyjs/docsify/commit/4a23c4a)) +- Allow base64, external, and relative logo values ([#642](https://github.com/docsifyjs/docsify/issues/642)) ([0a0802a](https://github.com/docsifyjs/docsify/commit/0a0802a)), closes [#577](https://github.com/docsifyjs/docsify/issues/577) +- upgrade marked to 0.5.x, fixed [#645](https://github.com/docsifyjs/docsify/issues/645), close [#644](https://github.com/docsifyjs/docsify/issues/644) ([#662](https://github.com/docsifyjs/docsify/issues/662)) ([a39b214](https://github.com/docsifyjs/docsify/commit/a39b214)) + -### break change -- Navbar no longer fixed at the top +## [4.7.1](https://github.com/docsifyjs/docsify/compare/v4.7.0...v4.7.1) (2018-08-30) + + + +# [4.7.0](https://github.com/QingWei-Li/docsify/compare/v4.6.9...v4.7.0) (2018-06-29) + +### Bug Fixes + +- alldow addition content in sidebar, fix [#518](https://github.com/QingWei-Li/docsify/issues/518), fix 539 ([#543](https://github.com/QingWei-Li/docsify/issues/543)) ([04b36b0](https://github.com/QingWei-Li/docsify/commit/04b36b0)) +- async install config, fixed [#425](https://github.com/QingWei-Li/docsify/issues/425) ([e4e011c](https://github.com/QingWei-Li/docsify/commit/e4e011c)) +- loading embed files synchronously, fixed [#525](https://github.com/QingWei-Li/docsify/issues/525), fixed [#527](https://github.com/QingWei-Li/docsify/issues/527) ([#544](https://github.com/QingWei-Li/docsify/issues/544)) ([feea7f9](https://github.com/QingWei-Li/docsify/commit/feea7f9)) +- path include chinese character cause hilight bug ([#556](https://github.com/QingWei-Li/docsify/issues/556)) ([a5f333a](https://github.com/QingWei-Li/docsify/commit/a5f333a)) -## 1.2.0 ### Features -- custom basePath -- custom homepage -## 1.1.7 -### Bug fixes -- Optimize progress bar +- add logo option, [#264](https://github.com/QingWei-Li/docsify/issues/264) ([#541](https://github.com/QingWei-Li/docsify/issues/541)) ([ee72dd0](https://github.com/QingWei-Li/docsify/commit/ee72dd0)) +- add unpkg field, close [#531](https://github.com/QingWei-Li/docsify/issues/531) ([#558](https://github.com/QingWei-Li/docsify/issues/558)) ([5c0de0a](https://github.com/QingWei-Li/docsify/commit/5c0de0a)) +- support image resizing, resolve [#508](https://github.com/QingWei-Li/docsify/issues/508) ([#545](https://github.com/QingWei-Li/docsify/issues/545)) ([3a7ad62](https://github.com/QingWei-Li/docsify/commit/3a7ad62)) + + + +## [4.6.10](https://github.com/QingWei-Li/docsify/compare/v4.6.9...v4.6.10) (2018-03-25) + +### Bug Fixes + +- async install config, fixed [#425](https://github.com/QingWei-Li/docsify/issues/425) ([e4e011c](https://github.com/QingWei-Li/docsify/commit/e4e011c)) + + + +## [4.6.9](https://github.com/QingWei-Li/docsify/compare/v4.6.8...v4.6.9) (2018-03-10) + +### Bug Fixes + +- upgrade medium-zoom, fixed [#417](https://github.com/QingWei-Li/docsify/issues/417) ([6a3d69a](https://github.com/QingWei-Li/docsify/commit/6a3d69a)) + + + +## [4.6.8](https://github.com/QingWei-Li/docsify/compare/v4.6.7...v4.6.8) (2018-03-06) + +### Bug Fixes + +- resolve path of image and embed files, fixed [#412](https://github.com/QingWei-Li/docsify/issues/412) ([bfd0d18](https://github.com/QingWei-Li/docsify/commit/bfd0d18)) + + + +## [4.6.7](https://github.com/QingWei-Li/docsify/compare/v4.6.6...v4.6.7) (2018-03-03) + +### Bug Fixes + +- layout css, fixed [#409](https://github.com/QingWei-Li/docsify/issues/409) ([aeb692e](https://github.com/QingWei-Li/docsify/commit/aeb692e)) + + + +## [4.6.6](https://github.com/QingWei-Li/docsify/compare/v4.6.5...v4.6.6) (2018-03-03) + + + +## [4.6.5](https://github.com/QingWei-Li/docsify/compare/v4.6.4...v4.6.5) (2018-03-03) + +### Bug Fixes + +- **navbar:** Now Navbar isn't append to DOM when loadNavbar is falsy ([#407](https://github.com/QingWei-Li/docsify/issues/407)) ([0933445](https://github.com/QingWei-Li/docsify/commit/0933445)) -## 1.1.6 ### Features -- Add logo 😂 -### Bug fixes -- Remove table background color -- Fixed highlight sidebar using chinese ids +- **config:** Add 404 page options. ([#406](https://github.com/QingWei-Li/docsify/issues/406)) ([9b3b445](https://github.com/QingWei-Li/docsify/commit/9b3b445)) + + + +## [4.6.4](https://github.com/QingWei-Li/docsify/compare/v4.6.3...v4.6.4) (2018-03-01) + +### Bug Fixes + +- **render:** Disable markdown parsing when the file is an HTML ([#403](https://github.com/QingWei-Li/docsify/issues/403)) ([278a75e](https://github.com/QingWei-Li/docsify/commit/278a75e)) -## 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 +- **fetch:** Add fallback languages configuration. ([#402](https://github.com/QingWei-Li/docsify/issues/402)) ([ecc0e04](https://github.com/QingWei-Li/docsify/commit/ecc0e04)) -## 1.1.4 -### Bug fixes -- Fixed chinese auchor link + -## 1.1.3 -### Bug fixes -- Optimize progress bar again +## [4.6.3](https://github.com/QingWei-Li/docsify/compare/v4.6.2...v4.6.3) (2018-02-15) -## 1.1.2 -### Bug fixes -- fix failed `auto2top` in mobile +### Bug Fixes +- **hook:** beforeEach don\'t work, fixed [#393](https://github.com/QingWei-Li/docsify/issues/393) ([6a09059](https://github.com/QingWei-Li/docsify/commit/6a09059)) -## 1.1.1 -### Bug fixes -- Optimize progress bar + -## 1.1.0 -## Features -- Add progress bar -- Add `auto2top` option for hash router +## [4.6.2](https://github.com/QingWei-Li/docsify/compare/v4.6.1...v4.6.2) (2018-02-14) -## 1.0.3 -### Bug fixes -- Fix cache +### Bug Fixes -## 1.0.2 -### Bug fixes -- Fix binding events bug, fixed #24 -- Fix regular expression, fixed #23 +- **embed:** broken in IE, fixed [#389](https://github.com/QingWei-Li/docsify/issues/389), fixed [#391](https://github.com/QingWei-Li/docsify/issues/391) ([45a7464](https://github.com/QingWei-Li/docsify/commit/45a7464)) +- **embed:** init value ([890a7bf](https://github.com/QingWei-Li/docsify/commit/890a7bf)) -## 1.0.1 -### Bug fixes -- `img` style + -## 1.0.0 -## Features -- Support hash router +## [4.6.1](https://github.com/QingWei-Li/docsify/compare/v4.6.0...v4.6.1) (2018-02-12) -### Bug fixes -- Improved scrolling on mobile +### Bug Fixes -## 0.7.0 -### Breaking change -- `themes/` was removed, only exists in the npm package. +- **embed** compatible ssr ([dc0c3ce](https://github.com/QingWei-Li/docsify/commit/dc0c3ce)) +- **embed** async fetch embed files, fixed [#387](https://github.com/QingWei-Li/docsify/issues/387) -### 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. +# [4.6.0](https://github.com/QingWei-Li/docsify/compare/v4.5.9...v4.6.0) (2018-02-11) + +### Bug Fixes + +- **search:** custom clear button, fixed [#271](https://github.com/QingWei-Li/docsify/issues/271) ([864aa18](https://github.com/QingWei-Li/docsify/commit/864aa18)) +- **search:** escape special characters for search, fixed [#369](https://github.com/QingWei-Li/docsify/issues/369) ([9755439](https://github.com/QingWei-Li/docsify/commit/9755439)) +- build config ([342438f](https://github.com/QingWei-Li/docsify/commit/342438f)) +- button style for coverpage, fixed [#362](https://github.com/QingWei-Li/docsify/issues/362) ([85428ef](https://github.com/QingWei-Li/docsify/commit/85428ef)) +- dropdown scroll style, fixed [#346](https://github.com/QingWei-Li/docsify/issues/346) ([c4d83f2](https://github.com/QingWei-Li/docsify/commit/c4d83f2)) +- highlight homepage link, fixed [#304](https://github.com/QingWei-Li/docsify/issues/304) ([f960c19](https://github.com/QingWei-Li/docsify/commit/f960c19)) +- homepage link ([e097f88](https://github.com/QingWei-Li/docsify/commit/e097f88)) +- onlyCover ([033be4f](https://github.com/QingWei-Li/docsify/commit/033be4f)) +- ssr compatible embedd ([ebc10c4](https://github.com/QingWei-Li/docsify/commit/ebc10c4)) +- ssr coverpage, fixed [#273](https://github.com/QingWei-Li/docsify/issues/273) ([9e824a4](https://github.com/QingWei-Li/docsify/commit/9e824a4)) -## 0.6.0 ### Features -- Navbar support dropdown list, #6 -- Sidebar with toggle -### Bug fixes -- Fix ineffective option, fixed #10 +- click sidebar menu add collapse and expand, close [#294](https://github.com/QingWei-Li/docsify/issues/294) ([5e161a1](https://github.com/QingWei-Li/docsify/commit/5e161a1)) +- **compiler:** support embedded file as code block, close [#134](https://github.com/QingWei-Li/docsify/issues/134) ([761ccc2](https://github.com/QingWei-Li/docsify/commit/761ccc2)) +- **compiler:** support embedded markdown, html, video, etc files, close [#383](https://github.com/QingWei-Li/docsify/issues/383), close [#333](https://github.com/QingWei-Li/docsify/issues/333) ([524f52f](https://github.com/QingWei-Li/docsify/commit/524f52f)) +- **cover:** add onlyCover option, close [#382](https://github.com/QingWei-Li/docsify/issues/382) ([b265fdd](https://github.com/QingWei-Li/docsify/commit/b265fdd)) +- **fetch:** add requestHeaders option, fixed [#336](https://github.com/QingWei-Li/docsify/issues/336) ([54ab4c9](https://github.com/QingWei-Li/docsify/commit/54ab4c9)) +- **render:** add ext option for custom file extenstion, close [#340](https://github.com/QingWei-Li/docsify/issues/340) ([248aa72](https://github.com/QingWei-Li/docsify/commit/248aa72)) +- **render:** mutilple coverpage, close [#315](https://github.com/QingWei-Li/docsify/issues/315) ([f68ddf5](https://github.com/QingWei-Li/docsify/commit/f68ddf5)) + + + +## [4.5.9](https://github.com/QingWei-Li/docsify/compare/v4.5.8...v4.5.9) (2018-02-07) + +### Bug Fixes + +- upgrade marked ([4157173](https://github.com/QingWei-Li/docsify/commit/4157173)) + + + +## [4.5.8](https://github.com/QingWei-Li/docsify/compare/v4.5.6...v4.5.8) (2018-02-07) + +### Bug Fixes + +- cover style, fixed [#381](https://github.com/QingWei-Li/docsify/issues/381) ([368754e](https://github.com/QingWei-Li/docsify/commit/368754e)) +- updated deps ([#337](https://github.com/QingWei-Li/docsify/issues/337)) ([a12d393](https://github.com/QingWei-Li/docsify/commit/a12d393)) + + + +## [4.5.7](https://github.com/QingWei-Li/docsify/compare/v4.5.6...v4.5.7) (2017-12-29) -## 0.5.0 ### Features -- Custom sidebars and navbars by markdown file -## 0.4.2 -### Bug fixes -- Correct catch ajax error +- add navigation plugin, closed [#180](https://github.com/QingWei-Li/docsify/issues/180) ([f78be4c](https://github.com/QingWei-Li/docsify/commit/f78be4c)) -## 0.4.1 -### Bug fixes -- catch ajax error + + +## [4.5.6](https://github.com/QingWei-Li/docsify/compare/v4.5.3...v4.5.6) (2017-12-14) + +### Bug Fixes + +- **style:** increase the tap targets of menu button, fixed [#325](https://github.com/QingWei-Li/docsify/issues/325) ([888f217](https://github.com/QingWei-Li/docsify/commit/888f217)) + + + +## [4.5.5](https://github.com/QingWei-Li/docsify/compare/v4.5.4...v4.5.5) (2017-11-30) + +### Bug Fixes + +- disqus plugin issue ([#318](https://github.com/QingWei-Li/docsify/issues/318)) ([041b33e](https://github.com/QingWei-Li/docsify/commit/041b33e)), closes [#317](https://github.com/QingWei-Li/docsify/issues/317) + + + +## [4.5.4](https://github.com/QingWei-Li/docsify/compare/v4.5.2...v4.5.4) (2017-11-29) + +### Bug Fixes + +- **compiler:** task lists style, fixed [#215](https://github.com/QingWei-Li/docsify/issues/215) ([e43ded4](https://github.com/QingWei-Li/docsify/commit/e43ded4)) -## 0.4.0 ### Features -- Custom sidebar -### Bug fixes -- Fix undefined language +- add gitalk plugin ([#306](https://github.com/QingWei-Li/docsify/issues/306)) ([9208e64](https://github.com/QingWei-Li/docsify/commit/9208e64)) -## 0.3.1 -### Bug fixes -- Strip HTML tag when rendering the headings + + +## [4.5.3](https://github.com/QingWei-Li/docsify/compare/v4.5.2...v4.5.3) (2017-11-11) -## 0.3.0 ### Features -- Add minified css files -- Add max level option -- Add pure.css -## 0.2.1 -### Bug fixes -- Fix vue.css +- add gitalk plugin ([#306](https://github.com/QingWei-Li/docsify/issues/306)) ([9208e64](https://github.com/QingWei-Li/docsify/commit/9208e64)) -## 0.2.0 -### Bug fixes -- Fix route -- Remove dynamic title + + +## [4.5.2](https://github.com/QingWei-Li/docsify/compare/v4.5.1...v4.5.2) (2017-11-09) -## 0.1.0 ### Features -- Add buble.css \ No newline at end of file + +- github task lists, close [#215](https://github.com/QingWei-Li/docsify/issues/215) ([#305](https://github.com/QingWei-Li/docsify/issues/305)) ([d486eef](https://github.com/QingWei-Li/docsify/commit/d486eef)) + + + +## [4.5.1](https://github.com/QingWei-Li/docsify/compare/v4.5.0...v4.5.1) (2017-11-07) + +### Features + +- fetch files with the query params, fixed [#303](https://github.com/QingWei-Li/docsify/issues/303) ([2a2ed96](https://github.com/QingWei-Li/docsify/commit/2a2ed96)) + + + +# [4.5.0](https://github.com/QingWei-Li/docsify/compare/v4.4.1...v4.5.0) (2017-11-04) + +### Features + +- add disqus plugin, closed [#123](https://github.com/QingWei-Li/docsify/issues/123) ([fd7d4e0](https://github.com/QingWei-Li/docsify/commit/fd7d4e0)) + + + +## [4.4.1](https://github.com/QingWei-Li/docsify/compare/v4.4.0...v4.4.1) (2017-10-31) + +### Bug Fixes + +- {docsify-ignore-all} and {docsify-ignore} bug ([#299](https://github.com/QingWei-Li/docsify/issues/299)) ([cc98f56](https://github.com/QingWei-Li/docsify/commit/cc98f56)) +- zoom image plugin issue, fixed [#187](https://github.com/QingWei-Li/docsify/issues/187) ([#300](https://github.com/QingWei-Li/docsify/issues/300)) ([fa772cf](https://github.com/QingWei-Li/docsify/commit/fa772cf)) + + + +# [4.4.0](https://github.com/QingWei-Li/docsify/compare/v4.3.15...v4.4.0) (2017-10-30) + +### Bug Fixes + +- sidebar style issue on firefox, fixed [#184](https://github.com/QingWei-Li/docsify/issues/184) ([#297](https://github.com/QingWei-Li/docsify/issues/297)) ([36bfc9d](https://github.com/QingWei-Li/docsify/commit/36bfc9d)) + +### Features + +- add helper for disabled link, fixed [#295](https://github.com/QingWei-Li/docsify/issues/295) ([#296](https://github.com/QingWei-Li/docsify/issues/296)) ([4ad96f3](https://github.com/QingWei-Li/docsify/commit/4ad96f3)) + + + +## [4.3.15](https://github.com/QingWei-Li/docsify/compare/v4.3.14...v4.3.15) (2017-10-20) + +### Bug Fixes + +- scroll active sidebar ([a2b8eae](https://github.com/QingWei-Li/docsify/commit/a2b8eae)) + + + +## [4.3.14](https://github.com/QingWei-Li/docsify/compare/v4.3.13...v4.3.14) (2017-10-20) + +### Bug Fixes + +- codesponsor style ([ab68268](https://github.com/QingWei-Li/docsify/commit/ab68268)) + + + +## [4.3.13](https://github.com/QingWei-Li/docsify/compare/v4.3.12...v4.3.13) (2017-10-17) + +### Bug Fixes + +- duplicate results in search fixed [#257](https://github.com/QingWei-Li/docsify/issues/257) ([#284](https://github.com/QingWei-Li/docsify/issues/284)) ([3476f6f](https://github.com/QingWei-Li/docsify/commit/3476f6f)) + +### Features + +- make whole search result clickable ([#285](https://github.com/QingWei-Li/docsify/issues/285)) ([1b91227](https://github.com/QingWei-Li/docsify/commit/1b91227)) + + + +## [4.3.12](https://github.com/QingWei-Li/docsify/compare/v4.3.11...v4.3.12) (2017-10-15) + +### Bug Fixes + +- incorrect active link ([#281](https://github.com/QingWei-Li/docsify/issues/281)) ([a3ab379](https://github.com/QingWei-Li/docsify/commit/a3ab379)) + + + +## [4.3.11](https://github.com/QingWei-Li/docsify/compare/v4.3.10...v4.3.11) (2017-10-15) + +### Bug Fixes + +- broken links to same page heading, fix [#278](https://github.com/QingWei-Li/docsify/issues/278), fix [#279](https://github.com/QingWei-Li/docsify/issues/279) ([91d6337](https://github.com/QingWei-Li/docsify/commit/91d6337)) + + + +## [4.3.10](https://github.com/QingWei-Li/docsify/compare/v4.3.9...v4.3.10) (2017-10-12) + +### Bug Fixes + +- link render issue after page refreshing ([#276](https://github.com/QingWei-Li/docsify/issues/276)) ([abd885e](https://github.com/QingWei-Li/docsify/commit/abd885e)) + + + +## [4.3.9](https://github.com/QingWei-Li/docsify/compare/v4.3.8...v4.3.9) (2017-10-11) + +### Bug Fixes + +- scroll issue in IE ([#275](https://github.com/QingWei-Li/docsify/issues/275)) ([3e94cb6](https://github.com/QingWei-Li/docsify/commit/3e94cb6)) + + + +## [4.3.8](https://github.com/QingWei-Li/docsify/compare/v4.3.7...v4.3.8) (2017-10-07) + +### Bug Fixes + +- **slugify:** GitHub compatible heading links, fixed [#272](https://github.com/QingWei-Li/docsify/issues/272) ([9b4e666](https://github.com/QingWei-Li/docsify/commit/9b4e666)) + + + +## [4.3.7](https://github.com/QingWei-Li/docsify/compare/v4.3.6...v4.3.7) (2017-10-02) + +### Bug Fixes + +- **slugify:** GitHub compatible heading links, fixed [#267](https://github.com/QingWei-Li/docsify/issues/267) ([c195d2d](https://github.com/QingWei-Li/docsify/commit/c195d2d)) + + + +## [4.3.6](https://github.com/QingWei-Li/docsify/compare/v4.3.5...v4.3.6) (2017-09-21) + +### Bug Fixes + +- style for codesponsor plugin ([08afec7](https://github.com/QingWei-Li/docsify/commit/08afec7)) + + + +## [4.3.5](https://github.com/QingWei-Li/docsify/compare/v4.3.4...v4.3.5) (2017-09-20) + +### Bug Fixes + +- missed symbol ([#254](https://github.com/QingWei-Li/docsify/issues/254)) ([6c702d3](https://github.com/QingWei-Li/docsify/commit/6c702d3)) + +### Features + +- **plugin:** add codesponsor plugin ([46ac4c3](https://github.com/QingWei-Li/docsify/commit/46ac4c3)) + + + +## [4.3.4](https://github.com/QingWei-Li/docsify/compare/v4.3.3...v4.3.4) (2017-09-07) + +### Bug Fixes + +- scroll position issue, fixed [#234](https://github.com/QingWei-Li/docsify/issues/234) ([388ed3d](https://github.com/QingWei-Li/docsify/commit/388ed3d)) + + + +## [4.3.3](https://github.com/QingWei-Li/docsify/compare/v4.3.2...v4.3.3) (2017-09-06) + +### Bug Fixes + +- **buble.css:** tweaks code block style, fixed [#249](https://github.com/QingWei-Li/docsify/issues/249) ([9d43051](https://github.com/QingWei-Li/docsify/commit/9d43051)) + +### Features + +- add doc for react and vue demo box plugin ([#247](https://github.com/QingWei-Li/docsify/issues/247)) ([f0aca19](https://github.com/QingWei-Li/docsify/commit/f0aca19)) + + + +## [4.3.2](https://github.com/QingWei-Li/docsify/compare/v4.3.1...v4.3.2) (2017-09-01) + +### Bug Fixes + +- sidebar highlight ([f82f419](https://github.com/QingWei-Li/docsify/commit/f82f419)) + +### Features + +- add Edit on github plugin (thanks [@njleonzhang](https://github.com/njleonzhang)) ([a0e1ea8](https://github.com/QingWei-Li/docsify/commit/a0e1ea8)) + + + +## [4.3.1](https://github.com/QingWei-Li/docsify/compare/v4.2.9...v4.3.1) (2017-08-30) + +### Features + +- **markdown:** supports mermaid [#137](https://github.com/QingWei-Li/docsify/issues/137) ([f4800e0](https://github.com/QingWei-Li/docsify/commit/f4800e0)) + + + +# [4.3.0](https://github.com/QingWei-Li/docsify/compare/v4.2.9...v4.3.0) (2017-08-17) + +### Features + +- **markdown:** supports mermaid [#137](https://github.com/QingWei-Li/docsify/issues/137) ([f4800e0](https://github.com/QingWei-Li/docsify/commit/f4800e0)) + + + +## [4.2.9](https://github.com/QingWei-Li/docsify/compare/v4.2.8...v4.2.9) (2017-08-15) + +### Bug Fixes + +- ensure document ready before init Docsify [#233](https://github.com/QingWei-Li/docsify/issues/233) + + + +## [4.2.8](https://github.com/QingWei-Li/docsify/compare/v4.2.7...v4.2.8) (2017-08-10) + +### Features + +- **compiler:** support for setting target attribute for link, fixed [#230](https://github.com/QingWei-Li/docsify/issues/230) ([7f270f9](https://github.com/QingWei-Li/docsify/commit/7f270f9)) + + + +## [4.2.7](https://github.com/QingWei-Li/docsify/compare/v4.2.4...v4.2.7) (2017-08-05) + +### Bug Fixes + +- **release:** release shell ([628e211](https://github.com/QingWei-Li/docsify/commit/628e211)) +- **style:** nowrap => pre-wrap, fixed [#228](https://github.com/QingWei-Li/docsify/issues/228) ([a88252c](https://github.com/QingWei-Li/docsify/commit/a88252c)) + + + +## [4.2.6](https://github.com/QingWei-Li/docsify/compare/v4.2.4...v4.2.6) (2017-07-27) + +### Bug Fixes + +- **css:** hide the nav when the content has not yet been loaded ([1fa1619](https://github.com/QingWei-Li/docsify/commit/1fa1619)) +- **release:** release shell ([628e211](https://github.com/QingWei-Li/docsify/commit/628e211)) + + + +## [4.2.4](https://github.com/QingWei-Li/docsify/compare/v4.2.2...v4.2.4) (2017-07-26) + +### Bug Fixes + +- **render:** Remove getRootNode to be compatible with the lower version of Chrome, fixed [#225](https://github.com/QingWei-Li/docsify/issues/225) ([b8dd346](https://github.com/QingWei-Li/docsify/commit/b8dd346)) + + + +## [4.2.3](https://github.com/QingWei-Li/docsify/compare/v4.2.2...v4.2.3) (2017-07-26) + +### Features + +- **search:** Supports the max depth of the search headline, fixed [#223](https://github.com/QingWei-Li/docsify/issues/223), resolve [#129](https://github.com/QingWei-Li/docsify/issues/129) ([b7b589b](https://github.com/QingWei-Li/docsify/commit/b7b589b)) + + + +## [4.2.2](https://github.com/QingWei-Li/docsify/compare/v4.2.1...v4.2.2) (2017-07-24) + +### Bug Fixes + +- style rerender due to setting themeColor ([17ff3d1](https://github.com/QingWei-Li/docsify/commit/17ff3d1)) + + + +## [4.2.1](https://github.com/QingWei-Li/docsify/compare/v4.2.0...v4.2.1) (2017-07-19) + +- give the navbar some line-height (#216) +- Remove unnecessary moduleName option from rollup config for plugins (#209) + + + +# [4.2.0](https://github.com/QingWei-Li/docsify/compare/v4.1.14...v4.2.0) (2017-07-10) + +### Bug Fixes + +- not found page ([9af8559](https://github.com/QingWei-Li/docsify/commit/9af8559)) + +### Features + +- alias option supports regexp, resolve [#183](https://github.com/QingWei-Li/docsify/issues/183) ([c4aa22c](https://github.com/QingWei-Li/docsify/commit/c4aa22c)) +- ignore to compiled link, fixed [#203](https://github.com/QingWei-Li/docsify/issues/203) ([#204](https://github.com/QingWei-Li/docsify/issues/204)) ([2e00f4c](https://github.com/QingWei-Li/docsify/commit/2e00f4c)) + + + +## [4.1.14](https://github.com/QingWei-Li/docsify/compare/v4.1.13...v4.1.14) (2017-06-24) + +### Bug Fixes + +- get file path, fixed jrappen/sublime-distractionless/commit/81bfadd391428823191cc03eca956a2312e04d13#commitcomment-22427070 ([e8117e5](https://github.com/QingWei-Li/docsify/commit/e8117e5)), closes [jrappen/sublime-distractionless/commit/81bfadd391428823191cc03eca956a2312e04d13#commitcomment-22427070](https://github.com/jrappen/sublime-distractionless/commit/81bfadd391428823191cc03eca956a2312e04d13/issues/commitcomment-22427070) + +### Features + +- add context attribute, fixed [#191](https://github.com/QingWei-Li/docsify/issues/191) ([ce0e9ac](https://github.com/QingWei-Li/docsify/commit/ce0e9ac)) + + + +## [4.1.13](https://github.com/QingWei-Li/docsify/compare/v4.1.12...v4.1.13) (2017-06-11) + + + +## [4.1.12](https://github.com/QingWei-Li/docsify/compare/v4.1.11...v4.1.12) (2017-06-03) + +### Bug Fixes + +- **render:** subtitle in side bar shows undefined, fixed [#182](https://github.com/QingWei-Li/docsify/issues/182) ([d087d57](https://github.com/QingWei-Li/docsify/commit/d087d57)) + + + +## [4.1.11](https://github.com/QingWei-Li/docsify/compare/v4.1.10...v4.1.11) (2017-06-02) + +### Bug Fixes + +- **compiler:** force reset toc when rendering sidebar fixed [#181](https://github.com/QingWei-Li/docsify/issues/181) ([ccf4c7c](https://github.com/QingWei-Li/docsify/commit/ccf4c7c)) +- **render:** autoHeader does not work ([1304d2e](https://github.com/QingWei-Li/docsify/commit/1304d2e)) + + + +## [4.1.10](https://github.com/QingWei-Li/docsify/compare/v4.1.9...v4.1.10) (2017-06-02) + +### Bug Fixes + +- **hash:** hash routing crashes when url has querystring ([6d48ce1](https://github.com/QingWei-Li/docsify/commit/6d48ce1)) + + + +## [4.1.9](https://github.com/QingWei-Li/docsify/compare/v4.1.8...v4.1.9) (2017-05-31) + +### Bug Fixes + +- can't render toc on first load ([d9b487e](https://github.com/QingWei-Li/docsify/commit/d9b487e)) +- **lifecycle:** continue to handle data ([955d3d5](https://github.com/QingWei-Li/docsify/commit/955d3d5)) +- **render:** broken name link, fixed [#167](https://github.com/QingWei-Li/docsify/issues/167) ([91b66a5](https://github.com/QingWei-Li/docsify/commit/91b66a5)) + + + +## [4.1.8](https://github.com/QingWei-Li/docsify/compare/v4.1.7...v4.1.8) (2017-05-31) + +### Bug Fixes + +- auto replace version ([22b50f0](https://github.com/QingWei-Li/docsify/commit/22b50f0)) +- update edit button demo ([ec887c1](https://github.com/QingWei-Li/docsify/commit/ec887c1)) + +### Features + +- add edit button demo ([a64cee1](https://github.com/QingWei-Li/docsify/commit/a64cee1)) +- add edit button demo, close [#162](https://github.com/QingWei-Li/docsify/issues/162) ([036fdac](https://github.com/QingWei-Li/docsify/commit/036fdac)) + + + +## [4.1.7](https://github.com/QingWei-Li/docsify/compare/v4.1.6...v4.1.7) (2017-05-30) + +### Bug Fixes + +- **ssr:** clean files ([0014895](https://github.com/QingWei-Li/docsify/commit/0014895)) + + + +## [4.1.6](https://github.com/QingWei-Li/docsify/compare/v4.1.5...v4.1.6) (2017-05-30) + +### Bug Fixes + +- **ssr:** add debug ([6b9e092](https://github.com/QingWei-Li/docsify/commit/6b9e092)) + + + +## [4.1.5](https://github.com/QingWei-Li/docsify/compare/v4.1.4...v4.1.5) (2017-05-30) + +### Bug Fixes + +- **ssr:** missing package ([6db8c9e](https://github.com/QingWei-Li/docsify/commit/6db8c9e)) + + + +## [4.1.4](https://github.com/QingWei-Li/docsify/compare/v4.1.3...v4.1.4) (2017-05-30) + +### Bug Fixes + +- **ssr:** file path ([79a83bc](https://github.com/QingWei-Li/docsify/commit/79a83bc)) + + + +## [4.1.3](https://github.com/QingWei-Li/docsify/compare/v4.1.2...v4.1.3) (2017-05-30) + +### Bug Fixes + +- update babel config ([9825db4](https://github.com/QingWei-Li/docsify/commit/9825db4)) + + + +## [4.1.2](https://github.com/QingWei-Li/docsify/compare/v4.1.1...v4.1.2) (2017-05-30) + +### Bug Fixes + +- update babel config ([80dba19](https://github.com/QingWei-Li/docsify/commit/80dba19)) + + + +## [4.1.1](https://github.com/QingWei-Li/docsify/compare/v4.1.0...v4.1.1) (2017-05-30) + +### Bug Fixes + +- build for ssr package ([4cb20a5](https://github.com/QingWei-Li/docsify/commit/4cb20a5)) +- remove history mode ([0e74e6c](https://github.com/QingWei-Li/docsify/commit/0e74e6c)) + + + +# [4.1.0](https://github.com/QingWei-Li/docsify/compare/v4.0.2...v4.1.0) (2017-05-30) + + + +## [4.0.2](https://github.com/QingWei-Li/docsify/compare/v4.0.1...v4.0.2) (2017-05-30) + +### Bug Fixes + +- basePath for history mode ([fc1cd3f](https://github.com/QingWei-Li/docsify/commit/fc1cd3f)) + + + +## [4.0.1](https://github.com/QingWei-Li/docsify/compare/v4.0.0...v4.0.1) (2017-05-29) + +### Bug Fixes + +- **ssr:** remove context ([4626157](https://github.com/QingWei-Li/docsify/commit/4626157)) +- lint ([b764b6e](https://github.com/QingWei-Li/docsify/commit/b764b6e)) + + + +# [4.0.0](https://github.com/QingWei-Li/docsify/compare/v3.7.3...v4.0.0) (2017-05-29) + +### Bug Fixes + +- **render:** init event in ssr ([eba1c98](https://github.com/QingWei-Li/docsify/commit/eba1c98)) +- lint ([1f4514d](https://github.com/QingWei-Li/docsify/commit/1f4514d)) + +### Features + +- finish ssr ([3444884](https://github.com/QingWei-Li/docsify/commit/3444884)) +- init ocsify-server-renderer ([6dea685](https://github.com/QingWei-Li/docsify/commit/6dea685)) +- support history mode ([f095eb8](https://github.com/QingWei-Li/docsify/commit/f095eb8)) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..77d2ce7 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,67 @@ +# Contribute + +## Introduction + +First, thank you for considering contributing to docsify! It's people like you that make the open source community such a great community! 😊 + +We welcome any type of contribution, not only code. You can help with +- **QA**: file bug reports, the more details you can give the better (e.g. screenshots with the console open) +- **Marketing**: writing blog posts, howto's, printing stickers, ... +- **Community**: presenting the project at meetups, organizing a dedicated meetup for the local community, ... +- **Code**: take a look at the [open issues](issues). Even if you can't write code, commenting on them, showing that you care about a given issue matters. It helps us triage them. +- **Money**: we welcome financial contributions in full transparency on our [open collective](https://opencollective.com/docsify). + +## Your First Contribution + +Working on your first Pull Request? You can learn how from this *free* series, [How to Contribute to an Open Source Project on GitHub](https://egghead.io/series/how-to-contribute-to-an-open-source-project-on-github). + +## Submitting code + +Any code change should be submitted as a pull request. The description should explain what the code does and give steps to execute it. The pull request should also contain tests. + +## Code review process + +The bigger the pull request, the longer it will take to review and merge. Try to break down large pull requests in smaller chunks that are easier to review and merge. +It is also always helpful to have some context for your pull request. What was the purpose? Why does it matter to you? + +## Financial contributions + +We also welcome financial contributions in full transparency on our [open collective](https://opencollective.com/docsify). +Anyone can file an expense. If the expense makes sense for the development of the community, it will be "merged" in the ledger of our open collective by the core contributors and the person who filed the expense will be reimbursed. + +## Questions + +If you have any questions, create an [issue](issue) (protip: do a quick search first to see if someone else didn't ask the same question before!). +You can also reach us at hello@docsify.opencollective.com. + +## Credits + +### Contributors + +Thank you to all the people who have already contributed to docsify! + + + +### Backers + +Thank you to all our backers! [[Become a backer](https://opencollective.com/docsify#backer)] + + + + +### Sponsors + +Thank you to all our sponsors! (please ask your company to also support this open source project by [becoming a sponsor](https://opencollective.com/docsify#sponsor)) + + + + + + + + + + + + + \ No newline at end of file diff --git a/HISTORY.md b/HISTORY.md new file mode 100644 index 0000000..fb720fd --- /dev/null +++ b/HISTORY.md @@ -0,0 +1,736 @@ + + +## [3.7.3](https://github.com/QingWei-Li/docsify/compare/v3.7.2...v3.7.3) (2017-05-22) + + +### Bug Fixes + +* **render:** find => filter ([eca3368](https://github.com/QingWei-Li/docsify/commit/eca3368)) + + + + +## [3.7.2](https://github.com/QingWei-Li/docsify/compare/v3.7.1...v3.7.2) (2017-05-19) + + + + +## [3.7.1](https://github.com/QingWei-Li/docsify/compare/v3.7.0...v3.7.1) (2017-05-19) + + +### Bug Fixes + +* docsify-updated is undefined ([b2b4742](https://github.com/QingWei-Li/docsify/commit/b2b4742)) + + + + +# [3.7.0](https://github.com/QingWei-Li/docsify/compare/v3.6.6...v3.7.0) (2017-05-16) + + +### Features + +* add docsify-updated, close [#158](https://github.com/QingWei-Li/docsify/issues/158) ([d2be5ae](https://github.com/QingWei-Li/docsify/commit/d2be5ae)) +* add externalLinkTarget, close [#149](https://github.com/QingWei-Li/docsify/issues/149) ([2d73285](https://github.com/QingWei-Li/docsify/commit/2d73285)) + + + + +## [3.6.6](https://github.com/QingWei-Li/docsify/compare/v3.6.5...v3.6.6) (2017-05-06) + + +### Features + +* support query string for the search, fixed [#156](https://github.com/QingWei-Li/docsify/issues/156) ([da75d70](https://github.com/QingWei-Li/docsify/commit/da75d70)) + + + + +## [3.6.5](https://github.com/QingWei-Li/docsify/compare/v3.6.4...v3.6.5) (2017-04-28) + + +### Bug Fixes + +* **util:** fix crash, fixed [#154](https://github.com/QingWei-Li/docsify/issues/154) ([51832d3](https://github.com/QingWei-Li/docsify/commit/51832d3)) + + + + +## [3.6.4](https://github.com/QingWei-Li/docsify/compare/v3.6.3...v3.6.4) (2017-04-28) + + +### Bug Fixes + +* **util:** correctly clean up duplicate slashes, fixed [#153](https://github.com/QingWei-Li/docsify/issues/153) ([76c041a](https://github.com/QingWei-Li/docsify/commit/76c041a)) + + + + +## [3.6.3](https://github.com/QingWei-Li/docsify/compare/v3.6.2...v3.6.3) (2017-04-25) + + +### Bug Fixes + +* **external-script:** script attrs ([2653849](https://github.com/QingWei-Li/docsify/commit/2653849)) + + + + +## [3.6.2](https://github.com/QingWei-Li/docsify/compare/v3.6.0...v3.6.2) (2017-04-12) + + +### Features + +* **event:** Collapse the sidebar when click outside element in the small screen ([9b7e5f5](https://github.com/QingWei-Li/docsify/commit/9b7e5f5)) +* **external-script:** detect more than one script dom, fixed [#146](https://github.com/QingWei-Li/docsify/issues/146) ([94d6603](https://github.com/QingWei-Li/docsify/commit/94d6603)) + + + + +# [3.6.0](https://github.com/QingWei-Li/docsify/compare/v3.5.2...v3.6.0) (2017-04-09) + + +### Features + +* **render:** add mergeNavbar option, close [#125](https://github.com/QingWei-Li/docsify/issues/125), [#124](https://github.com/QingWei-Li/docsify/issues/124) ([#145](https://github.com/QingWei-Li/docsify/issues/145)) ([9220523](https://github.com/QingWei-Li/docsify/commit/9220523)) + + + + +## [3.5.2](https://github.com/QingWei-Li/docsify/compare/v3.5.1...v3.5.2) (2017-04-05) + + + + +## [3.5.1](https://github.com/QingWei-Li/docsify/compare/v3.5.0...v3.5.1) (2017-03-25) + + +### Bug Fixes + +* .md file extension regex ([594299f](https://github.com/QingWei-Li/docsify/commit/594299f)) + + + + +# [3.5.0](https://github.com/QingWei-Li/docsify/compare/v3.4.4...v3.5.0) (2017-03-25) + + +### Bug Fixes + +* adjust display on small screens ([bf35471](https://github.com/QingWei-Li/docsify/commit/bf35471)) +* navbar labels for German ([b022aaf](https://github.com/QingWei-Li/docsify/commit/b022aaf)) + + +### Features + +* **route:** auto remove .md extension ([8f11653](https://github.com/QingWei-Li/docsify/commit/8f11653)) + + + + +## [3.4.4](https://github.com/QingWei-Li/docsify/compare/v3.4.3...v3.4.4) (2017-03-17) + + +### Bug Fixes + +* **search:** fix input style ([2d6a51b](https://github.com/QingWei-Li/docsify/commit/2d6a51b)) + + + + +## [3.4.3](https://github.com/QingWei-Li/docsify/compare/v3.4.2...v3.4.3) (2017-03-16) + + + + +## [3.4.2](https://github.com/QingWei-Li/docsify/compare/v3.4.1...v3.4.2) (2017-03-11) + + +### Features + +* **emojify:** add no-emoji option ([3aef37a](https://github.com/QingWei-Li/docsify/commit/3aef37a)) + + + + +## [3.4.1](https://github.com/QingWei-Li/docsify/compare/v3.4.0...v3.4.1) (2017-03-10) + + +### Bug Fixes + +* **dom:** Disable the dom cache when vue is present, fixed [#119](https://github.com/QingWei-Li/docsify/issues/119) ([b9a7275](https://github.com/QingWei-Li/docsify/commit/b9a7275)) + + + + +# [3.4.0](https://github.com/QingWei-Li/docsify/compare/v3.3.0...v3.4.0) (2017-03-09) + + +### Features + +* **zoom-image:** add plugin ([50fa6fc](https://github.com/QingWei-Li/docsify/commit/50fa6fc)) + + + + +# [3.3.0](https://github.com/QingWei-Li/docsify/compare/v3.2.0...v3.3.0) (2017-03-07) + + + + +# [3.2.0](https://github.com/QingWei-Li/docsify/compare/v3.1.2...v3.2.0) (2017-02-28) + + +### Bug Fixes + +* **fetch:** load sidebar and navbar for parent path, fixed [#100](https://github.com/QingWei-Li/docsify/issues/100) ([f3fc596](https://github.com/QingWei-Li/docsify/commit/f3fc596)) +* **render:** Toc rendering error, fixed [#106](https://github.com/QingWei-Li/docsify/issues/106) ([0d59ee9](https://github.com/QingWei-Li/docsify/commit/0d59ee9)) + + +### Features + +* **search:** Localization for no data tip, close [#103](https://github.com/QingWei-Li/docsify/issues/103) ([d3c9fbd](https://github.com/QingWei-Li/docsify/commit/d3c9fbd)) + + + + +## [3.1.2](https://github.com/QingWei-Li/docsify/compare/v3.1.1...v3.1.2) (2017-02-27) + + + + +## [3.1.1](https://github.com/QingWei-Li/docsify/compare/v3.1.0...v3.1.1) (2017-02-24) + + +### Bug Fixes + +* **render:** custom cover background image ([8f9bf29](https://github.com/QingWei-Li/docsify/commit/8f9bf29)) +* **search:** don't search nameLink, fixed [#102](https://github.com/QingWei-Li/docsify/issues/102) ([507d9e8](https://github.com/QingWei-Li/docsify/commit/507d9e8)) +* **tpl:** extra character, fixed [#101](https://github.com/QingWei-Li/docsify/issues/101) ([d67d25f](https://github.com/QingWei-Li/docsify/commit/d67d25f)) + + + + +# [3.1.0](https://github.com/QingWei-Li/docsify/compare/v3.0.5...v3.1.0) (2017-02-22) + + +### Bug Fixes + +* **search:** incorrect anchor link, fixed [#90](https://github.com/QingWei-Li/docsify/issues/90) ([b8a3d8f](https://github.com/QingWei-Li/docsify/commit/b8a3d8f)) +* **sw:** update white list ([f2975a5](https://github.com/QingWei-Li/docsify/commit/f2975a5)) + + +### Features + +* **emoji:** add emoji plugin ([855c450](https://github.com/QingWei-Li/docsify/commit/855c450)) + + + + +## [3.0.5](https://github.com/QingWei-Li/docsify/compare/v3.0.4...v3.0.5) (2017-02-21) + + +### Bug Fixes + +* **event:** highlight sidebar when clicked, fixed [#86](https://github.com/QingWei-Li/docsify/issues/86) ([2a1157a](https://github.com/QingWei-Li/docsify/commit/2a1157a)) +* **gen-tree:** cache toc list, fixed [#88](https://github.com/QingWei-Li/docsify/issues/88) ([3394ebb](https://github.com/QingWei-Li/docsify/commit/3394ebb)) +* **layout.css:** loading style ([42b2dba](https://github.com/QingWei-Li/docsify/commit/42b2dba)) + + +### Features + +* **pwa:** add sw.js ([f7111b5](https://github.com/QingWei-Li/docsify/commit/f7111b5)) + + + + +## [3.0.4](https://github.com/QingWei-Li/docsify/compare/v3.0.3...v3.0.4) (2017-02-20) + + +### Bug Fixes + +* **render:** disable rendering sub list when loadSidebar is false ([35dd2e1](https://github.com/QingWei-Li/docsify/commit/35dd2e1)) +* **render:** execute script ([780c1e5](https://github.com/QingWei-Li/docsify/commit/780c1e5)) + + + + +## [3.0.3](https://github.com/QingWei-Li/docsify/compare/v3.0.2...v3.0.3) (2017-02-19) + + + + +## [3.0.2](https://github.com/QingWei-Li/docsify/compare/v3.0.1...v3.0.2) (2017-02-19) + + +### Bug Fixes + +* **compiler:** link ([3b127a1](https://github.com/QingWei-Li/docsify/commit/3b127a1)) +* **search:** add lazy input ([bf593a7](https://github.com/QingWei-Li/docsify/commit/bf593a7)) + + + + +## [3.0.1](https://github.com/QingWei-Li/docsify/compare/v3.0.0...v3.0.1) (2017-02-19) + + +### Bug Fixes + +* **route:** empty alias ([cd99b52](https://github.com/QingWei-Li/docsify/commit/cd99b52)) + + + + +# [3.0.0](https://github.com/QingWei-Li/docsify/compare/v2.4.3...v3.0.0) (2017-02-19) + + +### Bug Fixes + +* **compiler:** link ([c7e09c3](https://github.com/QingWei-Li/docsify/commit/c7e09c3)) +* **render:** support html file ([7b6a2ac](https://github.com/QingWei-Li/docsify/commit/7b6a2ac)) +* **search:** escape html ([fcb66e8](https://github.com/QingWei-Li/docsify/commit/fcb66e8)) +* **search:** fix default config ([2efd859](https://github.com/QingWei-Li/docsify/commit/2efd859)) + + +### Features + +* **front-matter:** add front matter[WIP] ([dbb9278](https://github.com/QingWei-Li/docsify/commit/dbb9278)) +* **render:** add auto header ([b7768b1](https://github.com/QingWei-Li/docsify/commit/b7768b1)) +* **search:** Localization for search placeholder, close [#80](https://github.com/QingWei-Li/docsify/issues/80) ([2351c3e](https://github.com/QingWei-Li/docsify/commit/2351c3e)) +* **themes:** add loading info ([86594a3](https://github.com/QingWei-Li/docsify/commit/86594a3)) + + + + +## [2.4.3](https://github.com/QingWei-Li/docsify/compare/v2.4.2...v2.4.3) (2017-02-15) + + + + +## [2.4.2](https://github.com/QingWei-Li/docsify/compare/v2.4.1...v2.4.2) (2017-02-14) + + +### Bug Fixes + +* **index:** load file path error ([dc536a3](https://github.com/QingWei-Li/docsify/commit/dc536a3)) + + + + +## [2.4.1](https://github.com/QingWei-Li/docsify/compare/v2.4.0...v2.4.1) (2017-02-13) + + +### Bug Fixes + +* **index:** cover page ([dd0c84b](https://github.com/QingWei-Li/docsify/commit/dd0c84b)) + + + + +# [2.4.0](https://github.com/QingWei-Li/docsify/compare/v2.3.0...v2.4.0) (2017-02-13) + + +### Features + +* **hook:** add doneEach ([c6f7602](https://github.com/QingWei-Li/docsify/commit/c6f7602)) + + + + +# [2.3.0](https://github.com/QingWei-Li/docsify/compare/v2.2.1...v2.3.0) (2017-02-13) + + +### Bug Fixes + +* **event:** has no effect on a FF mobile browser, fixed [#67](https://github.com/QingWei-Li/docsify/issues/67) ([0ff36c2](https://github.com/QingWei-Li/docsify/commit/0ff36c2)) +* **render:** custom marked renderer ([bf559b4](https://github.com/QingWei-Li/docsify/commit/bf559b4)) +* **render:** fix render link ([a866744](https://github.com/QingWei-Li/docsify/commit/a866744)) +* **render:** image url ([6f87529](https://github.com/QingWei-Li/docsify/commit/6f87529)) +* **render:** render link ([38ea660](https://github.com/QingWei-Li/docsify/commit/38ea660)) +* **src:** fix route ([324301a](https://github.com/QingWei-Li/docsify/commit/324301a)) +* **src:** get alias ([784173e](https://github.com/QingWei-Li/docsify/commit/784173e)) +* **src:** get alias ([ce99a04](https://github.com/QingWei-Li/docsify/commit/ce99a04)) +* **themes:** fix navbar style ([fa54b52](https://github.com/QingWei-Li/docsify/commit/fa54b52)) +* **themes:** update navbar style ([4864d1b](https://github.com/QingWei-Li/docsify/commit/4864d1b)) + + +### Features + +* **hook:** support custom plugin ([9e81a59](https://github.com/QingWei-Li/docsify/commit/9e81a59)) +* **src:** add alias feature ([24412cd](https://github.com/QingWei-Li/docsify/commit/24412cd)) +* **src:** dynamic title and fix sidebar style ([6b30eb6](https://github.com/QingWei-Li/docsify/commit/6b30eb6)) + + + + +## [2.2.1](https://github.com/QingWei-Li/docsify/compare/v2.2.0...v2.2.1) (2017-02-11) + + +### Bug Fixes + +* **event:** scroll active sidebar ([50f5fc2](https://github.com/QingWei-Li/docsify/commit/50f5fc2)) +* **search:** crash when not content, fixed [#68](https://github.com/QingWei-Li/docsify/issues/68) ([9d3cc89](https://github.com/QingWei-Li/docsify/commit/9d3cc89)) +* **search:** not work in mobile ([3941304](https://github.com/QingWei-Li/docsify/commit/3941304)) + + + + +# [2.2.0](https://github.com/QingWei-Li/docsify/compare/v2.1.0...v2.2.0) (2017-02-09) + + +### Features + +* **plugins:** add Google Analytics plugin ([#66](https://github.com/QingWei-Li/docsify/issues/66)) ([ac61bb0](https://github.com/QingWei-Li/docsify/commit/ac61bb0)) + + + + +# [2.1.0](https://github.com/QingWei-Li/docsify/compare/v2.0.3...v2.1.0) (2017-02-09) + + +### Bug Fixes + +* render name ([12e2479](https://github.com/QingWei-Li/docsify/commit/12e2479)) +* **vue.css:** update sidebar style ([fc140ef](https://github.com/QingWei-Li/docsify/commit/fc140ef)) + + +### Features + +* add search, close [#43](https://github.com/QingWei-Li/docsify/issues/43) ([eb5ff3e](https://github.com/QingWei-Li/docsify/commit/eb5ff3e)) + + + + +## [2.0.3](https://github.com/QingWei-Li/docsify/compare/v2.0.2...v2.0.3) (2017-02-07) + + +### Bug Fixes + +* css var polyfill ([8cd386a](https://github.com/QingWei-Li/docsify/commit/8cd386a)) +* css var polyfill ([cbaee21](https://github.com/QingWei-Li/docsify/commit/cbaee21)) +* rendering emojis ([8c7e4d7](https://github.com/QingWei-Li/docsify/commit/8c7e4d7)) + + + + +## [2.0.2](https://github.com/QingWei-Li/docsify/compare/v2.0.1...v2.0.2) (2017-02-05) + + +### Bug Fixes + +* button style in cover page ([4470855](https://github.com/QingWei-Li/docsify/commit/4470855)) + + + + +## [2.0.1](https://github.com/QingWei-Li/docsify/compare/v2.0.0...v2.0.1) (2017-02-05) + + + + +# [2.0.0](https://github.com/QingWei-Li/docsify/compare/v1.10.5...v2.0.0) (2017-02-05) + + +### Features + +* customize the theme color ([5cc9f05](https://github.com/QingWei-Li/docsify/commit/5cc9f05)) + + + + +## [1.10.5](https://github.com/QingWei-Li/docsify/compare/v1.10.4...v1.10.5) (2017-01-28) + + + + +## [1.10.4](https://github.com/QingWei-Li/docsify/compare/v1.10.3...v1.10.4) (2017-01-27) + + + + +## [1.10.3](https://github.com/QingWei-Li/docsify/compare/v1.10.2...v1.10.3) (2017-01-27) + + + + +## [1.10.2](https://github.com/QingWei-Li/docsify/compare/v1.10.1...v1.10.2) (2017-01-25) + + + + +## [1.10.1](https://github.com/QingWei-Li/docsify/compare/v1.10.0...v1.10.1) (2017-01-25) + + + + +# [1.10.0](https://github.com/QingWei-Li/docsify/compare/v1.9.0...v1.10.0) (2017-01-25) + + + + +# [1.9.0](https://github.com/QingWei-Li/docsify/compare/v1.8.0...v1.9.0) (2017-01-24) + + + + +# [1.8.0](https://github.com/QingWei-Li/docsify/compare/v1.7.4...v1.8.0) (2017-01-24) + + + + +## [1.7.4](https://github.com/QingWei-Li/docsify/compare/v1.7.3...v1.7.4) (2017-01-13) + + + + +## [1.7.3](https://github.com/QingWei-Li/docsify/compare/v1.7.2...v1.7.3) (2017-01-13) + + + + +## [1.7.2](https://github.com/QingWei-Li/docsify/compare/v1.7.1...v1.7.2) (2017-01-12) + + + + +## [1.7.1](https://github.com/QingWei-Li/docsify/compare/v1.7.0...v1.7.1) (2017-01-12) + + + + +# [1.7.0](https://github.com/QingWei-Li/docsify/compare/v1.6.1...v1.7.0) (2017-01-12) + + + + +## [1.6.1](https://github.com/QingWei-Li/docsify/compare/v1.6.0...v1.6.1) (2017-01-10) + + + + +# [1.6.0](https://github.com/QingWei-Li/docsify/compare/v1.5.2...v1.6.0) (2017-01-10) + + + + +## [1.5.2](https://github.com/QingWei-Li/docsify/compare/v1.5.1...v1.5.2) (2017-01-10) + + + + +## [1.5.1](https://github.com/QingWei-Li/docsify/compare/v1.5.0...v1.5.1) (2017-01-09) + + + + +# [1.5.0](https://github.com/QingWei-Li/docsify/compare/v1.4.3...v1.5.0) (2017-01-04) + + +### Features + +* Markdown parser is configurable, [#42](https://github.com/QingWei-Li/docsify/issues/42) ([8b1000a](https://github.com/QingWei-Li/docsify/commit/8b1000a)) + + + + +## [1.4.3](https://github.com/QingWei-Li/docsify/compare/v1.4.2...v1.4.3) (2017-01-01) + + + + +## [1.4.2](https://github.com/QingWei-Li/docsify/compare/v1.4.1...v1.4.2) (2016-12-31) + + + + +## [1.4.1](https://github.com/QingWei-Li/docsify/compare/v1.4.0...v1.4.1) (2016-12-31) + + + + +# [1.4.0](https://github.com/QingWei-Li/docsify/compare/v1.3.5...v1.4.0) (2016-12-31) + + + + +## [1.3.5](https://github.com/QingWei-Li/docsify/compare/v1.3.4...v1.3.5) (2016-12-25) + + + + +## [1.3.4](https://github.com/QingWei-Li/docsify/compare/v1.3.3...v1.3.4) (2016-12-25) + + + + +## [1.3.3](https://github.com/QingWei-Li/docsify/compare/v1.3.2...v1.3.3) (2016-12-23) + + + + +## [1.3.2](https://github.com/QingWei-Li/docsify/compare/v1.3.1...v1.3.2) (2016-12-22) + + + + +## [1.3.1](https://github.com/QingWei-Li/docsify/compare/v1.3.0...v1.3.1) (2016-12-22) + + + + +# [1.3.0](https://github.com/QingWei-Li/docsify/compare/v1.2.0...v1.3.0) (2016-12-21) + + + + +# [1.2.0](https://github.com/QingWei-Li/docsify/compare/v1.1.7...v1.2.0) (2016-12-20) + + + + +## [1.1.7](https://github.com/QingWei-Li/docsify/compare/v1.1.6...v1.1.7) (2016-12-19) + + + + +## [1.1.6](https://github.com/QingWei-Li/docsify/compare/v1.1.5...v1.1.6) (2016-12-18) + + + + +## [1.1.5](https://github.com/QingWei-Li/docsify/compare/v1.1.4...v1.1.5) (2016-12-18) + + + + +## [1.1.4](https://github.com/QingWei-Li/docsify/compare/v1.1.3...v1.1.4) (2016-12-17) + + + + +## [1.1.3](https://github.com/QingWei-Li/docsify/compare/v1.1.2...v1.1.3) (2016-12-17) + + + + +## [1.1.2](https://github.com/QingWei-Li/docsify/compare/v1.1.1...v1.1.2) (2016-12-17) + + + + +## [1.1.1](https://github.com/QingWei-Li/docsify/compare/v1.1.0...v1.1.1) (2016-12-17) + + + + +# [1.1.0](https://github.com/QingWei-Li/docsify/compare/v1.0.3...v1.1.0) (2016-12-16) + + + + +## [1.0.3](https://github.com/QingWei-Li/docsify/compare/v1.0.2...v1.0.3) (2016-12-13) + + + + +## [1.0.2](https://github.com/QingWei-Li/docsify/compare/v1.0.1...v1.0.2) (2016-12-13) + + + + +## [1.0.1](https://github.com/QingWei-Li/docsify/compare/v1.0.0...v1.0.1) (2016-12-08) + + + + +# [1.0.0](https://github.com/QingWei-Li/docsify/compare/v0.7.0...v1.0.0) (2016-12-08) + + + + +# [0.7.0](https://github.com/QingWei-Li/docsify/compare/v0.6.1...v0.7.0) (2016-11-30) + + + + +## [0.6.1](https://github.com/QingWei-Li/docsify/compare/v0.6.0...v0.6.1) (2016-11-29) + + + + +# [0.6.0](https://github.com/QingWei-Li/docsify/compare/v0.5.0...v0.6.0) (2016-11-29) + + + + +# [0.5.0](https://github.com/QingWei-Li/docsify/compare/v0.4.2...v0.5.0) (2016-11-28) + + + + +## [0.4.2](https://github.com/QingWei-Li/docsify/compare/v0.4.1...v0.4.2) (2016-11-28) + + + + +## [0.4.1](https://github.com/QingWei-Li/docsify/compare/v0.4.0...v0.4.1) (2016-11-28) + + + + +# [0.4.0](https://github.com/QingWei-Li/docsify/compare/v0.3.1...v0.4.0) (2016-11-27) + + +### Features + +* custom sidebar, [#4](https://github.com/QingWei-Li/docsify/issues/4) ([#5](https://github.com/QingWei-Li/docsify/issues/5)) ([37e7984](https://github.com/QingWei-Li/docsify/commit/37e7984)) + + + + +## [0.3.1](https://github.com/QingWei-Li/docsify/compare/v0.3.0...v0.3.1) (2016-11-27) + + + + +# [0.3.0](https://github.com/QingWei-Li/docsify/compare/v0.2.1...v0.3.0) (2016-11-27) + + + + +## [0.2.1](https://github.com/QingWei-Li/docsify/compare/v0.2.0...v0.2.1) (2016-11-26) + + + + +# [0.2.0](https://github.com/QingWei-Li/docsify/compare/v0.1.0...v0.2.0) (2016-11-26) + + + + +# [0.1.0](https://github.com/QingWei-Li/docsify/compare/v0.0.5...v0.1.0) (2016-11-26) + + + + +## [0.0.5](https://github.com/QingWei-Li/docsify/compare/v0.0.4...v0.0.5) (2016-11-24) + + + + +## [0.0.4](https://github.com/QingWei-Li/docsify/compare/v0.0.3...v0.0.4) (2016-11-22) + + + + +## [0.0.3](https://github.com/QingWei-Li/docsify/compare/v0.0.2...v0.0.3) (2016-11-20) + + + + +## [0.0.2](https://github.com/QingWei-Li/docsify/compare/v0.0.1...v0.0.2) (2016-11-20) + + + + +## 0.0.1 (2016-11-20) diff --git a/LICENSE b/LICENSE index 58492da..37a4ac5 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2016 - 2017 cinwell.li +Copyright (c) 2016 - present 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 diff --git a/README.md b/README.md index 0e1938c..b8da0d8 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@

- docsify + docsify

@@ -9,57 +9,60 @@

- Travis Status + Backers on Open Collective + Sponsors on Open Collective + Travis Status npm - code style + donate + gitter +

+ +

Gold Sponsor via Open Collective

+ +

+ + +

## Links + +- [`develop` branch preview](https://docsifyjs.netlify.com/) - [Documentation](https://docsify.js.org) -- [CLI](https://github.com/QingWei-Li/docsify-cli) +- [CLI](https://github.com/docsifyjs/docsify-cli) +- CDN: [UNPKG](https://unpkg.com/docsify/) | [jsDelivr](https://cdn.jsdelivr.net/npm/docsify/) | [cdnjs](https://cdnjs.com/libraries/docsify) +- [Awesome docsify](https://github.com/docsifyjs/awesome-docsify) +- [Community chat](https://gitter.im/docsifyjs/Lobby) ## Features -- Simple and lightweight (~13kB gzipped) + +- No statically built html files +- Simple and lightweight (~21kB gzipped) +- Smart full-text search plugin - Multiple themes -- Not build static html files -- Support emoji :laughing: +- Useful plugin API +- Compatible with IE11 +- Support SSR ([example](https://github.com/docsifyjs/docsify-ssr-demo)) +- Support embedded files ## Quick start -Create a `index.html` and using `hash router`. -index.html +Look at [this tutorial](https://docsify.js.org/#/quickstart) -```html - - - - - - - -
- - - -``` - -## CDN -- UNPKG [https://unpkg.com/docsify/](https://unpkg.com/docsify/) -- jsDelivr [http://www.jsdelivr.com/projects/docsify](http://www.jsdelivr.com/projects/docsify) +[![Edit 307qqv236](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/s/307qqv236) ## 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. -- [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. +These projects are using docsify to generate their sites. Pull requests welcome :blush: + +Move to [awesome-docsify](https://github.com/docsifyjs/awesome-docsify#showcase) ## Similar projects -- [docute](https://github.com/egoist/docute) - 📜 Effortlessly documentation done right -- [docpress](https://github.com/docpress/docpress) - Documentation website generator + +| Project | Description | +| ------------------------------------------------ | ---------------------------------------- | +| [docute](https://github.com/egoist/docute) | 📜 Effortlessly documentation done right | +| [docpress](https://github.com/docpress/docpress) | Documentation website generator | ## Contributing @@ -67,25 +70,42 @@ These open-source projects are using docsify to generate their sites. Pull reque - Create your feature branch: `git checkout -b my-new-feature` - Commit your changes: `git commit -am 'Add some feature'` - Push to the branch: `git push origin my-new-feature` -- Submit a pull request :D - +- Submit a pull request ## Development -### prepare ```bash -npm i && npm run dev -open http://localhost:3000 +npm run bootstrap && npm run dev ``` -### More Language Highlight +## Backers -```html - - - -``` +Thank you to all our backers! 🙏 [[Become a backer](https://opencollective.com/docsify#backers)] + + + +## Sponsors + +Support this project by becoming a sponsor. Your logo will show up here with a link to your website. [[Become a sponsor](https://opencollective.com/docsify#silver-sponsors)] + + + + + + + + + + + + +## Contributors + +This project exists thanks to all the people who contribute. [[Contribute](CONTRIBUTING.md)]. + ## License -MIT +[MIT](LICENSE) + +[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bhttps%3A%2F%2Fgithub.com%2Fdocsifyjs%2Fdocsify.svg?type=large)](https://app.fossa.io/projects/git%2Bhttps%3A%2F%2Fgithub.com%2Fdocsifyjs%2Fdocsify?ref=badge_large) diff --git a/app.js b/app.js deleted file mode 100644 index beada16..0000000 --- a/app.js +++ /dev/null @@ -1,12 +0,0 @@ -var serveStatic = require('serve-static') -var http = require('http') -var fs = require('fs') - -http.createServer(function (req, res) { - serveStatic('.')(req, res, function () { - res.writeHead(404, { 'Content-Type': 'text/html' }) - res.end(fs.readFileSync('dev.html')) - }) -}).listen(3000, '0.0.0.0') - -console.log(`\nListening at http://0.0.0.0:3000\n`) diff --git a/build/build-css.js b/build/build-css.js deleted file mode 100644 index 0890c29..0000000 --- a/build/build-css.js +++ /dev/null @@ -1,38 +0,0 @@ -var fs = require('fs') -var cssnano = require('cssnano').process -var resolve = require('path').resolve -var postcss = require('postcss') - -var processor = postcss([require('postcss-salad')]) - -var saveMin = function (file, content) { - fs.writeFileSync(resolve(__dirname, '../lib/themes/', file), content) -} -var save = function (file, content) { - fs.writeFileSync(resolve(__dirname, '../themes/', file), content) -} -var load = function (file) { - return fs.readFileSync(resolve(__dirname, '../src/themes/', file)).toString() -} -var loadLib = function (file) { - return fs.readFileSync(resolve(__dirname, '../themes/', file)).toString() -} - -var list = fs.readdirSync(resolve(__dirname, '../src/themes')) - -list.forEach(function (file) { - if (!/\.css$/.test(file)) return - processor.process(load(file), { from: resolve(__dirname, '../src/themes/', file) }) - .then(function (result) { - save(file, result.css) - console.log('salad - ' + file) - cssnano(loadLib(file)) - .then(function (result) { - saveMin(file, result.css) - console.log('cssnao - ' + file) - }) - }).catch(function (err) { - console.log(err) - }) -}) - diff --git a/build/build.js b/build/build.js index f8a6922..7b61224 100644 --- a/build/build.js +++ b/build/build.js @@ -1,37 +1,119 @@ -var rollup = require('rollup') -var buble = require('rollup-plugin-buble') -var commonjs = require('rollup-plugin-commonjs') -var nodeResolve = require('rollup-plugin-node-resolve') -var uglify = require('rollup-plugin-uglify') +const rollup = require('rollup') +const buble = require('rollup-plugin-buble') +const commonjs = require('rollup-plugin-commonjs') +const nodeResolve = require('rollup-plugin-node-resolve') +const uglify = require('rollup-plugin-uglify') +const replace = require('rollup-plugin-replace') +const isProd = process.env.NODE_ENV === 'production' +const version = process.env.VERSION || require('../package.json').version +const chokidar = require('chokidar') +const path = require('path') -var build = function (opts) { +const build = function (opts) { rollup .rollup({ - entry: 'src/' + opts.entry, - plugins: [buble()].concat(opts.plugins || []) + input: opts.input, + plugins: (opts.plugins || []).concat([ + buble(), + commonjs(), + nodeResolve(), + replace({ + __VERSION__: version, + 'process.env.SSR': false + }) + ]) }) .then(function (bundle) { - var dest = 'lib/' + (opts.output || opts.entry) + var dest = 'lib/' + (opts.output || opts.input) console.log(dest) bundle.write({ format: 'iife', - moduleName: opts.moduleName || 'Docsify', - dest: dest + file: dest, + strict: false }) }) .catch(function (err) { console.error(err) }) } +const buildCore = function () { + build({ + input: 'src/core/index.js', + output: 'docsify.js' + }) -build({ - entry: 'index.js', - output: 'docsify.js', - plugins: [commonjs(), nodeResolve()] -}) -build({ - entry: 'index.js', - output: 'docsify.min.js', - plugins: [commonjs(), nodeResolve(), uglify()] -}) + if (isProd) { + build({ + input: 'src/core/index.js', + output: 'docsify.min.js', + plugins: [uglify()] + }) + } +} +const buildAllPlugin = function () { + var plugins = [ + {name: 'search', input: 'search/index.js'}, + {name: 'ga', input: 'ga.js'}, + {name: 'matomo', input: 'matomo.js'}, + {name: 'emoji', input: 'emoji.js'}, + {name: 'external-script', input: 'external-script.js'}, + {name: 'front-matter', input: 'front-matter/index.js'}, + {name: 'zoom-image', input: 'zoom-image.js'}, + {name: 'disqus', input: 'disqus.js'}, + {name: 'gitalk', input: 'gitalk.js'} + ] + + plugins.forEach(item => { + build({ + input: 'src/plugins/' + item.input, + output: 'plugins/' + item.name + '.js' + }) + }) + + if (isProd) { + plugins.forEach(item => { + build({ + input: 'src/plugins/' + item.input, + output: 'plugins/' + item.name + '.min.js', + plugins: [uglify()] + }) + }) + } +} + +if (!isProd) { + chokidar + .watch(['src/core', 'src/plugins'], { + atomic: true, + awaitWriteFinish: { + stabilityThreshold: 1000, + pollInterval: 100 + } + }) + .on('change', p => { + console.log('[watch] ', p) + const dirs = p.split(path.sep) + if (dirs[1] === 'core') { + buildCore() + } else if (dirs[2]) { + const name = path.basename(dirs[2], '.js') + const input = `src/plugins/${name}${ + /\.js/.test(dirs[2]) ? '' : '/index' + }.js` + + build({ + input, + output: 'plugins/' + name + '.js' + }) + } + }) + .on('ready', () => { + console.log('[start]') + buildCore() + buildAllPlugin() + }) +} else { + buildCore() + buildAllPlugin() +} diff --git a/build/cover.js b/build/cover.js new file mode 100644 index 0000000..fbd27f7 --- /dev/null +++ b/build/cover.js @@ -0,0 +1,14 @@ +var fs = require('fs') +var read = fs.readFileSync +var write = fs.writeFileSync +var version = process.env.VERSION || require('../package.json').version + +var file = __dirname + '/../docs/_coverpage.md' +var cover = read(file, 'utf8').toString() + +console.log('Replace version number in cover page...') +cover = cover.replace( + /(\S+)?<\/small>/g, + '' + version + '' +) +write(file, cover) diff --git a/build/mincss.js b/build/mincss.js new file mode 100644 index 0000000..f6c5ec2 --- /dev/null +++ b/build/mincss.js @@ -0,0 +1,12 @@ +const cssnano = require('cssnano').process +const path = require('path') +const fs = require('fs') + +files = fs.readdirSync(path.resolve('lib/themes')) + +files.forEach(file => { + file = path.resolve('lib/themes', file) + cssnano(fs.readFileSync(file)).then(result => { + fs.writeFileSync(file, result.css) + }) +}) diff --git a/build/release.sh b/build/release.sh new file mode 100755 index 0000000..a328322 --- /dev/null +++ b/build/release.sh @@ -0,0 +1,50 @@ +set -e + +if [[ -z $1 ]]; then + echo "Enter new version: " + read VERSION +else + VERSION=$1 +fi + +read -p "Releasing $VERSION $RELEASE_TAG - are you sure? (y/n) " -n 1 -r +echo +if [[ $REPLY =~ ^[Yy]$ ]]; then + echo "Releasing $VERSION ..." + + npm run test + + # build + VERSION=$VERSION npm run build + + # update packages + cd packages/docsify-server-renderer + npm version $VERSION + if [[ -z $RELEASE_TAG ]]; then + npm publish + else + npm publish --tag $RELEASE_TAG + fi + cd - + + # commit + git add -A + git commit -m "[build] $VERSION $RELEASE_TAG" + npm --no-git-tag-version version $VERSION --message "[release] $VERSION $RELEASE_TAG" + + # changelog + node_modules/.bin/conventional-changelog -p angular -i CHANGELOG.md -s + + git add . + git commit -m "chore: add changelog $VERSION" + + # publish + git tag v$VERSION + git push origin refs/tags/v$VERSION + git push + if [[ -z $RELEASE_TAG ]]; then + npm publish + else + npm publish --tag $RELEASE_TAG + fi +fi diff --git a/build/ssr.js b/build/ssr.js new file mode 100644 index 0000000..16b93ca --- /dev/null +++ b/build/ssr.js @@ -0,0 +1,34 @@ +var rollup = require('rollup') +var buble = require('rollup-plugin-buble') +var async = require('rollup-plugin-async') +var replace = require('rollup-plugin-replace') + +rollup + .rollup({ + input: 'packages/docsify-server-renderer/index.js', + plugins: [ + async(), + replace({ + __VERSION__: process.env.VERSION || require('../package.json').version, + 'process.env.SSR': true + }), + buble({ + transforms: { + generator: false + } + }) + ], + onwarn: function () {} + }) + .then(function (bundle) { + var dest = 'packages/docsify-server-renderer/build.js' + + console.log(dest) + bundle.write({ + format: 'cjs', + file: dest + }) + }) + .catch(function (err) { + console.error(err) + }) diff --git a/dev.html b/dev.html deleted file mode 100644 index d66b16d..0000000 --- a/dev.html +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - -
- - - diff --git a/docs/README.md b/docs/README.md index e28164f..e625420 100644 --- a/docs/README.md +++ b/docs/README.md @@ -1,506 +1,32 @@ -## Quick Start - -### Create a project -First create a project, then create a `docs` folder -```bash -mkdir my-project && cd my-project -mkdir docs && cd docs -``` - -### Create entry file -Create a `index.html` file - -```html - - - - - - - -
- - - -``` - -Create `README.md` as the main page - -```markdown -# Title - -## blabla -``` - -### Deploy! -Push code and activate **GitHub Pages** via your repo's settings -![image](https://cloud.githubusercontent.com/assets/7565692/20639058/e65e6d22-b3f3-11e6-9b8b-6309c89826f2.png) - -## CLI - -Easy to setup and preview a docs. - -### Install -```bash -npm i docsify-cli -g -``` - -### Setup - -Setup a boilerplate docs -```bash -docsify init docs -``` - -### Preview -Preview and serve your docs using -```bash -docsify serve docs -``` - -Read more [docsify-cli](https://github.com/QingWei-Li/docsify-cli) - - - -## More - -### Themes -Currently available `vue.css` and `buble.css` -```html - - -``` - -Minified files - -```html - - -``` - -### Multiple pages -If you need other pages, directly create the markdown file, such as `guide.md` is `/#/guide`. - -### Navbar -Code in `index.html` - -```html - -``` - -### CDN -- UNPKG [https://unpkg.com/docsify/](https://unpkg.com/docsify/) -- jsDelivr [http://www.jsdelivr.com/projects/docsify](http://www.jsdelivr.com/projects/docsify) - - -### Cover Page - -Generate a cover page with markdown. Create a `_coverpage.md` and set `data-coverpage` in the script tag. - -```markdown -![logo](_media/icon.svg) - -# docsify 1.2.0 +## docsify > A magical documentation site generator. -- Simple and lightweight (~12kb gzipped) +## What it is + +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 a website. To start using it, all you need to do is create an `index.html` and [deploy it on GitHub Pages](deploy.md). + +See the [Quick start](quickstart.md) guide for more details. + +## Features + +- No statically built html files +- Simple and lightweight (~21kB gzipped) +- Smart full-text search plugin - Multiple themes -- Not build static html files +- Useful plugin API +- Emoji support +- Compatible with IE11 +- Support server-side rendering ([example](https://github.com/docsifyjs/docsify-ssr-demo)) +## Examples -[GitHub](https://github.com/QingWei-Li/docsify/) -[Get Started](#quick-start) -``` +Check out the [Showcase](https://github.com/docsifyjs/awesome-docsify#showcase) to see docsify in use. -#### Custom background -Currently the background of the cover page is generated randomly. We can customize the background color, or add a background image. +## Donate -```markdown -# docsify 1.2.0 - -> xxx - -[GitHub](https://github.com/QingWei-Li/docsify/) -[Get Started](#quick-start) - - -![](_media/bg.png) - -![color](#f0f0f0) -``` - -### Markdown parser - -Docsify uses [marked](https://github.com/chjj/marked) to parse markdown. We can configure it - -```js -window.$docsify = { - markdown: { - smartypants: true - } -} -``` - -And it can even be customized - -```js -window.$docsify = { - markdown: function(marked) { - // ... - - return marked - } -} -``` - -### Doc Helpers -#### p.tip - -`!> ` add your content will rendered as `

content

` - -```markdown -!> Important **information** -``` - -It will be rendered - -```html -

Important information

-``` - -e.g. - -!> Important **information** - - -#### p.warn - -```markdown -?> todo info -``` - -?> todo info - -### Combining Vue -We can write the Vue syntax directly in the markdown file, when the Vue library is loaded into `index.html`. Default will automatically initialize a Vue instance, of course, we can also manually. - -index.html -```html - - -``` - -```markdown - -``` - -Manual initialization - -```markdown -
- -

Hello, {{ msg }}

-
- - -``` - -## Options - -You can add configurations in the script tag attributes or with `window.$docsify`. - -### repo -Display the [GitHub Corner](http://tholman.com/github-corners/) widget. - -```html - -``` - - -```js -window.$docsify = { - repo: 'your/repo' -} -``` - -### max-level -TOC level. - -```html - -``` - -```js -window.$docsify = { - maxLevel: 6 -} -``` - -### el -Root element. - -```html - -``` - -```js -window.$docsify = { - el: '#app' -} -``` - -### sidebar-toggle - -Sidebar with toggle - -```html - -``` - -```js -window.$docsify = { - sidebarToggle: true -} -``` - -### sidebar - -Custom sidebar. If it's set, the TOC will be disabled. Bind global variables on the `data-sidebar`. - -![image](https://cloud.githubusercontent.com/assets/7565692/20647425/de5ab1c2-b4ce-11e6-863a-135868f2f9b4.png) - -```html - - -``` - - -```js -window.$docsify = { - sidebar: 'sidebar' -} -``` - -### load-sidebar - -Load sidebar markdown file. If it is configured, load the current directory `_sidebar.md` by default. If the file doesn't exist, the sidebar will appear as a TOC. -** you should add `.nojekyll` into docs folder to prevent GitHub Pages from ignoring the `_sidebar.md`** - -```html - -``` - -You can specify a file: - -```html - -``` - -```js -window.$docsify = { - loadSidebar: '_sidebar.md' -} -``` - -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) -``` - -### sub-max-level - -Display TOC in the custom sidebar. The default value is 0. - - -```html - -``` - - -```js -window.$docsify = { - maxSubLevel: 4 -} -``` - -### load-navbar - -Load navbar markdown file. If it is configured, load the current directory `_navbar.md` by default. - -```html - -``` - -You can specify a file: - -```html - -``` - -```js -window.$docsify = { - loadNavbar: '_navbar.md' -} -``` - -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. - -```html - -``` - -```js -window.$docsify = { - router: true -} -``` - - -### auto2top - -Scroll to the top on changing hash. - - -```html - - - -``` - -```js -window.$docsify = { - auto2top: true, - // auto2top: 50 -} -``` - -### homepage - -`README.md` will be rendered as a homepage for your website in the docs folder, but sometimes we want to specify another file as a homepage, or even use the `README.md` in your repo. We can use (need `data-router`): - -```html - - - -``` - - -```js -window.$docsify = { - homepage: true -} -``` - - -### basePath - -If your HTML entry file and the markdown files are in different directories, we can use: - -```html - - - - -``` - - -```js -window.$docsify = { - basePath: '/base/' -} -``` - - -### coverpage - -Generate cover page. - -```html - - - -``` - -```js -window.$docsify = { - coverpage: true -} -``` - -### name - -Project name. It is displayed in the sidebar. - -```html - -``` - -```js -window.$docsify = { - name: 'docsify' -} -``` - -### nameLink - -Name link. The default value is `window.location.pathname`. - - -```html - -``` - -```js -window.$docsify = { - nameLink: '/' -} -``` +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: +## Community +Users and the development team are usually in the [Gitter chat room](https://gitter.im/docsifyjs/Lobby). diff --git a/docs/_coverpage.md b/docs/_coverpage.md index 7663211..1decbd6 100644 --- a/docs/_coverpage.md +++ b/docs/_coverpage.md @@ -1,14 +1,12 @@ ![logo](_media/icon.svg) -# docsify 1.10.2 +# docsify 4.9.4 > A magical documentation site generator. -- Simple and lightweight (~13kB gzipped) -- Not build static html files -- Support emoji :laughing: +- Simple and lightweight (~21kB gzipped) +- No statically built html files - Multiple themes - -[GitHub](https://github.com/QingWei-Li/docsify/) -[Get Started](#quick-start) +[GitHub](https://github.com/docsifyjs/docsify/) +[Getting Started](#docsify) diff --git a/docs/_images/deploy-github-pages.png b/docs/_images/deploy-github-pages.png new file mode 100644 index 0000000..278e40b Binary files /dev/null and b/docs/_images/deploy-github-pages.png differ diff --git a/docs/_images/nested-navbar.png b/docs/_images/nested-navbar.png new file mode 100644 index 0000000..25f2341 Binary files /dev/null and b/docs/_images/nested-navbar.png differ diff --git a/docs/_images/zh-cn/nested-navbar.png b/docs/_images/zh-cn/nested-navbar.png new file mode 100644 index 0000000..0b2a1c9 Binary files /dev/null and b/docs/_images/zh-cn/nested-navbar.png differ diff --git a/docs/_media/example.html b/docs/_media/example.html new file mode 100644 index 0000000..d35ee16 --- /dev/null +++ b/docs/_media/example.html @@ -0,0 +1 @@ +

To infinity and Beyond!

\ No newline at end of file diff --git a/docs/_media/example.js b/docs/_media/example.js new file mode 100644 index 0000000..7b6f668 --- /dev/null +++ b/docs/_media/example.js @@ -0,0 +1,16 @@ +import fetch from 'fetch' + +const URL = 'https://example.com' +const PORT = 8080 + +/// [demo] +const result = fetch(`${URL}:${PORT}`) + .then(function(response) { + return response.json(); + }) + .then(function(myJson) { + console.log(JSON.stringify(myJson)); + }); +/// [demo] + +result.then(console.log).catch(console.error) diff --git a/docs/_media/example.md b/docs/_media/example.md new file mode 100644 index 0000000..6ee6494 --- /dev/null +++ b/docs/_media/example.md @@ -0,0 +1 @@ +> This is from the `example.md` diff --git a/docs/favicon.ico b/docs/_media/favicon.ico similarity index 100% rename from docs/favicon.ico rename to docs/_media/favicon.ico diff --git a/docs/_navbar.md b/docs/_navbar.md new file mode 100644 index 0000000..47a2356 --- /dev/null +++ b/docs/_navbar.md @@ -0,0 +1,6 @@ +- Translations + - [:uk: English](/) + - [:cn: 中文](/zh-cn/) + - [:de: Deutsch](/de-de/) + - [:es: Spanish](/es/) + - [:ru: Russian](/ru/) diff --git a/docs/_sidebar.md b/docs/_sidebar.md new file mode 100644 index 0000000..051514b --- /dev/null +++ b/docs/_sidebar.md @@ -0,0 +1,28 @@ +- Getting started + + - [Quick start](quickstart.md) + - [Writing more pages](more-pages.md) + - [Custom navbar](custom-navbar.md) + - [Cover page](cover.md) + +- Customization + + - [Configuration](configuration.md) + - [Themes](themes.md) + - [List of Plugins](plugins.md) + - [Write a Plugin](write-a-plugin.md) + - [Markdown configuration](markdown.md) + - [Language highlighting](language-highlight.md) + +- Guide + + - [Deploy](deploy.md) + - [Helpers](helpers.md) + - [Vue compatibility](vue.md) + - [CDN](cdn.md) + - [Offline Mode(PWA)](pwa.md) + - [Server-Side Rendering(SSR)](ssr.md) + - [Embed Files](embed-files.md) + +- [Awesome docsify](awesome.md) +- [Changelog](changelog.md) diff --git a/docs/cdn.md b/docs/cdn.md new file mode 100644 index 0000000..eba77a8 --- /dev/null +++ b/docs/cdn.md @@ -0,0 +1,50 @@ +# 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 + + + + + +``` + +Alternatively, use [compressed files](#compressed-file). + +## Specific version + +```html + + + + + +``` + +## Compressed file + +```html + + + + + +``` + +```html + + + + + +``` + +## Other CDN + +- http://www.bootcdn.cn/docsify +- https://cdn.jsdelivr.net/npm/docsify/ +- https://cdnjs.com/libraries/docsify + diff --git a/docs/configuration.md b/docs/configuration.md new file mode 100644 index 0000000..ba48475 --- /dev/null +++ b/docs/configuration.md @@ -0,0 +1,518 @@ +# Configuration + +You can configure the `window.$docsify`. + +```html + +``` + +## 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: 'docsifyjs/docsify', + // or + repo: 'https://github.com/docsifyjs/docsify/' +}; +``` + +## maxLevel + +- Type: `Number` +- Default: `6` + +Maximum Table of content level. + +```js +window.$docsify = { + maxLevel: 4 +}; +``` + +## loadNavbar + +- 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' +}; +``` + +## loadSidebar + +- 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' +}; +``` + +## subMaxLevel + +- 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/docsifyjs/docsify/master/README.md' +}; +``` + +## basePath + +- 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/' +}; +``` + +## relativePath + +- Type: `Boolean` +- Default: `false` + +If **true** links are relative to the current context. + +For example, the directory structure is as follows: + +```text +. +└── docs + ├── README.md + ├── guide.md + └── zh-cn + ├── README.md + ├── guide.md + └── config + └── example.md +``` + +With relative path **enabled** and current URL `http://domain.com/zh-cn/README`, given links will resolve to: + +```text +guide.md => http://domain.com/zh-cn/guide +config/example.md => http://domain.com/zh-cn/config/example +../README.md => http://domain.com/README +/README.md => http://domain.com/README +``` + +```js +window.$docsify = { + // Relative path enabled + relativePath: true, + + // Relative path disabled (default value) + relativePath: false +}; +``` + +## coverpage + +- Type: `Boolean|String|String[]|Object` +- Default: `false` + +Activate the [cover feature](cover.md). If true, it will load from `_coverpage.md`. + +```js +window.$docsify = { + coverpage: true, + + // Custom file name + coverpage: 'cover.md', + + // mutiple covers + coverpage: ['/', '/zh-cn/'], + + // mutiple covers and custom file name + coverpage: { + '/': 'cover.md', + '/zh-cn/': 'cover.md' + } +}; +``` + +## logo + +- Type: `String` + +Website logo as it appears in the sidebar, you can resize by CSS. + +```js +window.$docsify = { + logo: '/_media/icon.svg' +}; +``` + +## name + +- Type: `String` + +Website name as it appears in the sidebar. + +```js +window.$docsify = { + name: 'docsify' +}; +``` + +## nameLink + +- 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.md). + +```js +window.$docsify = { + // object + markdown: { + smartypants: true, + renderer: { + link: function() { + // ... + } + } + }, + + // function + markdown: function(marked, renderer) { + // ... + return marked; + } +}; +``` + +## themeColor + +- 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. Supports RegExp. + +```js +window.$docsify = { + alias: { + '/foo/(+*)': '/bar/$1', // supports regexp + '/zh-cn/changelog': '/changelog', + '/changelog': + 'https://raw.githubusercontent.com/docsifyjs/docsify/master/CHANGELOG', + '/.*/_sidebar.md': '/_sidebar.md' // See #301 + } +}; +``` + +## autoHeader + +- 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/docsifyjs/docsify/issues/78). + +```js +window.$docsify = { + loadSidebar: true, + autoHeader: true +}; +``` + +## executeScript + +- 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 + + +``` + +Note that if you are running an external script, e.g. an embedded jsfiddle demo, make sure to include the [external-script](plugins.md?id=external-script) plugin. + +## noEmoji + +- type: `Boolean` + +Disabled emoji parse. + +```js +window.$docsify = { + noEmoji: true +}; +``` + +## mergeNavbar + +- type: `Boolean` + +Navbar will be merged with the sidebar on smaller screens. + +```js +window.$docsify = { + mergeNavbar: true +}; +``` + +## formatUpdated + +- type: `String|Function` + +We can display the file update date through **{docsify-updated}** variable. And format it by `formatUpdated`. +See https://github.com/lukeed/tinydate#patterns + +```js +window.$docsify = { + formatUpdated: '{MM}/{DD} {HH}:{mm}', + + formatUpdated: function(time) { + // ... + + return time; + } +}; +``` + +## externalLinkTarget + +- type: `String` +- default: `_blank` + +Target to open external links. Default `'_blank'` (new window/tab) + +```js +window.$docsify = { + externalLinkTarget: '_self' // default: '_blank' +}; +``` + +## routerMode + +- type: `String` +- default: `hash` + +```js +window.$docsify = { + routerMode: 'history' // default: 'hash' +}; +``` + +## noCompileLinks + +- type: `Array` + +Sometimes we do not want docsify to handle our links. See [#203](https://github.com/docsifyjs/docsify/issues/203) + +```js +window.$docsify = { + noCompileLinks: ['/foo', '/bar/.*'] +}; +``` + +## onlyCover + +- type: `Boolean` + +Only coverpage is loaded when visiting the home page. + +```js +window.$docsify = { + onlyCover: false +}; +``` + +## requestHeaders + +- type: `Object` + +Set the request resource headers. + +```js +window.$docsify = { + requestHeaders: { + 'x-token': 'xxx' + } +}; +``` + +## ext + +- type: `String` + +Request file extension. + +```js +window.$docsify = { + ext: '.md' +}; +``` + +## fallbackLanguages + +- type: `Array` + +List of languages that will fallback to the default language when a page is request and didn't exists for the given local. + +Example: + +- try to fetch the page of `/de/overview`. If this page exists, it'll be displayed +- then try to fetch the default page `/overview` (depending on the default language). If this page exists, it'll be displayed +- then display 404 page. + +```js +window.$docsify = { + fallbackLanguages: ['fr', 'de'] +}; +``` + +## notFoundPage + +- type: `Boolean` | `String` | `Object` + +Load the `_404.md` file: + +```js +window.$docsify = { + notFoundPage: true +}; +``` + +Load the customised path of the 404 page: + +```js +window.$docsify = { + notFoundPage: 'my404.md' +}; +``` + +Load the right 404 page according to the localisation: + +```js +window.$docsify = { + notFoundPage: { + '/': '_404.md', + '/de': 'de/_404.md' + } +}; +``` + +> Note: The options with fallbackLanguages didn't work with the `notFoundPage` options. diff --git a/docs/cover.md b/docs/cover.md new file mode 100644 index 0000000..555f4ff --- /dev/null +++ b/docs/cover.md @@ -0,0 +1,99 @@ +# Cover + +Activate the cover feature by setting `coverpage` to **true**, compare [coverpage configuration](configuration.md#coverpage). + +## Basic usage + +Set `coverpage` to **true**, and create a `_coverpage.md`: + +```html + + + + +``` + +```markdown + + +![logo](_media/icon.svg) + +# docsify 3.5 + +> A magical documentation site generator. + +- Simple and lightweight (~21kB gzipped) +- No statically built html files +- Multiple themes + +[GitHub](https://github.com/docsifyjs/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 + + +# docsify 3.5 + +[GitHub](https://github.com/docsifyjs/docsify/) +[Get Started](#quick-start) + + + +![](_media/bg.png) + + + +![color](#f0f0f0) +``` + +## Coverpage as homepage + +Normally, the coverpage and the homepage appear at the same time. Of course, you can also separate the coverpage by [onlyCover option](configuration.md#onlycover). + +## Multiple covers + +If your docs site is in more than one language, it may be useful to set multiple covers. + +For example, your docs structure is like this + +```text +. +└── docs + ├── README.md + ├── guide.md + ├── _coverpage.md + └── zh-cn + ├── README.md + └── guide.md + └── _coverpage.md +``` + +Now, you can set + +```js +window.$docsify = { + coverpage: ['/', '/zh-cn/'] +}; +``` + +Or a special file name + +```js +window.$docsify = { + coverpage: { + '/': 'cover.md', + '/zh-cn/': 'cover.md' + } +}; +``` diff --git a/docs/custom-navbar.md b/docs/custom-navbar.md new file mode 100644 index 0000000..324ad81 --- /dev/null +++ b/docs/custom-navbar.md @@ -0,0 +1,96 @@ +# Custom navbar + +## HTML + +If you need custom navigation, you can create a HTML-based navigation bar. + +!> Note that documentation links begin with `#/`. + +```html + + + + +
+ +``` + +## Markdown + +Alternatively, you can create a custom markdown-based navigation file by setting `loadNavbar` to **true** and creating `_navbar.md`, compare [loadNavbar configuration](configuration.md#loadnavbar). + +```html + + + + +``` + +```markdown + + +* [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 + + +* Getting started + + * [Quick start](quickstart.md) + * [Writing more pages](more-pages.md) + * [Custom navbar](custom-navbar.md) + * [Cover page](cover.md) + +* Configuration + * [Configuration](configuration.md) + * [Themes](themes.md) + * [Using plugins](plugins.md) + * [Markdown configuration](markdown.md) + * [Language highlight](language-highlight.md) +``` + +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 + + + + + +``` + +you could, for example, use flag emojis in your custom navbar Markdown file: + +```markdown + + +* [:us:, :uk:](/) +* [:cn:](/zh-cn/) +``` diff --git a/docs/deploy.md b/docs/deploy.md new file mode 100644 index 0000000..a879f2e --- /dev/null +++ b/docs/deploy.md @@ -0,0 +1,131 @@ +# Deploy + +Similar to [GitBook](https://www.gitbook.com), you can deploy files to GitHub Pages, GitLab 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`. +You'll need to place a `.nojekyll` file in the deploy location (such as `/docs` or the gh-pages branch) + +## GitLab Pages + +If you are deploying your master branch, include `.gitlab-ci.yml` with the following script: + +?> The `.public` workaround is so `cp` doesn't also copy `public/` to itself in an infinite loop. + +```YAML +pages: + stage: deploy + script: + - mkdir .public + - cp -r * .public + - mv .public public + artifacts: + paths: + - public + only: + - master +``` + +!> You can replace script with `- cp -r docs/. public`, if `./docs` is your Docsify subfolder. + +## Firebase Hosting + +!> You'll need to install the Firebase CLI using `npm i -g firebase-tools` after signing into the [Firebase Console](https://console.firebase.google.com) using a Google Account. + +Using Terminal determine and navigate to the directory for your Firebase Project - this could be `~/Projects/Docs` etc. From there, run `firebase init`, choosing `Hosting` from the menu (use **space** to select, **arrow keys** to change options and **enter** to confirm). Follow the setup instructions. + +You should have your `firebase.json` file looking similar to this (I changed the deployment directory from `public` to `site`): + +```json +{ + "hosting": { + "public": "site", + "ignore": ["firebase.json", "**/.*", "**/node_modules/**"] + } +} +``` + +Once finished, build the starting template by running `docsify init ./site` (replacing site with the deployment directory you determined when running `firebase init` - public by default). Add/edit the documentation, then run `firebase deploy` from the base project directory. + +## VPS + +Try following nginx config. + +```nginx +server { + listen 80; + server_name your.domain.com; + + location / { + alias /path/to/dir/of/docs/; + index index.html; + } +} +``` + +## Netlify + +1. Login to your [Netlify](https://www.netlify.com/) account. +2. In the [dashboard](https://app.netlify.com/) page, click **New site from Git**. +3. Choose a repository where you store your docs, leave the **Build Command** area blank, fill in the Publish directory area with the directory of your `index.html`, for example it should be docs if you populated it at `docs/index.html`. + +### HTML5 router + +When using the HTML5 router, you need to set up redirect rules that redirect all requests to your `index.html`, it's pretty simple when you're using Netlify, populate a `\redirects` file in the docs directory and you're all set: + +```sh +/* /index.html 200 +``` + +## AWS Amplify + +1. Set the routerMode in the Docsify project `index.html` to *history* mode. + +```html + +``` + +2. Login to your [AWS Console](https://aws.amazon.com). +3. Go to the [AWS Amplify Dashboard](https://aws.amazon.com/amplify). +4. Choose the **Deploy** route to setup your project. +5. When prompted, keep the build settings empty if you're serving your docs within the root directory. If you're serving your docs from a different directory, customise your amplify.yml + +```yml +version: 0.1 +frontend: + phases: + build: + commands: + - echo "Nothing to build" + artifacts: + baseDirectory: /docs + files: + - '**/*' + cache: + paths: [] + +``` + +6. Add the following Redirect rules in their displayed order. + +| Source address | Target address | Type | +|----------------|----------------|---------------| +| /<*>.md | /<*>.md | 200 (Rewrite) | +| /<*> | /index.html | 200 (Rewrite) | + diff --git a/docs/embed-files.md b/docs/embed-files.md new file mode 100644 index 0000000..dab2efe --- /dev/null +++ b/docs/embed-files.md @@ -0,0 +1,81 @@ +# Embed files + +With docsify 4.6 it is now possible to embed any type of file. +You can embed these files as video, audio, iframes, or code blocks, and even Markdown files can even be embedded directly into the document. + +For example, here embedded a Markdown file. You only need to do this: + +```markdown +[filename](_media/example.md ':include') +``` + +Then the content of `example.md` will be displayed directly here + +[filename](_media/example.md ':include') + +You can check the original content for [example.md](_media/example.md ':ignore'). + +Normally, this will compiled into a link, but in docsify, if you add `:include` it will be embedded. + +## Embedded file type + +Currently, file extension are automatically recognized and embedded in different ways. + +This is a supported embedding type: + +* **iframe** `.html`, `.htm` +* **markdown** `.markdown`, `.md` +* **audio** `.mp3` +* **video** `.mp4`, `.ogg` +* **code** other file extension + +Of course, you can force the specified. For example, you want to Markdown file as code block embedded. + +```markdown +[filename](_media/example.md ':include :type=code') +``` + +You will get it + +[filename](_media/example.md ':include :type=code') + +## Embedded code fragments +Sometimes you don't want to embed a whole file. Maybe because you need just a few lines but you want to compile and test the file in CI. + +```markdown +[filename](_media/example.js ':include :type=code :fragment=demo') +``` + +In your code file you need to surround the fragment between `/// [demo]` lines (before and after the fragment). +Alternatively you can use `### [demo]`. + +Example: + +[filename](_media/example.js ':include :type=code :fragment=demo') + + +## Tag attribute + +If you embed the file as `iframe`, `audio` and `video`, then you may need to set the attributes of these tags. + +```markdown +[cinwell website](https://cinwell.com ':include :type=iframe width=100% height=400px') +``` + +[cinwell website](https://cinwell.com ':include :type=iframe width=100% height=400px') + +Did you see it? You only need to write directly. You can check [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe) for these attributes. + +## The code block highlight + +Embedding any type of source code file, you can specify the highlighted language or automatically identify. + +```markdown +[](_media/example.html ':include :type=code text') +``` + +⬇️ + +[](_media/example.html ':include :type=code text') + +?> How to set highlight? You can see [here](language-highlight.md). diff --git a/docs/helpers.md b/docs/helpers.md new file mode 100644 index 0000000..b047d36 --- /dev/null +++ b/docs/helpers.md @@ -0,0 +1,145 @@ +# 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 + +## Ignore to compile link + +Some time we will put some other relative path to the link, you have to need to tell docsify you don't need to compile this link. For example + +```md +[link](/demo/) +``` + +It will be compiled to `link` and will be loaded `/demo/README.md`. Maybe you want to jump to `/demo/index.html`. + +Now you can do that + +```md +[link](/demo/ ':ignore') +``` + +You will get `link`html. Do not worry, you can still set title for link. + +```md +[link](/demo/ ':ignore title') + +link +``` + +## Set target attribute for link + +```md +[link](/demo ':target=_blank') +[link](/demo2 ':target=_self') +``` + +## Disable link + +```md +[link](/demo ':disabled') +``` + +## Github Task Lists + +```md +- [ ] foo +- bar +- [x] baz +- [] bam <~ not working + - [ ] bim + - [ ] lim +``` + +- [ ] foo +- bar +- [x] baz +- [] bam <~ not working + - [ ] bim + - [ ] lim + +## Image resizing + +```md +![logo](https://docsify.js.org/_media/icon.svg ':size=50x100') +![logo](https://docsify.js.org/_media/icon.svg ':size=100') + + + +![logo](https://docsify.js.org/_media/icon.svg ':size=10%') +``` + +![logo](https://docsify.js.org/_media/icon.svg ':size=50x100') +![logo](https://docsify.js.org/_media/icon.svg ':size=100') +![logo](https://docsify.js.org/_media/icon.svg ':size=10%') + +## Customise ID for headings + +```md +### 你好,世界! :id=hello-world +``` + +## Markdown in html tag + +You need to insert a space between the html and markdown content. +This is useful for rendering markdown content in the details element. + +```markdown +
+Self-assessment (Click to expand) + +- Abc +- Abc + +
+``` + +
+Self-assessment (Click to expand) + +- Abc +- Abc + +
+ +Or markdown content can be wrapped in html tag. + +```markdown +
+ +- listitem +- listitem +- listitem + +
+``` + +
+ +- Abc +- Abc + +
diff --git a/docs/index.html b/docs/index.html index fa7ac30..6d0e008 100644 --- a/docs/index.html +++ b/docs/index.html @@ -1,27 +1,104 @@ + - docsify - A magical documentation site generator. - + docsify + + + + - + + + + + + + - -
+
Loading ...
+ + + + + + + + + + + - - - + diff --git a/docs/language-highlight.md b/docs/language-highlight.md new file mode 100644 index 0000000..793a39e --- /dev/null +++ b/docs/language-highlight.md @@ -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, JavaScript and HTML. You can make **Prism** load additional languages: + +```html + + + +``` + +?> Check the [component files](https://github.com/PrismJS/prism/tree/gh-pages/components) list for more options. diff --git a/docs/markdown.md b/docs/markdown.md new file mode 100644 index 0000000..c506e17 --- /dev/null +++ b/docs/markdown.md @@ -0,0 +1,56 @@ +# Markdown configuration + +**docsify** uses [marked](https://github.com/markedjs/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://marked.js.org/#/USING_ADVANCED.md) + +Even you can completely customize the parsing rules. + +```js +window.$docsify = { + markdown: function(marked, renderer) { + // ... + + return marked + } +} +``` + +## Supports mermaid + +```js +// Import mermaid +// +// + +var num = 0; +mermaid.initialize({ startOnLoad: false }); + +window.$docsify = { + markdown: { + renderer: { + code: function(code, lang) { + if (lang === "mermaid") { + return ( + '
' + mermaid.render('mermaid-svg-' + num++, code) + "
" + ); + } + return this.origin.code.apply(this, arguments); + } + } + } +} +``` diff --git a/docs/more-pages.md b/docs/more-pages.md new file mode 100644 index 0000000..46e7df8 --- /dev/null +++ b/docs/more-pages.md @@ -0,0 +1,125 @@ +# 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 +``` + +## Sidebar + +In order to have sidebar, then you can create your own `_sidebar.md` (see [this documentation's sidebar](https://github.com/docsifyjs/docsify/blob/master/docs/_sidebar.md) for an example): + +First, you need to set `loadSidebar` to **true**. Details are available in the [configuration paragraph](configuration.md#loadsidebar). + +```html + + + + +``` + +Create the `_sidebar.md`: + +```markdown + + +* [Home](/) +* [Guide](guide.md) +``` + +You need to create a `.nojekyll` in `./docs` to prevent GitHub Pages from ignoring files that begin with an underscore. + +## Nested Sidebars + +You may want the sidebar to update with only navigation to reflect the current directory. This can be done by adding a `_sidebar.md` file to each folder. + +`_sidebar.md` is loaded from each level directory. If the current directory doesn't have `_sidebar.md`, it will fall back to the parent directory. If, for example, the current path is `/guide/quick-start`, the `_sidebar.md` will be loaded from `/guide/_sidebar.md`. + +You can specify `alias` to avoid unnecessary fallback. + +```html + +``` + +!> You can create a `README.md` file in a subdirectory to use it as the landing page for the route. + +## Set Page Titles from Sidebar Selection + +A page's `title` tag is generated from the _selected_ sidebar item name. For better SEO, you can customize the title by specifying a string after the filename. + +```markdown + +* [Home](/) +* [Guide](guide.md "The greatest guide in the world") +``` + +## Table of Contents + +Once you've created `_sidebar.md`, the sidebar content is automatically generated based on the headers in the markdown files. + +A custom sidebar can also automatically generate a table of contents by setting a `subMaxLevel`, compare [subMaxLevel configuration](configuration.md#submaxlevel). + +```html + + + + +``` + +## Ignoring Subheaders + +When `subMaxLevel` is set, each header is automatically added to the table of contents by default. If you want to ignore a specific header, add `{docsify-ignore}` to it. + +```markdown +# Getting Started + +## Header {docsify-ignore} + +This header won't appear in the sidebar table of contents. +``` + +To ignore all headers on a specific page, you can use `{docsify-ignore-all}` on the first header of the page. + +```markdown +# Getting Started {docsify-ignore-all} + +## Header + +This header won't appear in the sidebar table of contents. +``` + +Both `{docsify-ignore}` and `{docsify-ignore-all}` will not be rendered on the page when used. diff --git a/docs/plugins.md b/docs/plugins.md new file mode 100644 index 0000000..3706b89 --- /dev/null +++ b/docs/plugins.md @@ -0,0 +1,197 @@ +# 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 + + + +``` + +## Google Analytics + +Install the plugin and configure the track id. + +```html + + + +``` + +Configure by `data-ga`. + +```html + + +``` + +## 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 + +``` + +## 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 + +``` + +## Zoom image + +Medium's image zoom. Based on [medium-zoom](https://github.com/francoischalifour/medium-zoom). + +```html + +``` + +Exclude the special image + +```markdown +![](image.png ":no-zoom") +``` + +## Edit on github + +Add `Edit on github` button on every pages. Provided by [@njleonzhang](https://github.com/njleonzhang), check [document](https://github.com/njleonzhang/docsify-edit-on-github) + +## Demo code with instant preview and jsfiddle integration + +With this plugin, sample code can be rendered on the page instantly, so that the readers can see the preview immediately. +When readers expand the demo box, the source code and description are shown there. if they click the button `Try in Jsfiddle`, +`jsfiddle.net` will be open with the code of this sample, which allow readers to revise the code and try on their own. + +[Vue](https://njleonzhang.github.io/docsify-demo-box-vue/) and [React](https://njleonzhang.github.io/docsify-demo-box-react/) are both supported. + +## Copy to Clipboard + +Add a simple `Click to copy` button to all preformatted code blocks to effortlessly allow users to copy example code from your docs. Provided by [@jperasmus](https://github.com/jperasmus) + +```html + +``` + +See [here](https://github.com/jperasmus/docsify-copy-code/blob/master/README.md) for more details. + +## Disqus + +Disqus comments. https://disqus.com/ + +```html + + +``` + +## Gitalk + +[Gitalk](https://github.com/gitalk/gitalk) is a modern comment component based on Github Issue and Preact. + +```html + + + + + +``` + +## Pagination + +Pagination for docsify. By [@imyelo](https://github.com/imyelo) + +```html + + +``` + +## codefund + +a [plugin](https://github.com/njleonzhang/docsify-plugin-codefund) to make it easy to join up [codefund](https://codefund.io/) + +> codefund is formerly known as "codesponsor" + +``` + + +window.$docsify = { + plugins: [ + DocsifyCodefund.create('xxxx-xxx-xxx') // change to your codefund id + ] +} +``` + +## Tabs + +A docsify.js plugin for displaying tabbed content from markdown. + +- [Documentation & Demos](https://jhildenbiddle.github.io/docsify-tabs) + +Provided by [@jhildenbiddle](https://github.com/jhildenbiddle/docsify-tabs). + +## More plugins + +See [awesome-docsify](awesome?id=plugins) diff --git a/docs/pwa.md b/docs/pwa.md new file mode 100644 index 0000000..e8d1c74 --- /dev/null +++ b/docs/pwa.md @@ -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 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 there’s 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 + +``` + +## 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. diff --git a/docs/quickstart.md b/docs/quickstart.md new file mode 100644 index 0000000..08666d2 --- /dev/null +++ b/docs/quickstart.md @@ -0,0 +1,94 @@ +# 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.md). + +## 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/docsifyjs/docsify-cli). + +## Manual initialization + +If you don't like `npm` or have trouble installing the tool, you can manually create `index.html`: + +```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 + + +
Please wait...
+``` + +You should set the `data-app` attribute if you changed `el`: + +```html + + +
Please wait...
+ + +``` + +Compare [el configuration](configuration.md#el). diff --git a/docs/ssr.md b/docs/ssr.md new file mode 100644 index 0000000..e9c435f --- /dev/null +++ b/docs/ssr.md @@ -0,0 +1,124 @@ +# Server-Side Rendering + +See https://docsify.now.sh + +Repo in https://github.com/docsifyjs/docsify-ssr-demo + +## Why SSR? +- Better SEO +- Feeling cool + +## Quick start + +Install `now` and `docsify-cli` in your project. + +```bash +npm i now docsify-cli -D +``` + +Edit `package.json`. If the documentation in `./docs` subdirectory. + +```json +{ + "name": "my-project", + "scripts": { + "start": "docsify start . -c ssr.config.js", + "deploy": "now -p" + }, + "files": [ + "docs" + ], + "docsify": { + "config": { + "basePath": "https://docsify.js.org/", + "loadSidebar": true, + "loadNavbar": true, + "coverpage": true, + "name": "docsify" + } + } +} +``` + +!> The `basePath` just like webpack `publicPath`. We can use local or remote files. + +We can preview in the local to see if it works. + +```bash +npm start + +# open http://localhost:4000 +``` + +Publish it! + +```bash +now -p +``` + +Now, You have a support for SSR the docs site. + +## Custom template + +You can provide a template for entire page's HTML. such as + +```html + + + + + docsify + + + + + + + + + + + + + +``` + +The template should contain these comments for rendered app content. + - `` + - `` + +## Configuration + +You can configure it in a special config file, or `package.json`. + +```js +module.exports = { + template: './ssr.html', + maxAge: 60 * 60 * 1000, // lru-cache config + config: { + // docsify config + } +} +``` + +## Deploy for your VPS + +You can run `docsify start` directly on your Node server, or write your own server app with `docsify-server-renderer`. + +```js +var Renderer = require('docsify-server-renderer') +var readFileSync = require('fs').readFileSync + +// init +var renderer = new Renderer({ + template: readFileSync('./docs/index.template.html', 'utf-8'), + config: { + name: 'docsify', + repo: 'docsifyjs/docsify' + } +}) + +renderer.renderToString(url) + .then(html => {}) + .catch(err => {}) +``` diff --git a/docs/themes.md b/docs/themes.md new file mode 100644 index 0000000..1de9125 --- /dev/null +++ b/docs/themes.md @@ -0,0 +1,60 @@ +# 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 + + + + +``` + +!> Compressed files are available in `/lib/themes/`. + +```html + + + + + + +``` + +If you have any ideas or would like to develop a new theme, you are welcome to submit a [pull request](https://github.com/docsifyjs/docsify/pulls). + +#### Click to preview + + + + + + + +## Other themes + +- [docsify-themeable](https://jhildenbiddle.github.io/docsify-themeable/#/) A delightfully simple theme system for docsify. diff --git a/docs/vue.md b/docs/vue.md new file mode 100644 index 0000000..a1b5683 --- /dev/null +++ b/docs/vue.md @@ -0,0 +1,99 @@ +# 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 + + + + + + +``` + +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 +
    +
  • {{ i }}
  • +
+``` + +
    +
  • {{ i }}
  • +
+```` + +You can manually initialize a Vue instance. + +*README.md* + +```markdown +# Vue demo + +
hello {{ msg }}
+ + +``` + +!> 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 + + + + + + + + + + + + +``` + +*README.md* +```markdown +# Vuep + + + + + +``` + +?> Example Refer to the [Vuep documentation](https://qingwei-li.github.io/vuep/). diff --git a/docs/write-a-plugin.md b/docs/write-a-plugin.md new file mode 100644 index 0000000..baa894e --- /dev/null +++ b/docs/write-a-plugin.md @@ -0,0 +1,111 @@ +# 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 + +#### footer + +Add footer component in each pages. + +```js +window.$docsify = { + plugins: [ + function(hook) { + var footer = [ + '
', + '' + ].join(''); + + hook.afterEach(function(html) { + return html + footer; + }); + } + ] +}; +``` + +### Edit Button + +```js +window.$docsify = { + plugins: [ + function(hook, vm) { + hook.beforeEach(function(html) { + var url = + 'https://github.com/docsifyjs/docsify/blob/master/docs/' + + vm.route.file; + var editHtml = '[📝 EDIT DOCUMENT](' + url + ')\n'; + + return ( + editHtml + + html + + '\n----\n' + + 'Last modified {docsify-updated} ' + + editHtml + ); + }); + } + ] +}; +``` + +## Tips + +### Get docsify version + +``` +console.log(window.Docsify.version) +``` + +Current version: loading + + diff --git a/docs/zh-cn.md b/docs/zh-cn.md deleted file mode 100644 index da83dff..0000000 --- a/docs/zh-cn.md +++ /dev/null @@ -1,513 +0,0 @@ - -## 特性 -- 无需构建,写完 markdown 直接发布 -- 支持自定义主题 -- 容易使用并且轻量 (~12kb gzipped) - -## 快速上手 - -### 创建项目 -新建一个空项目,接着创建一个 `docs` 目录并进入到 docs 目录下 -```bash -mkdir my-project && cd my-project -mkdir docs && cd docs -``` - -### 创建入口文件 -创建一个 `index.html` 文件,内容为 -```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 的配置,支持本地预览。 - -### 安装 -```bash -npm i docsify-cli -g -``` - -### 初始化文档 - -默认初始化在当前目录,推荐将文档放在 `docs` 目录下 -```bash -docsify init docs -``` - -### 启动本地服务 -启动一个 server 方便预览,打开 http://localhost:3000 -```bash -docsify serve docs -``` - -更多选项参考 [docsify-cli](https://github.com/QingWei-Li/docsify-cli) - - -## 更多功能 - -### 主题 -目前提供 vue.css 和 buble.css,直接修改 `index.html` 里的 cdn 地址即可 -```html - - -``` - -压缩版 - -```html - - -``` - -### 多页面 -`README.md` 作为主页面,如果需要其他页面,直接在文档目录下创建对应的 `*.md` 文件,例如创建一个 `guide.md` 那么对应的路由就是 `/#/guide`。 - -### 导航 -导航需要自己写在 `index.html` 文件里,效果参考本文档 - -```html - -``` - - - -### CDN -- UNPKG [https://unpkg.com/docsify/](https://unpkg.com/docsify/) -- jsDelivr [http://www.jsdelivr.com/projects/docsify](http://www.jsdelivr.com/projects/docsify) - -### 封面 - -只需要写几行简单的 markdown 就可以拥有一页精致的封面,通过添加 `data-coverpage` 属性,并创建 `_coverpage.md`,按照下面的格式书写即可。 - -```markdown -![logo](_media/icon.svg) - -# docsify 1.2.0 - -> 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 语法 - -```markdown -# docsify 1.2.0 - -> xxx - -[GitHub](https://github.com/QingWei-Li/docsify/) -[Get Started](#quick-start) - - -![](_media/bg.png) - -![color](#f0f0f0) -``` - -### 自定义 Markdown parser - -默认使用 [marked](https://github.com/chjj/marked) 处理 markdown 部分,你可以修改默认配置 - -```js -window.$docsify = { - markdown: { - smartypants: true - } -} -``` - -甚至可以完全定制化 - -```js -window.$docsify = { - markdown: function(marked) { - // ... - - return marked - } -} -``` - -### 文档助手 -#### 内置「提示」语法 - -`!>`后面接内容,会渲染成带 tip 类名的段落。 - -```markdown -!> 提示信息,**支持其他 markdown 语法** -``` - -将被渲染成 - -```html -

提示信息支持其他 markdown 语法

-``` - -效果 - -!> 适合显示醒目的内容 - -#### 内置「警示」语法 - -`?>`后面接内容,会渲染成带 warn 类名的段落。 - -```markdown -?> 警示内容样式 -``` - -效果 - -?> 警示内容样式 - -### 结合 Vue - -`index.html` 内引入 Vue 后,可以在文档里直接写 Vue 语法。默认会自己初始化一个 Vue 示例,当然我们也可以手动初始化一个实例。 - -index.html -```html - - -``` - -```markdown -
    -
  • {{ i }}
  • -
-``` - -手动初始化示例 - -```markdown -
- -

Hello, {{ msg }}

-
- - -``` - -## 配置参数 - -你可以通过在标签上添加属性的方式,或者给 `window.$docsify` 传配置信息。 - -### repo -参考本文档的右上角的 GitHub 图标,如果要开启的话,将 `index.html` 里的 script 改成 - -```html - -``` - - -```js -window.$docsify = { - repo: 'your/repo' -} -``` - -### max-level -目录最大展开层级,默认值为 6 - -```html - -``` - - -```js -window.$docsify = { - maxLevel: 6 -} -``` - -### el -替换节点元素,默认为 `#app` -```html - -``` - - -```js -window.$docsify = { - el: '#app' -} -``` - -### sidebar-toggle - -Sidebar 开关按钮 - -```html - -``` - - -```js -window.$docsify = { - sidebarToggle: true -} -``` - -### sidebar - -设置后 TOC 功能将不可用,适合导航较多的文档,`data-sidebar` 传入全局变量名。 - -![image](https://cloud.githubusercontent.com/assets/7565692/20647425/de5ab1c2-b4ce-11e6-863a-135868f2f9b4.png) - -```html - - -``` - - -```js -window.$docsify = { - sidebar: 'sidebar' -} -``` - -### load-sidebar - -读取侧边栏配置文件,如果配置,默认加载当前目录下的 `_sidebar.md`。如果文件不存在,会显示 TOC 作为侧边栏内容。如果你有二级目录,也应该放置一份配置文件。 -**如果用 `_` 开头作为文件名,你应该在文档目录下添加 `.nojekyll`,阻止 GitHub Pages 忽略下划线开头的文件。** - -```html - -``` - - -你可以指定侧边栏文件名 - -```html - -``` - -```js -window.$docsify = { - loadSidebar: '_sidebar.md' -} -``` - -`_sidebar.md` 的内容可以是这样的 - -```markdown -- [Home](/) -- [Installation](/installation) -- Essentials - - [Getting Started](/getting-started) - - [Dynamic Route Matching](/dynamic-matching) - - [Nested Routes](/nested-routes) -``` - -### sub-max-level - -显示 TOC 在自定义的侧边栏里,默认最大显示 0 层。 - - -```html - -``` - -```js -window.$docsify = { - maxSubLevel: 4 -} -``` - -### load-navbar - -读取导航配置文件,如果配置,默认加载当前目录下的 `_navbar.md`。如果文件不存在,会显示 html 里定义的导航栏。 - -```html - -``` - -你可以指定导航栏文件名 - -```html - -``` - -```js -window.$docsify = { - loadNavbar: '_navbar.md' -} -``` - -`_navbar.md` 的内容可以是这样 - -```markdown -- [en](/) -- [中文](/zh-cn) -``` - -当然也支持二级列表,将生成一个下拉列表 -```markdown -- [download](/download) -- language - - [en](/) - - [中文](/zh-cn) -``` - - -### router - -开启 hash router 功能,同时多页面切换不会重新加载资源。资源路径会被替换成 `/#/` 的形式。 - -```html - -``` - -```js -window.$docsify = { - router: true -} -``` - -### auto2top - -切换路由时自动跳转到页面顶部 - - -```html - -``` - -```js -window.$docsify = { - auto2top: true -} -``` - -### homepage - -默认情况下网站会将根目录下 `README.md` 作为首页渲染,但是有些时候我们想指定其他文件,甚至想直接将 repo 下的 README 作为首页。你可以这样做(需要设置 `data-router`): - - -```html - - - -``` - -```js -window.$docsify = { - homepage: true -} -``` - -### basePath - -指定加载文档的路径,如果你的 HTML 入口文件和文档是放在不同地方,你可以设置: - -```html - - - - -``` - - -```js -window.$docsify = { - basePath: '/base/' -} -``` - -### coverpage - -生成封面,参考 [#封面](/zh-cn#封面). - -```html - - - - -``` - - -```js -window.$docsify = { - coverpage: true -} -``` - - -### name - -项目名,将显示在侧边栏。 - -```html - -``` - -```js -window.$docsify = { - name: 'docsify' -} -``` - -### nameLink - -项目名链接,默认为 `window.location.pathname`。 - -```html - -``` - -```js -window.$docsify = { - nameLink: '/' -} -``` - diff --git a/index.html b/index.html new file mode 100644 index 0000000..59e6911 --- /dev/null +++ b/index.html @@ -0,0 +1,84 @@ + + + + + + docsify + + + + + + + + + +
+ + + + + + + + + diff --git a/lerna.json b/lerna.json new file mode 100644 index 0000000..26fa22a --- /dev/null +++ b/lerna.json @@ -0,0 +1,7 @@ +{ + "lerna": "2.0.0-rc.5", + "packages": [ + "packages/*" + ], + "version": "0.0.0" +} diff --git a/lib/docsify.js b/lib/docsify.js deleted file mode 100644 index 50a4fd7..0000000 --- a/lib/docsify.js +++ /dev/null @@ -1,2821 +0,0 @@ -var Docsify = (function () { -'use strict'; - -/** - * Simple ajax - * @param {String} url - * @param {String} [method=GET] - * @param {Function} [loading] handle loading - * @return {Promise} - */ -function load (url, method, loading) { - if ( method === void 0 ) method = 'GET'; - - var xhr = new XMLHttpRequest(); - - xhr.open(method, url); - xhr.send(); - - return { - then: function (success, error) { - if ( error === void 0 ) error = function () {}; - - if (loading) { - var id = setInterval(function (_) { return loading({ step: Math.floor(Math.random() * 5 + 1) }); }, - 500); - xhr.addEventListener('progress', loading); - xhr.addEventListener('loadend', function (evt) { - loading(evt); - clearInterval(id); - }); - } - xhr.addEventListener('error', error); - xhr.addEventListener('load', function (ref) { - var target = ref.target; - - target.status >= 400 ? error(target) : success(target.response); - }); - }, - abort: function () { return xhr.readyState !== 4 && xhr.abort(); } - } -} - -/** - * 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} - */ -function genTree (toc, maxLevel) { - var headlines = []; - var last = {}; - - toc.forEach(function (headline) { - var level = headline.level || 1; - var len = level - 1; - - if (level > maxLevel) { return } - if (last[len]) { - last[len].children = last[len].children || []; - last[len].children.push(headline); - } else { - headlines.push(headline); - } - last[level] = headline; - }); - - return headlines -} - -/** - * camel to kebab - * @link https://github.com/bokuweb/kebab2camel/blob/master/index.js - * @param {String} str - * @return {String} - */ -function camel2kebab (str) { - return str.replace(/([A-Z])/g, function (m) { return '-' + m.toLowerCase(); }) -} - -/** - * is nil - * @param {Object} object - * @return {Boolean} - */ -function isNil (o) { - return o === null || o === undefined -} - -var cacheRoute$1 = null; -var cacheHash = null; - -/** - * hash route - */ -function getRoute () { - var loc = window.location; - if (cacheHash === loc.hash && !isNil(cacheRoute$1)) { return cacheRoute$1 } - - var route = loc.hash.match(/^#\/([^#]+)/); - - if (route && route.length === 2) { - route = route[1]; - } else { - route = /^#\//.test(loc.hash) ? '' : loc.pathname; - } - cacheRoute$1 = route; - cacheHash = loc.hash; - - return route -} - -function isMobile () { - return document.body.clientWidth <= 600 -} - -function slugify (string) { - var re = /[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,.\/:;<=>?@\[\]^`{|}~]/g; - var maintainCase = false; - var replacement = '-'; - - slugify.occurrences = slugify.occurrences || {}; - - if (typeof string !== 'string') { return '' } - if (!maintainCase) { string = string.toLowerCase(); } - - var slug = string.trim() - .replace(/<[^>\d]+>/g, '') - .replace(re, '') - .replace(/\s/g, replacement) - .replace(/-+/g, replacement) - .replace(/^(\d)/, '_$1'); - var occurrences = slugify.occurrences[slug]; - - if (slugify.occurrences.hasOwnProperty(slug)) { - occurrences++; - } else { - occurrences = 0; - } - - slugify.occurrences[slug] = occurrences; - - if (occurrences) { - slug = slug + '-' + occurrences; - } - - return slug -} - -slugify.clear = function () { - slugify.occurrences = {}; -}; - -var hasOwnProperty = Object.prototype.hasOwnProperty; -var merge = Object.assign || function (to) { - var arguments$1 = arguments; - - for (var i = 1; i < arguments.length; i++) { - var from = Object(arguments$1[i]); - - for (var key in from) { - if (hasOwnProperty.call(from, key)) { - to[key] = from[key]; - } - } - } - - return to -}; - -function emojify (text) { - return text - .replace(/:(\w*?):/ig, '$1') - .replace(/__colon__/g, ':') -} - -/** - * Active sidebar when scroll - * @link https://buble.surge.sh/ - */ -function scrollActiveSidebar () { - if (isMobile()) { return } - - var hoveredOverSidebar = false; - var anchors = document.querySelectorAll('.anchor'); - var sidebar = document.querySelector('aside.sidebar'); - var nav = {}; - var lis = sidebar.querySelectorAll('li'); - var active = sidebar.querySelector('li.active'); - - for (var i = 0, len = lis.length; i < len; i += 1) { - var li = lis[i]; - var href = li.querySelector('a').getAttribute('href'); - - if (href !== '/') { - var match = href.match('#([^#]+)$'); - if (match && match.length) { href = match[0].slice(1); } - } - - nav[decodeURIComponent(href)] = li; - } - - function highlight () { - var top = document.body.scrollTop; - var last; - - for (var i = 0, len = anchors.length; i < len; i += 1) { - var node = anchors[i]; - - if (node.offsetTop > top) { - if (!last) { last = node; } - break - } else { - last = node; - } - } - if (!last) { return } - var li = nav[last.getAttribute('data-id')]; - - if (!li || li === active) { return } - if (active) { active.classList.remove('active'); } - - li.classList.add('active'); - active = li; - !hoveredOverSidebar && !sticky.noSticky && active.scrollIntoView(false); - } - - window.removeEventListener('scroll', highlight); - window.addEventListener('scroll', highlight); - sidebar.addEventListener('mouseover', function () { hoveredOverSidebar = true; }); - sidebar.addEventListener('mouseleave', function () { hoveredOverSidebar = false; }); -} - -function scrollIntoView () { - var id = window.location.hash.match(/#[^#\/]+$/g); - if (!id || !id.length) { return } - var section = document.querySelector(decodeURIComponent(id[0])); - - if (section) { setTimeout(function () { return section.scrollIntoView(); }, 0); } - - return section -} - -/** - * Acitve link - */ -function activeLink (dom, activeParent) { - var host = window.location.href; - - dom = typeof dom === 'object' ? dom : document.querySelector(dom); - if (!dom) { return } - var target;[].slice.call(dom.querySelectorAll('a')) - .sort(function (a, b) { return b.href.length - a.href.length; }) - .forEach(function (node) { - if (host.indexOf(node.href) === 0 && !target) { - activeParent - ? node.parentNode.classList.add('active') - : node.classList.add('active'); - target = node; - } else { - activeParent - ? node.parentNode.classList.remove('active') - : node.classList.remove('active'); - } - }); - - return target -} - -/** - * sidebar toggle - */ -function bindToggle (dom) { - dom = typeof dom === 'object' ? dom : document.querySelector(dom); - if (!dom) { return } - var body = document.body; - - dom.addEventListener('click', function () { return body.classList.toggle('close'); }); - - if (isMobile()) { - var sidebar = document.querySelector('aside.sidebar'); - sidebar.addEventListener('click', function () { - body.classList.toggle('close'); - setTimeout(function () { return activeLink(sidebar, true); }, 0); - }); - } -} - -function scroll2Top (offset) { - if ( offset === void 0 ) offset = 0; - - document.body.scrollTop = offset === true ? 0 : Number(offset); -} - -function sticky () { - sticky.dom = sticky.dom || document.querySelector('section.cover'); - var coverHeight = sticky.dom.getBoundingClientRect().height; - - return (function () { - if (window.pageYOffset >= coverHeight || sticky.dom.classList.contains('hidden')) { - document.body.classList.add('sticky'); - sticky.noSticky = false; - } else { - document.body.classList.remove('sticky'); - sticky.noSticky = true; - } - })() -} - -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 marked = createCommonjsModule(function (module, exports) { -/** - * marked - a markdown parser - * Copyright (c) 2011-2014, Christopher Jeffrey. (MIT Licensed) - * https://github.com/chjj/marked - */ - -(function() { - -/** - * Block-Level Grammar - */ - -var block = { - newline: /^\n+/, - code: /^( {4}[^\n]+\n*)+/, - fences: noop, - hr: /^( *[-*_]){3,} *(?:\n+|$)/, - heading: /^ *(#{1,6}) *([^\n]+?) *#* *(?:\n+|$)/, - nptable: noop, - lheading: /^([^\n]+)\n *(=|-){2,} *(?:\n+|$)/, - blockquote: /^( *>[^\n]+(\n(?!def)[^\n]+)*\n*)+/, - list: /^( *)(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?!\1bull )\n*|\s*$)/, - html: /^ *(?:comment *(?:\n|\s*$)|closed *(?:\n{2,}|\s*$)|closing *(?:\n{2,}|\s*$))/, - def: /^ *\[([^\]]+)\]: *]+)>?(?: +["(]([^\n]+)[")])? *(?:\n+|$)/, - table: noop, - paragraph: /^((?:[^\n]+\n?(?!hr|heading|lheading|blockquote|tag|def))+)\n*/, - text: /^[^\n]+/ -}; - -block.bullet = /(?:[*+-]|\d+\.)/; -block.item = /^( *)(bull) [^\n]*(?:\n(?!\1bull )[^\n]*)*/; -block.item = replace(block.item, 'gm') - (/bull/g, block.bullet) - (); - -block.list = replace(block.list) - (/bull/g, block.bullet) - ('hr', '\\n+(?=\\1?(?:[-*_] *){3,}(?:\\n+|$))') - ('def', '\\n+(?=' + block.def.source + ')') - (); - -block.blockquote = replace(block.blockquote) - ('def', block.def) - (); - -block._tag = '(?!(?:' - + 'a|em|strong|small|s|cite|q|dfn|abbr|data|time|code' - + '|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo' - + '|span|br|wbr|ins|del|img)\\b)\\w+(?!:/|[^\\w\\s@]*@)\\b'; - -block.html = replace(block.html) - ('comment', //) - ('closed', /<(tag)[\s\S]+?<\/\1>/) - ('closing', /])*?>/) - (/tag/g, block._tag) - (); - -block.paragraph = replace(block.paragraph) - ('hr', block.hr) - ('heading', block.heading) - ('lheading', block.lheading) - ('blockquote', block.blockquote) - ('tag', '<' + block._tag) - ('def', block.def) - (); - -/** - * Normal Block Grammar - */ - -block.normal = merge({}, block); - -/** - * GFM Block Grammar - */ - -block.gfm = merge({}, block.normal, { - fences: /^ *(`{3,}|~{3,})[ \.]*(\S+)? *\n([\s\S]*?)\s*\1 *(?:\n+|$)/, - paragraph: /^/, - heading: /^ *(#{1,6}) +([^\n]+?) *#* *(?:\n+|$)/ -}); - -block.gfm.paragraph = replace(block.paragraph) - ('(?!', '(?!' - + block.gfm.fences.source.replace('\\1', '\\2') + '|' - + block.list.source.replace('\\1', '\\3') + '|') - (); - -/** - * GFM + Tables Block Grammar - */ - -block.tables = merge({}, block.gfm, { - nptable: /^ *(\S.*\|.*)\n *([-:]+ *\|[-| :]*)\n((?:.*\|.*(?:\n|$))*)\n*/, - table: /^ *\|(.+)\n *\|( *[-:]+[-| :]*)\n((?: *\|.*(?:\n|$))*)\n*/ -}); - -/** - * Block Lexer - */ - -function Lexer(options) { - this.tokens = []; - this.tokens.links = {}; - this.options = options || marked.defaults; - this.rules = block.normal; - - if (this.options.gfm) { - if (this.options.tables) { - this.rules = block.tables; - } else { - this.rules = block.gfm; - } - } -} - -/** - * Expose Block Rules - */ - -Lexer.rules = block; - -/** - * Static Lex Method - */ - -Lexer.lex = function(src, options) { - var lexer = new Lexer(options); - return lexer.lex(src); -}; - -/** - * Preprocessing - */ - -Lexer.prototype.lex = function(src) { - src = src - .replace(/\r\n|\r/g, '\n') - .replace(/\t/g, ' ') - .replace(/\u00a0/g, ' ') - .replace(/\u2424/g, '\n'); - - return this.token(src, true); -}; - -/** - * Lexing - */ - -Lexer.prototype.token = function(src, top, bq) { - var this$1 = this; - - var src = src.replace(/^ +$/gm, '') - , next - , loose - , cap - , bull - , b - , item - , space - , i - , l; - - while (src) { - // newline - if (cap = this$1.rules.newline.exec(src)) { - src = src.substring(cap[0].length); - if (cap[0].length > 1) { - this$1.tokens.push({ - type: 'space' - }); - } - } - - // code - if (cap = this$1.rules.code.exec(src)) { - src = src.substring(cap[0].length); - cap = cap[0].replace(/^ {4}/gm, ''); - this$1.tokens.push({ - type: 'code', - text: !this$1.options.pedantic - ? cap.replace(/\n+$/, '') - : cap - }); - continue; - } - - // fences (gfm) - if (cap = this$1.rules.fences.exec(src)) { - src = src.substring(cap[0].length); - this$1.tokens.push({ - type: 'code', - lang: cap[2], - text: cap[3] || '' - }); - continue; - } - - // heading - if (cap = this$1.rules.heading.exec(src)) { - src = src.substring(cap[0].length); - this$1.tokens.push({ - type: 'heading', - depth: cap[1].length, - text: cap[2] - }); - continue; - } - - // table no leading pipe (gfm) - if (top && (cap = this$1.rules.nptable.exec(src))) { - src = src.substring(cap[0].length); - - item = { - type: 'table', - header: cap[1].replace(/^ *| *\| *$/g, '').split(/ *\| */), - align: cap[2].replace(/^ *|\| *$/g, '').split(/ *\| */), - cells: cap[3].replace(/\n$/, '').split('\n') - }; - - for (i = 0; i < item.align.length; i++) { - if (/^ *-+: *$/.test(item.align[i])) { - item.align[i] = 'right'; - } else if (/^ *:-+: *$/.test(item.align[i])) { - item.align[i] = 'center'; - } else if (/^ *:-+ *$/.test(item.align[i])) { - item.align[i] = 'left'; - } else { - item.align[i] = null; - } - } - - for (i = 0; i < item.cells.length; i++) { - item.cells[i] = item.cells[i].split(/ *\| */); - } - - this$1.tokens.push(item); - - continue; - } - - // lheading - if (cap = this$1.rules.lheading.exec(src)) { - src = src.substring(cap[0].length); - this$1.tokens.push({ - type: 'heading', - depth: cap[2] === '=' ? 1 : 2, - text: cap[1] - }); - continue; - } - - // hr - if (cap = this$1.rules.hr.exec(src)) { - src = src.substring(cap[0].length); - this$1.tokens.push({ - type: 'hr' - }); - continue; - } - - // blockquote - if (cap = this$1.rules.blockquote.exec(src)) { - src = src.substring(cap[0].length); - - this$1.tokens.push({ - type: 'blockquote_start' - }); - - cap = cap[0].replace(/^ *> ?/gm, ''); - - // Pass `top` to keep the current - // "toplevel" state. This is exactly - // how markdown.pl works. - this$1.token(cap, top, true); - - this$1.tokens.push({ - type: 'blockquote_end' - }); - - continue; - } - - // list - if (cap = this$1.rules.list.exec(src)) { - src = src.substring(cap[0].length); - bull = cap[2]; - - this$1.tokens.push({ - type: 'list_start', - ordered: bull.length > 1 - }); - - // Get each top-level item. - cap = cap[0].match(this$1.rules.item); - - next = false; - l = cap.length; - i = 0; - - for (; i < l; i++) { - item = cap[i]; - - // Remove the list item's bullet - // so it is seen as the next token. - space = item.length; - item = item.replace(/^ *([*+-]|\d+\.) +/, ''); - - // Outdent whatever the - // list item contains. Hacky. - if (~item.indexOf('\n ')) { - space -= item.length; - item = !this$1.options.pedantic - ? item.replace(new RegExp('^ {1,' + space + '}', 'gm'), '') - : item.replace(/^ {1,4}/gm, ''); - } - - // Determine whether the next list item belongs here. - // Backpedal if it does not belong in this list. - if (this$1.options.smartLists && i !== l - 1) { - b = block.bullet.exec(cap[i + 1])[0]; - if (bull !== b && !(bull.length > 1 && b.length > 1)) { - src = cap.slice(i + 1).join('\n') + src; - i = l - 1; - } - } - - // Determine whether item is loose or not. - // Use: /(^|\n)(?! )[^\n]+\n\n(?!\s*$)/ - // for discount behavior. - loose = next || /\n\n(?!\s*$)/.test(item); - if (i !== l - 1) { - next = item.charAt(item.length - 1) === '\n'; - if (!loose) { loose = next; } - } - - this$1.tokens.push({ - type: loose - ? 'loose_item_start' - : 'list_item_start' - }); - - // Recurse. - this$1.token(item, false, bq); - - this$1.tokens.push({ - type: 'list_item_end' - }); - } - - this$1.tokens.push({ - type: 'list_end' - }); - - continue; - } - - // html - if (cap = this$1.rules.html.exec(src)) { - src = src.substring(cap[0].length); - this$1.tokens.push({ - type: this$1.options.sanitize - ? 'paragraph' - : 'html', - pre: !this$1.options.sanitizer - && (cap[1] === 'pre' || cap[1] === 'script' || cap[1] === 'style'), - text: cap[0] - }); - continue; - } - - // def - if ((!bq && top) && (cap = this$1.rules.def.exec(src))) { - src = src.substring(cap[0].length); - this$1.tokens.links[cap[1].toLowerCase()] = { - href: cap[2], - title: cap[3] - }; - continue; - } - - // table (gfm) - if (top && (cap = this$1.rules.table.exec(src))) { - src = src.substring(cap[0].length); - - item = { - type: 'table', - header: cap[1].replace(/^ *| *\| *$/g, '').split(/ *\| */), - align: cap[2].replace(/^ *|\| *$/g, '').split(/ *\| */), - cells: cap[3].replace(/(?: *\| *)?\n$/, '').split('\n') - }; - - for (i = 0; i < item.align.length; i++) { - if (/^ *-+: *$/.test(item.align[i])) { - item.align[i] = 'right'; - } else if (/^ *:-+: *$/.test(item.align[i])) { - item.align[i] = 'center'; - } else if (/^ *:-+ *$/.test(item.align[i])) { - item.align[i] = 'left'; - } else { - item.align[i] = null; - } - } - - for (i = 0; i < item.cells.length; i++) { - item.cells[i] = item.cells[i] - .replace(/^ *\| *| *\| *$/g, '') - .split(/ *\| */); - } - - this$1.tokens.push(item); - - continue; - } - - // top-level paragraph - if (top && (cap = this$1.rules.paragraph.exec(src))) { - src = src.substring(cap[0].length); - this$1.tokens.push({ - type: 'paragraph', - text: cap[1].charAt(cap[1].length - 1) === '\n' - ? cap[1].slice(0, -1) - : cap[1] - }); - continue; - } - - // text - if (cap = this$1.rules.text.exec(src)) { - // Top-level should never reach here. - src = src.substring(cap[0].length); - this$1.tokens.push({ - type: 'text', - text: cap[0] - }); - continue; - } - - if (src) { - throw new - Error('Infinite loop on byte: ' + src.charCodeAt(0)); - } - } - - return this.tokens; -}; - -/** - * Inline-Level Grammar - */ - -var inline = { - escape: /^\\([\\`*{}\[\]()#+\-.!_>])/, - autolink: /^<([^ >]+(@|:\/)[^ >]+)>/, - url: noop, - tag: /^|^<\/?\w+(?:"[^"]*"|'[^']*'|[^'">])*?>/, - link: /^!?\[(inside)\]\(href\)/, - reflink: /^!?\[(inside)\]\s*\[([^\]]*)\]/, - nolink: /^!?\[((?:\[[^\]]*\]|[^\[\]])*)\]/, - strong: /^__([\s\S]+?)__(?!_)|^\*\*([\s\S]+?)\*\*(?!\*)/, - em: /^\b_((?:[^_]|__)+?)_\b|^\*((?:\*\*|[\s\S])+?)\*(?!\*)/, - code: /^(`+)\s*([\s\S]*?[^`])\s*\1(?!`)/, - br: /^ {2,}\n(?!\s*$)/, - del: noop, - text: /^[\s\S]+?(?=[\\?(?:\s+['"]([\s\S]*?)['"])?\s*/; - -inline.link = replace(inline.link) - ('inside', inline._inside) - ('href', inline._href) - (); - -inline.reflink = replace(inline.reflink) - ('inside', inline._inside) - (); - -/** - * Normal Inline Grammar - */ - -inline.normal = merge({}, inline); - -/** - * Pedantic Inline Grammar - */ - -inline.pedantic = merge({}, inline.normal, { - strong: /^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/, - em: /^_(?=\S)([\s\S]*?\S)_(?!_)|^\*(?=\S)([\s\S]*?\S)\*(?!\*)/ -}); - -/** - * GFM Inline Grammar - */ - -inline.gfm = merge({}, inline.normal, { - escape: replace(inline.escape)('])', '~|])')(), - url: /^(https?:\/\/[^\s<]+[^<.,:;"')\]\s])/, - del: /^~~(?=\S)([\s\S]*?\S)~~/, - text: replace(inline.text) - (']|', '~]|') - ('|', '|https?://|') - () -}); - -/** - * GFM + Line Breaks Inline Grammar - */ - -inline.breaks = merge({}, inline.gfm, { - br: replace(inline.br)('{2,}', '*')(), - text: replace(inline.gfm.text)('{2,}', '*')() -}); - -/** - * Inline Lexer & Compiler - */ - -function InlineLexer(links, options) { - this.options = options || marked.defaults; - this.links = links; - this.rules = inline.normal; - this.renderer = this.options.renderer || new Renderer; - this.renderer.options = this.options; - - if (!this.links) { - throw new - Error('Tokens array requires a `links` property.'); - } - - if (this.options.gfm) { - if (this.options.breaks) { - this.rules = inline.breaks; - } else { - this.rules = inline.gfm; - } - } else if (this.options.pedantic) { - this.rules = inline.pedantic; - } -} - -/** - * Expose Inline Rules - */ - -InlineLexer.rules = inline; - -/** - * Static Lexing/Compiling Method - */ - -InlineLexer.output = function(src, links, options) { - var inline = new InlineLexer(links, options); - return inline.output(src); -}; - -/** - * Lexing/Compiling - */ - -InlineLexer.prototype.output = function(src) { - var this$1 = this; - - var out = '' - , link - , text - , href - , cap; - - while (src) { - // escape - if (cap = this$1.rules.escape.exec(src)) { - src = src.substring(cap[0].length); - out += cap[1]; - continue; - } - - // autolink - if (cap = this$1.rules.autolink.exec(src)) { - src = src.substring(cap[0].length); - if (cap[2] === '@') { - text = cap[1].charAt(6) === ':' - ? this$1.mangle(cap[1].substring(7)) - : this$1.mangle(cap[1]); - href = this$1.mangle('mailto:') + text; - } else { - text = escape(cap[1]); - href = text; - } - out += this$1.renderer.link(href, null, text); - continue; - } - - // url (gfm) - if (!this$1.inLink && (cap = this$1.rules.url.exec(src))) { - src = src.substring(cap[0].length); - text = escape(cap[1]); - href = text; - out += this$1.renderer.link(href, null, text); - continue; - } - - // tag - if (cap = this$1.rules.tag.exec(src)) { - if (!this$1.inLink && /^/i.test(cap[0])) { - this$1.inLink = false; - } - src = src.substring(cap[0].length); - out += this$1.options.sanitize - ? this$1.options.sanitizer - ? this$1.options.sanitizer(cap[0]) - : escape(cap[0]) - : cap[0]; - continue; - } - - // link - if (cap = this$1.rules.link.exec(src)) { - src = src.substring(cap[0].length); - this$1.inLink = true; - out += this$1.outputLink(cap, { - href: cap[2], - title: cap[3] - }); - this$1.inLink = false; - continue; - } - - // reflink, nolink - if ((cap = this$1.rules.reflink.exec(src)) - || (cap = this$1.rules.nolink.exec(src))) { - src = src.substring(cap[0].length); - link = (cap[2] || cap[1]).replace(/\s+/g, ' '); - link = this$1.links[link.toLowerCase()]; - if (!link || !link.href) { - out += cap[0].charAt(0); - src = cap[0].substring(1) + src; - continue; - } - this$1.inLink = true; - out += this$1.outputLink(cap, link); - this$1.inLink = false; - continue; - } - - // strong - if (cap = this$1.rules.strong.exec(src)) { - src = src.substring(cap[0].length); - out += this$1.renderer.strong(this$1.output(cap[2] || cap[1])); - continue; - } - - // em - if (cap = this$1.rules.em.exec(src)) { - src = src.substring(cap[0].length); - out += this$1.renderer.em(this$1.output(cap[2] || cap[1])); - continue; - } - - // code - if (cap = this$1.rules.code.exec(src)) { - src = src.substring(cap[0].length); - out += this$1.renderer.codespan(escape(cap[2], true)); - continue; - } - - // br - if (cap = this$1.rules.br.exec(src)) { - src = src.substring(cap[0].length); - out += this$1.renderer.br(); - continue; - } - - // del (gfm) - if (cap = this$1.rules.del.exec(src)) { - src = src.substring(cap[0].length); - out += this$1.renderer.del(this$1.output(cap[1])); - continue; - } - - // text - if (cap = this$1.rules.text.exec(src)) { - src = src.substring(cap[0].length); - out += this$1.renderer.text(escape(this$1.smartypants(cap[0]))); - continue; - } - - if (src) { - throw new - Error('Infinite loop on byte: ' + src.charCodeAt(0)); - } - } - - return out; -}; - -/** - * Compile Link - */ - -InlineLexer.prototype.outputLink = function(cap, link) { - var href = escape(link.href) - , title = link.title ? escape(link.title) : null; - - return cap[0].charAt(0) !== '!' - ? this.renderer.link(href, title, this.output(cap[1])) - : this.renderer.image(href, title, escape(cap[1])); -}; - -/** - * Smartypants Transformations - */ - -InlineLexer.prototype.smartypants = function(text) { - if (!this.options.smartypants) { return text; } - return text - // em-dashes - .replace(/---/g, '\u2014') - // en-dashes - .replace(/--/g, '\u2013') - // opening singles - .replace(/(^|[-\u2014/(\[{"\s])'/g, '$1\u2018') - // closing singles & apostrophes - .replace(/'/g, '\u2019') - // opening doubles - .replace(/(^|[-\u2014/(\[{\u2018\s])"/g, '$1\u201c') - // closing doubles - .replace(/"/g, '\u201d') - // ellipses - .replace(/\.{3}/g, '\u2026'); -}; - -/** - * Mangle Links - */ - -InlineLexer.prototype.mangle = function(text) { - if (!this.options.mangle) { return text; } - var out = '' - , l = text.length - , i = 0 - , ch; - - for (; i < l; i++) { - ch = text.charCodeAt(i); - if (Math.random() > 0.5) { - ch = 'x' + ch.toString(16); - } - out += '&#' + ch + ';'; - } - - return out; -}; - -/** - * Renderer - */ - -function Renderer(options) { - this.options = options || {}; -} - -Renderer.prototype.code = function(code, lang, escaped) { - if (this.options.highlight) { - var out = this.options.highlight(code, lang); - if (out != null && out !== code) { - escaped = true; - code = out; - } - } - - if (!lang) { - return '
'
-      + (escaped ? code : escape(code, true))
-      + '\n
'; - } - - return '
'
-    + (escaped ? code : escape(code, true))
-    + '\n
\n'; -}; - -Renderer.prototype.blockquote = function(quote) { - return '
\n' + quote + '
\n'; -}; - -Renderer.prototype.html = function(html) { - return html; -}; - -Renderer.prototype.heading = function(text, level, raw) { - return '' - + text - + '\n'; -}; - -Renderer.prototype.hr = function() { - return this.options.xhtml ? '
\n' : '
\n'; -}; - -Renderer.prototype.list = function(body, ordered) { - var type = ordered ? 'ol' : 'ul'; - return '<' + type + '>\n' + body + '\n'; -}; - -Renderer.prototype.listitem = function(text) { - return '
  • ' + text + '
  • \n'; -}; - -Renderer.prototype.paragraph = function(text) { - return '

    ' + text + '

    \n'; -}; - -Renderer.prototype.table = function(header, body) { - return '\n' - + '\n' - + header - + '\n' - + '\n' - + body - + '\n' - + '
    \n'; -}; - -Renderer.prototype.tablerow = function(content) { - return '\n' + content + '\n'; -}; - -Renderer.prototype.tablecell = function(content, flags) { - var type = flags.header ? 'th' : 'td'; - var tag = flags.align - ? '<' + type + ' style="text-align:' + flags.align + '">' - : '<' + type + '>'; - return tag + content + '\n'; -}; - -// span level renderer -Renderer.prototype.strong = function(text) { - return '' + text + ''; -}; - -Renderer.prototype.em = function(text) { - return '' + text + ''; -}; - -Renderer.prototype.codespan = function(text) { - return '' + text + ''; -}; - -Renderer.prototype.br = function() { - return this.options.xhtml ? '
    ' : '
    '; -}; - -Renderer.prototype.del = function(text) { - return '' + text + ''; -}; - -Renderer.prototype.link = function(href, title, text) { - if (this.options.sanitize) { - try { - var prot = decodeURIComponent(unescape(href)) - .replace(/[^\w:]/g, '') - .toLowerCase(); - } catch (e) { - return ''; - } - if (prot.indexOf('javascript:') === 0 || prot.indexOf('vbscript:') === 0) { - return ''; - } - } - var out = '
    '; - return out; -}; - -Renderer.prototype.image = function(href, title, text) { - var out = '' + text + '' : '>'; - return out; -}; - -Renderer.prototype.text = function(text) { - return text; -}; - -/** - * Parsing & Compiling - */ - -function Parser(options) { - this.tokens = []; - this.token = null; - this.options = options || marked.defaults; - this.options.renderer = this.options.renderer || new Renderer; - this.renderer = this.options.renderer; - this.renderer.options = this.options; -} - -/** - * Static Parse Method - */ - -Parser.parse = function(src, options, renderer) { - var parser = new Parser(options, renderer); - return parser.parse(src); -}; - -/** - * Parse Loop - */ - -Parser.prototype.parse = function(src) { - var this$1 = this; - - this.inline = new InlineLexer(src.links, this.options, this.renderer); - this.tokens = src.reverse(); - - var out = ''; - while (this.next()) { - out += this$1.tok(); - } - - return out; -}; - -/** - * Next Token - */ - -Parser.prototype.next = function() { - return this.token = this.tokens.pop(); -}; - -/** - * Preview Next Token - */ - -Parser.prototype.peek = function() { - return this.tokens[this.tokens.length - 1] || 0; -}; - -/** - * Parse Text Tokens - */ - -Parser.prototype.parseText = function() { - var this$1 = this; - - var body = this.token.text; - - while (this.peek().type === 'text') { - body += '\n' + this$1.next().text; - } - - return this.inline.output(body); -}; - -/** - * Parse Current Token - */ - -Parser.prototype.tok = function() { - var this$1 = this; - - switch (this.token.type) { - case 'space': { - return ''; - } - case 'hr': { - return this.renderer.hr(); - } - case 'heading': { - return this.renderer.heading( - this.inline.output(this.token.text), - this.token.depth, - this.token.text); - } - case 'code': { - return this.renderer.code(this.token.text, - this.token.lang, - this.token.escaped); - } - case 'table': { - var header = '' - , body = '' - , i - , row - , cell - , flags - , j; - - // header - cell = ''; - for (i = 0; i < this.token.header.length; i++) { - flags = { header: true, align: this$1.token.align[i] }; - cell += this$1.renderer.tablecell( - this$1.inline.output(this$1.token.header[i]), - { header: true, align: this$1.token.align[i] } - ); - } - header += this.renderer.tablerow(cell); - - for (i = 0; i < this.token.cells.length; i++) { - row = this$1.token.cells[i]; - - cell = ''; - for (j = 0; j < row.length; j++) { - cell += this$1.renderer.tablecell( - this$1.inline.output(row[j]), - { header: false, align: this$1.token.align[j] } - ); - } - - body += this$1.renderer.tablerow(cell); - } - return this.renderer.table(header, body); - } - case 'blockquote_start': { - var body = ''; - - while (this.next().type !== 'blockquote_end') { - body += this$1.tok(); - } - - return this.renderer.blockquote(body); - } - case 'list_start': { - var body = '' - , ordered = this.token.ordered; - - while (this.next().type !== 'list_end') { - body += this$1.tok(); - } - - return this.renderer.list(body, ordered); - } - case 'list_item_start': { - var body = ''; - - while (this.next().type !== 'list_item_end') { - body += this$1.token.type === 'text' - ? this$1.parseText() - : this$1.tok(); - } - - return this.renderer.listitem(body); - } - case 'loose_item_start': { - var body = ''; - - while (this.next().type !== 'list_item_end') { - body += this$1.tok(); - } - - return this.renderer.listitem(body); - } - case 'html': { - var html = !this.token.pre && !this.options.pedantic - ? this.inline.output(this.token.text) - : this.token.text; - return this.renderer.html(html); - } - case 'paragraph': { - return this.renderer.paragraph(this.inline.output(this.token.text)); - } - case 'text': { - return this.renderer.paragraph(this.parseText()); - } - } -}; - -/** - * Helpers - */ - -function escape(html, encode) { - return html - .replace(!encode ? /&(?!#?\w+;)/g : /&/g, '&') - .replace(//g, '>') - .replace(/"/g, '"') - .replace(/'/g, '''); -} - -function unescape(html) { - // explicitly match decimal, hex, and named HTML entities - return html.replace(/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/g, function(_, n) { - n = n.toLowerCase(); - if (n === 'colon') { return ':'; } - if (n.charAt(0) === '#') { - return n.charAt(1) === 'x' - ? String.fromCharCode(parseInt(n.substring(2), 16)) - : String.fromCharCode(+n.substring(1)); - } - return ''; - }); -} - -function replace(regex, opt) { - regex = regex.source; - opt = opt || ''; - return function self(name, val) { - if (!name) { return new RegExp(regex, opt); } - val = val.source || val; - val = val.replace(/(^|[^\[])\^/g, '$1'); - regex = regex.replace(name, val); - return self; - }; -} - -function noop() {} -noop.exec = noop; - -function merge(obj) { - var arguments$1 = arguments; - - var i = 1 - , target - , key; - - for (; i < arguments.length; i++) { - target = arguments$1[i]; - for (key in target) { - if (Object.prototype.hasOwnProperty.call(target, key)) { - obj[key] = target[key]; - } - } - } - - return obj; -} - - -/** - * Marked - */ - -function marked(src, opt, callback) { - if (callback || typeof opt === 'function') { - if (!callback) { - callback = opt; - opt = null; - } - - opt = merge({}, marked.defaults, opt || {}); - - var highlight = opt.highlight - , tokens - , pending - , i = 0; - - try { - tokens = Lexer.lex(src, opt); - } catch (e) { - return callback(e); - } - - pending = tokens.length; - - var done = function(err) { - if (err) { - opt.highlight = highlight; - return callback(err); - } - - var out; - - try { - out = Parser.parse(tokens, opt); - } catch (e) { - err = e; - } - - opt.highlight = highlight; - - return err - ? callback(err) - : callback(null, out); - }; - - if (!highlight || highlight.length < 3) { - return done(); - } - - delete opt.highlight; - - if (!pending) { return done(); } - - for (; i < tokens.length; i++) { - (function(token) { - if (token.type !== 'code') { - return --pending || done(); - } - return highlight(token.text, token.lang, function(err, code) { - if (err) { return done(err); } - if (code == null || code === token.text) { - return --pending || done(); - } - token.text = code; - token.escaped = true; - --pending || done(); - }); - })(tokens[i]); - } - - return; - } - try { - if (opt) { opt = merge({}, marked.defaults, opt); } - return Parser.parse(Lexer.lex(src, opt), opt); - } catch (e) { - e.message += '\nPlease report this to https://github.com/chjj/marked.'; - if ((opt || marked.defaults).silent) { - return '

    An error occured:

    '
    -        + escape(e.message + '', true)
    -        + '
    '; - } - throw e; - } -} - -/** - * Options - */ - -marked.options = -marked.setOptions = function(opt) { - merge(marked.defaults, opt); - return marked; -}; - -marked.defaults = { - gfm: true, - tables: true, - breaks: false, - pedantic: false, - sanitize: false, - sanitizer: null, - mangle: true, - smartLists: false, - silent: false, - highlight: null, - langPrefix: 'lang-', - smartypants: false, - headerPrefix: '', - renderer: new Renderer, - xhtml: false -}; - -/** - * Expose - */ - -marked.Parser = Parser; -marked.parser = Parser.parse; - -marked.Renderer = Renderer; - -marked.Lexer = Lexer; -marked.lexer = Lexer.lex; - -marked.InlineLexer = InlineLexer; -marked.inlineLexer = InlineLexer.output; - -marked.parse = marked; - -{ - module.exports = marked; -} - -}).call(function() { - return this || (typeof window !== 'undefined' ? window : commonjsGlobal); -}()); -}); - -var prism = createCommonjsModule(function (module) { -/* ********************************************** - Begin prism-core.js -********************************************** */ - -var _self = (typeof window !== 'undefined') - ? window // if in browser - : ( - (typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScope) - ? self // if in worker - : {} // if in node js - ); - -/** - * Prism: Lightweight, robust, elegant syntax highlighting - * MIT license http://www.opensource.org/licenses/mit-license.php/ - * @author Lea Verou http://lea.verou.me - */ - -var Prism = (function(){ - -// Private helper vars -var lang = /\blang(?:uage)?-(\w+)\b/i; -var uniqueId = 0; - -var _ = _self.Prism = { - util: { - encode: function (tokens) { - if (tokens instanceof Token) { - return new Token(tokens.type, _.util.encode(tokens.content), tokens.alias); - } else if (_.util.type(tokens) === 'Array') { - return tokens.map(_.util.encode); - } else { - return tokens.replace(/&/g, '&').replace(/ text.length) { - // Something went terribly wrong, ABORT, ABORT! - break tokenloop; - } - - if (str instanceof Token) { - continue; - } - - pattern.lastIndex = 0; - - var match = pattern.exec(str), - delNum = 1; - - // Greedy patterns can override/remove up to two previously matched tokens - if (!match && greedy && i != strarr.length - 1) { - pattern.lastIndex = pos; - match = pattern.exec(text); - if (!match) { - break; - } - - var from = match.index + (lookbehind ? match[1].length : 0), - to = match.index + match[0].length, - k = i, - p = pos; - - for (var len = strarr.length; k < len && p < to; ++k) { - p += strarr[k].length; - // Move the index i to the element in strarr that is closest to from - if (from >= p) { - ++i; - pos = p; - } - } - - /* - * If strarr[i] is a Token, then the match starts inside another Token, which is invalid - * If strarr[k - 1] is greedy we are in conflict with another greedy pattern - */ - if (strarr[i] instanceof Token || strarr[k - 1].greedy) { - continue; - } - - // Number of tokens to delete and replace with the new match - delNum = k - i; - str = text.slice(pos, p); - match.index -= pos; - } - - if (!match) { - continue; - } - - if(lookbehind) { - lookbehindLength = match[1].length; - } - - var from = match.index + lookbehindLength, - match = match[0].slice(lookbehindLength), - to = from + match.length, - before = str.slice(0, from), - after = str.slice(to); - - var args = [i, delNum]; - - if (before) { - args.push(before); - } - - var wrapped = new Token(token, inside? _.tokenize(match, inside) : match, alias, match, greedy); - - args.push(wrapped); - - if (after) { - args.push(after); - } - - Array.prototype.splice.apply(strarr, args); - } - } - } - - return strarr; - }, - - hooks: { - all: {}, - - add: function (name, callback) { - var hooks = _.hooks.all; - - hooks[name] = hooks[name] || []; - - hooks[name].push(callback); - }, - - run: function (name, env) { - var callbacks = _.hooks.all[name]; - - if (!callbacks || !callbacks.length) { - return; - } - - for (var i=0, callback; callback = callbacks[i++];) { - callback(env); - } - } - } -}; - -var Token = _.Token = function(type, content, alias, matchedStr, greedy) { - this.type = type; - this.content = content; - this.alias = alias; - // Copy of the full string this token was created from - this.length = (matchedStr || "").length|0; - this.greedy = !!greedy; -}; - -Token.stringify = function(o, language, parent) { - if (typeof o == 'string') { - return o; - } - - if (_.util.type(o) === 'Array') { - return o.map(function(element) { - return Token.stringify(element, language, o); - }).join(''); - } - - var env = { - type: o.type, - content: Token.stringify(o.content, language, parent), - tag: 'span', - classes: ['token', o.type], - attributes: {}, - language: language, - parent: parent - }; - - if (env.type == 'comment') { - env.attributes['spellcheck'] = 'true'; - } - - if (o.alias) { - var aliases = _.util.type(o.alias) === 'Array' ? o.alias : [o.alias]; - Array.prototype.push.apply(env.classes, aliases); - } - - _.hooks.run('wrap', env); - - var attributes = Object.keys(env.attributes).map(function(name) { - return name + '="' + (env.attributes[name] || '').replace(/"/g, '"') + '"'; - }).join(' '); - - return '<' + env.tag + ' class="' + env.classes.join(' ') + '"' + (attributes ? ' ' + attributes : '') + '>' + env.content + ''; - -}; - -if (!_self.document) { - if (!_self.addEventListener) { - // in Node.js - return _self.Prism; - } - // In worker - _self.addEventListener('message', function(evt) { - var message = JSON.parse(evt.data), - lang = message.language, - code = message.code, - immediateClose = message.immediateClose; - - _self.postMessage(_.highlight(code, _.languages[lang], lang)); - if (immediateClose) { - _self.close(); - } - }, false); - - return _self.Prism; -} - -//Get current script and highlight -var script = document.currentScript || [].slice.call(document.getElementsByTagName("script")).pop(); - -if (script) { - _.filename = script.src; - - if (document.addEventListener && !script.hasAttribute('data-manual')) { - if(document.readyState !== "loading") { - if (window.requestAnimationFrame) { - window.requestAnimationFrame(_.highlightAll); - } else { - window.setTimeout(_.highlightAll, 16); - } - } - else { - document.addEventListener('DOMContentLoaded', _.highlightAll); - } - } -} - -return _self.Prism; - -})(); - -if ('object' !== 'undefined' && module.exports) { - module.exports = Prism; -} - -// hack for components to work correctly in node.js -if (typeof commonjsGlobal !== 'undefined') { - commonjsGlobal.Prism = Prism; -} - - -/* ********************************************** - Begin prism-markup.js -********************************************** */ - -Prism.languages.markup = { - 'comment': //, - 'prolog': /<\?[\w\W]+?\?>/, - 'doctype': //i, - 'cdata': //i, - 'tag': { - pattern: /<\/?(?!\d)[^\s>\/=$<]+(?:\s+[^\s>\/=]+(?:=(?:("|')(?:\\\1|\\?(?!\1)[\w\W])*\1|[^\s'">=]+))?)*\s*\/?>/i, - inside: { - 'tag': { - pattern: /^<\/?[^\s>\/]+/i, - inside: { - 'punctuation': /^<\/?/, - 'namespace': /^[^\s>\/:]+:/ - } - }, - 'attr-value': { - pattern: /=(?:('|")[\w\W]*?(\1)|[^\s>]+)/i, - inside: { - 'punctuation': /[=>"']/ - } - }, - 'punctuation': /\/?>/, - 'attr-name': { - pattern: /[^\s>\/]+/, - inside: { - 'namespace': /^[^\s>\/:]+:/ - } - } - - } - }, - 'entity': /&#?[\da-z]{1,8};/i -}; - -// Plugin to make entity title show the real entity, idea by Roman Komarov -Prism.hooks.add('wrap', function(env) { - - if (env.type === 'entity') { - env.attributes['title'] = env.content.replace(/&/, '&'); - } -}); - -Prism.languages.xml = Prism.languages.markup; -Prism.languages.html = Prism.languages.markup; -Prism.languages.mathml = Prism.languages.markup; -Prism.languages.svg = Prism.languages.markup; - - -/* ********************************************** - Begin prism-css.js -********************************************** */ - -Prism.languages.css = { - 'comment': /\/\*[\w\W]*?\*\//, - 'atrule': { - pattern: /@[\w-]+?.*?(;|(?=\s*\{))/i, - inside: { - 'rule': /@[\w-]+/ - // See rest below - } - }, - 'url': /url\((?:(["'])(\\(?:\r\n|[\w\W])|(?!\1)[^\\\r\n])*\1|.*?)\)/i, - 'selector': /[^\{\}\s][^\{\};]*?(?=\s*\{)/, - 'string': { - pattern: /("|')(\\(?:\r\n|[\w\W])|(?!\1)[^\\\r\n])*\1/, - greedy: true - }, - 'property': /(\b|\B)[\w-]+(?=\s*:)/i, - 'important': /\B!important\b/i, - 'function': /[-a-z0-9]+(?=\()/i, - 'punctuation': /[(){};:]/ -}; - -Prism.languages.css['atrule'].inside.rest = Prism.util.clone(Prism.languages.css); - -if (Prism.languages.markup) { - Prism.languages.insertBefore('markup', 'tag', { - 'style': { - pattern: /()[\w\W]*?(?=<\/style>)/i, - lookbehind: true, - inside: Prism.languages.css, - alias: 'language-css' - } - }); - - Prism.languages.insertBefore('inside', 'attr-value', { - 'style-attr': { - pattern: /\s*style=("|').*?\1/i, - inside: { - 'attr-name': { - pattern: /^\s*style/i, - inside: Prism.languages.markup.tag.inside - }, - 'punctuation': /^\s*=\s*['"]|['"]\s*$/, - 'attr-value': { - pattern: /.+/i, - inside: Prism.languages.css - } - }, - alias: 'language-css' - } - }, Prism.languages.markup.tag); -} - -/* ********************************************** - Begin prism-clike.js -********************************************** */ - -Prism.languages.clike = { - 'comment': [ - { - pattern: /(^|[^\\])\/\*[\w\W]*?\*\//, - lookbehind: true - }, - { - pattern: /(^|[^\\:])\/\/.*/, - lookbehind: true - } - ], - 'string': { - pattern: /(["'])(\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/, - greedy: true - }, - 'class-name': { - pattern: /((?:\b(?:class|interface|extends|implements|trait|instanceof|new)\s+)|(?:catch\s+\())[a-z0-9_\.\\]+/i, - lookbehind: true, - inside: { - punctuation: /(\.|\\)/ - } - }, - 'keyword': /\b(if|else|while|do|for|return|in|instanceof|function|new|try|throw|catch|finally|null|break|continue)\b/, - 'boolean': /\b(true|false)\b/, - 'function': /[a-z0-9_]+(?=\()/i, - 'number': /\b-?(?:0x[\da-f]+|\d*\.?\d+(?:e[+-]?\d+)?)\b/i, - 'operator': /--?|\+\+?|!=?=?|<=?|>=?|==?=?|&&?|\|\|?|\?|\*|\/|~|\^|%/, - 'punctuation': /[{}[\];(),.:]/ -}; - - -/* ********************************************** - Begin prism-javascript.js -********************************************** */ - -Prism.languages.javascript = Prism.languages.extend('clike', { - 'keyword': /\b(as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|var|void|while|with|yield)\b/, - 'number': /\b-?(0x[\dA-Fa-f]+|0b[01]+|0o[0-7]+|\d*\.?\d+([Ee][+-]?\d+)?|NaN|Infinity)\b/, - // Allow for all non-ASCII characters (See http://stackoverflow.com/a/2008444) - 'function': /[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*(?=\()/i, - 'operator': /--?|\+\+?|!=?=?|<=?|>=?|==?=?|&&?|\|\|?|\?|\*\*?|\/|~|\^|%|\.{3}/ -}); - -Prism.languages.insertBefore('javascript', 'keyword', { - 'regex': { - pattern: /(^|[^/])\/(?!\/)(\[.+?]|\\.|[^/\\\r\n])+\/[gimyu]{0,5}(?=\s*($|[\r\n,.;})]))/, - lookbehind: true, - greedy: true - } -}); - -Prism.languages.insertBefore('javascript', 'string', { - 'template-string': { - pattern: /`(?:\\\\|\\?[^\\])*?`/, - greedy: true, - inside: { - 'interpolation': { - pattern: /\$\{[^}]+\}/, - inside: { - 'interpolation-punctuation': { - pattern: /^\$\{|\}$/, - alias: 'punctuation' - }, - rest: Prism.languages.javascript - } - }, - 'string': /[\s\S]+/ - } - } -}); - -if (Prism.languages.markup) { - Prism.languages.insertBefore('markup', 'tag', { - 'script': { - pattern: /()[\w\W]*?(?=<\/script>)/i, - lookbehind: true, - inside: Prism.languages.javascript, - alias: 'language-javascript' - } - }); -} - -Prism.languages.js = Prism.languages.javascript; - -/* ********************************************** - Begin prism-file-highlight.js -********************************************** */ - -(function () { - if (typeof self === 'undefined' || !self.Prism || !self.document || !document.querySelector) { - return; - } - - self.Prism.fileHighlight = function() { - - var Extensions = { - 'js': 'javascript', - 'py': 'python', - 'rb': 'ruby', - 'ps1': 'powershell', - 'psm1': 'powershell', - 'sh': 'bash', - 'bat': 'batch', - 'h': 'c', - 'tex': 'latex' - }; - - if(Array.prototype.forEach) { // Check to prevent error in IE8 - Array.prototype.slice.call(document.querySelectorAll('pre[data-src]')).forEach(function (pre) { - var src = pre.getAttribute('data-src'); - - var language, parent = pre; - var lang = /\blang(?:uage)?-(?!\*)(\w+)\b/i; - while (parent && !lang.test(parent.className)) { - parent = parent.parentNode; - } - - if (parent) { - language = (pre.className.match(lang) || [, ''])[1]; - } - - if (!language) { - var extension = (src.match(/\.(\w+)$/) || [, ''])[1]; - language = Extensions[extension] || extension; - } - - var code = document.createElement('code'); - code.className = 'language-' + language; - - pre.textContent = ''; - - code.textContent = 'Loading…'; - - pre.appendChild(code); - - var xhr = new XMLHttpRequest(); - - xhr.open('GET', src, true); - - xhr.onreadystatechange = function () { - if (xhr.readyState == 4) { - - if (xhr.status < 400 && xhr.responseText) { - code.textContent = xhr.responseText; - - Prism.highlightElement(code); - } - else if (xhr.status >= 400) { - code.textContent = '✖ Error ' + xhr.status + ' while fetching file: ' + xhr.statusText; - } - else { - code.textContent = '✖ Error: File does not exist or is empty'; - } - } - }; - - xhr.send(null); - }); - } - - }; - - document.addEventListener('DOMContentLoaded', self.Prism.fileHighlight); - -})(); -}); - -/** - * Render github corner - * @param {Object} data - * @return {String} - */ -function corner (data) { - if (!data) { return '' } - if (!/\/\//.test(data)) { data = 'https://github.com/' + data; } - data = data.replace(/^git\+/, ''); - - return ("\n
    \n \n \n \n \n \n ") -} - -/** - * Render main content - */ -function main (tpl) { - var aside = tpl + ""; - - return (isMobile() ? (aside + "
    ") : ("
    " + aside)) + - "
    \n
    \n
    \n
    " -} - -/** - * Cover Page - */ -function cover () { - var SL = ', 100%, 85%'; - var bgc = "linear-gradient(to left bottom, hsl(" + (Math.floor(Math.random() * 255) + SL) + ") 0%, hsl(" + (Math.floor(Math.random() * 255) + SL) + ") 100%)"; - - return ("
    \n
    \n
    \n
    ") -} - -function toggle () { - return "" -} - -/** - * Render tree - * @param {Array} tree - * @param {String} tpl - * @return {String} - */ -function tree (toc, tpl) { - if ( tpl === void 0 ) tpl = ''; - - if (!toc || !toc.length) { return '' } - - toc.forEach(function (node) { - tpl += "
  • " + (node.title) + "
  • "; - if (node.children) { - tpl += "
    • " + (tree(node.children)) + "
    "; - } - }); - - return tpl -} - -function helper (className, content) { - return ("

    " + (content.slice(5).trim()) + "

    ") -} - -var OPTIONS$1 = {}; -var markdown = marked; -var toc = []; -var CACHE = {}; - -var renderTo = function (dom, content) { - dom = typeof dom === 'object' ? dom : document.querySelector(dom); - dom.innerHTML = content; - slugify.clear(); - - return dom -}; - -/** - * init render - * @param {Object} options - */ -function init (options) { - OPTIONS$1 = options; - - var renderer = new marked.Renderer(); - /** - * render anchor tag - * @link https://github.com/chjj/marked#overriding-renderer-methods - */ - renderer.heading = function (text, level) { - var slug = slugify(text); - var route = ''; - - if (OPTIONS$1.router) { - route = "#/" + (getRoute()); - } - - toc.push({ level: level, slug: (route + "#" + (encodeURIComponent(slug))), title: text }); - - return ("" + text + "") - }; - // highlight code - renderer.code = function (code, lang) { - if ( lang === void 0 ) lang = ''; - - var hl = prism.highlight(code, prism.languages[lang] || prism.languages.markup); - - return ("
    " + (hl.replace(/:/g, '__colon__')) + "
    ") - }; - renderer.link = function (href, title, text) { - if (OPTIONS$1.router && !/:/.test(href)) { - href = ("#/" + href).replace(/\/\//g, '/'); - } - - return ("" + text + "") - }; - renderer.paragraph = function (text) { - if (/^!>/.test(text)) { - return helper('tip', text) - } else if (/^\?>/.test(text)) { - return helper('warn', text) - } - return ("

    " + text + "

    ") - }; - - if (typeof OPTIONS$1.markdown === 'function') { - markdown.setOptions({ renderer: renderer }); - markdown = OPTIONS$1.markdown.call(this, markdown); - } else { - markdown.setOptions(merge({ renderer: renderer }, OPTIONS$1.markdown)); - } - - var md = markdown; - - markdown = function (text) { return emojify(md(text)); }; -} - -/** - * App - */ -function renderApp (dom, replace) { - var nav = document.querySelector('nav') || document.createElement('nav'); - - if (!OPTIONS$1.repo) { nav.classList.add('no-badge'); } - - dom[replace ? 'outerHTML' : 'innerHTML'] = corner(OPTIONS$1.repo) + - (OPTIONS$1.coverpage ? cover() : '') + - main(OPTIONS$1.sidebarToggle ? toggle() : ''); - document.body.insertBefore(nav, document.body.children[0]); - - // bind toggle - bindToggle('button.sidebar-toggle'); - // bind sticky effect - if (OPTIONS$1.coverpage) { - !isMobile() && window.addEventListener('scroll', sticky); - } else { - document.body.classList.add('sticky'); - } -} - -/** - * article - */ -function renderArticle (content) { - renderTo('article', content ? markdown(content) : 'not found'); - if (!OPTIONS$1.sidebar && !OPTIONS$1.loadSidebar) { renderSidebar(); } - - if (content && typeof Vue !== 'undefined') { - var script = content.match(']*?>([^<]+)'); - - script && document.body.querySelector('article script').remove(); - CACHE.vm && CACHE.vm.$destroy(); - CACHE.vm = script - ? new Function(("return " + (script[1].trim())))() - : new Vue({ el: 'main' }); // eslint-disable-line - CACHE.vm && CACHE.vm.$nextTick(function (_) { return scrollActiveSidebar(); }); - } - if (OPTIONS$1.auto2top) { setTimeout(function () { return scroll2Top(OPTIONS$1.auto2top); }, 0); } -} - -/** - * navbar - */ -function renderNavbar (content) { - if (CACHE.navbar && CACHE.navbar === content) { return } - CACHE.navbar = content; - - if (content) { renderTo('nav', markdown(content)); } - activeLink('nav'); -} - -/** - * sidebar - */ -function renderSidebar (content) { - var html; - - if (content) { - html = markdown(content); - // find url tag - html = html.match(/]*>([\s\S]+)<\/ul>/g)[0]; - } else if (OPTIONS$1.sidebar) { - html = tree(OPTIONS$1.sidebar, '