diff --git a/.eslintignore b/.eslintignore
deleted file mode 100644
index a3b8548..0000000
--- a/.eslintignore
+++ /dev/null
@@ -1,5 +0,0 @@
-.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 a8f7cd0..527ed9b 100644
--- a/.eslintrc
+++ b/.eslintrc
@@ -1,20 +1,9 @@
{
- "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"
+ "extends": ["vue"],
+ "env": {
+ "browser": true
},
"globals": {
- "Docsify": true,
- "$docsify": true,
- "process": true
+ "$docsify": true
}
}
diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md
deleted file mode 100644
index 35d6b90..0000000
--- a/.github/ISSUE_TEMPLATE/bug_report.md
+++ /dev/null
@@ -1,38 +0,0 @@
----
-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
deleted file mode 100644
index 501e4de..0000000
--- a/.github/ISSUE_TEMPLATE/feature_request.md
+++ /dev/null
@@ -1,25 +0,0 @@
----
-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
deleted file mode 100644
index bb31bd4..0000000
--- a/.github/PULL_REQUEST_TEMPLATE.md
+++ /dev/null
@@ -1,54 +0,0 @@
-
-
-
-
-
-
-**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 ea4b5b8..ee8a519 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,9 +1,4 @@
-*.log
.DS_Store
-.idea
+*.log
node_modules
-themes/
-lib/
-
-# exceptions
-!.gitkeep
\ No newline at end of file
+/themes
\ No newline at end of file
diff --git a/.npmignore b/.npmignore
deleted file mode 100644
index 41b1431..0000000
--- a/.npmignore
+++ /dev/null
@@ -1,5 +0,0 @@
-.eslintignore
-.eslintrc
-.github/
-.gitignore
-.travis.yml
diff --git a/.travis.yml b/.travis.yml
index 87576c5..fb0b83e 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,3 +1,6 @@
sudo: false
+cache:
+ directories:
+ - $HOME/.yarn-cache
language: node_js
node_js: stable
diff --git a/.vscode/settings.json b/.vscode/settings.json
deleted file mode 100644
index b7d6eb8..0000000
--- a/.vscode/settings.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "prettier.eslintIntegration": true
-}
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 267d402..76f6013 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,753 +1,97 @@
-
-## [4.9.4](https://github.com/docsifyjs/docsify/compare/v4.9.2...v4.9.4) (2019-05-05)
+### 2.4.3
+> 2017-02-15
+#### Bug fixes
+* fix emoji replacing error (#76)
-
-## [4.9.2](https://github.com/docsifyjs/docsify/compare/v4.9.1...v4.9.2) (2019-04-21)
+### 2.4.2
+> 2017-02-14
-### Bug Fixes
+#### Bug fixes
+- fix(index): load file path error
-* re-render gitalk when router changed ([11ea1f8](https://github.com/docsifyjs/docsify/commit/11ea1f8))
+### 2.4.1
-### Features
+> 2017-02-13
-* allows relative path, fixed [#590](https://github.com/docsifyjs/docsify/issues/590) ([31654f1](https://github.com/docsifyjs/docsify/commit/31654f1))
+#### Bug fixes
+- fix(index): cover page
+### 2.4.0
+> 2017-02-13
-
-## [4.9.1](https://github.com/docsifyjs/docsify/compare/v4.9.0...v4.9.1) (2019-02-21)
+#### Features
+- feat(hook): add `doneEach`
-### Bug Fixes
-* github assets url ([#774](https://github.com/docsifyjs/docsify/issues/774)) ([140bf10](https://github.com/docsifyjs/docsify/commit/140bf10))
+### 2.3.0
+> 2017-02-13
+#### Features
-
-# [4.9.0](https://github.com/docsifyjs/docsify/compare/v4.8.6...v4.9.0) (2019-02-19)
+- feat(src): add alias feature
+- docs: update all documents
+- feat(src): dynamic title
+- feat(hook): support custom plugin
+- feat(themes): add dark theme
+#### Bug fixes
+- fix(event): `auto2top` has no effect on a FF mobile browser, fixed #67
+- fix: sidebar style
+- fix(render): fix render link
-### Bug Fixes
+### 2.2.1
-* 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))
+> 2017-02-11
+#### Bug fixes
+- fix(search): crash when not content, fixed #68
+- fix(event): scroll active sidebar
+- fix(search): not work in mobile
-### Features
+### 2.2.0
-* **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))
+#### Features
+- Add `Google Analytics` plugin.
+```html
+
+
+```
+### 2.1.0
+#### Features
+- Add search plugin
+```html
+
+
+```
+#### Bug fixes
+- fix sidebar style
-
-## [4.8.6](https://github.com/docsifyjs/docsify/compare/v4.8.5...v4.8.6) (2018-11-12)
+### 2.0.3
+#### Bug fixes
+- fix: rendering emojis
+- fix: css var polyfill
+### 2.0.2
-### Bug Fixes
+#### Bug fixes
+- fix button style in cover page.
-* IE10 compatibility ([#691](https://github.com/docsifyjs/docsify/issues/691)) ([4db8cd6](https://github.com/docsifyjs/docsify/commit/4db8cd6))
+### 2.0.1
+#### Bug fixes
+- border style.
+### 2.0.0
+#### Features
+- Customize the theme color
-
-
-## [4.8.5](https://github.com/docsifyjs/docsify/compare/v4.8.4...v4.8.5) (2018-11-02)
-
-
-### Bug Fixes
-
-* expose version info for Docsify, fixed [#641](https://github.com/docsifyjs/docsify/issues/641) ([aa719e3](https://github.com/docsifyjs/docsify/commit/aa719e3))
-
-
-
-
-## [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
-
-- add heading config id ([#671](https://github.com/docsifyjs/docsify/issues/671)) ([ab19b13](https://github.com/docsifyjs/docsify/commit/ab19b13))
-
-
-
-## [4.8.1](https://github.com/docsifyjs/docsify/compare/v4.8.0...v4.8.1) (2018-10-31)
-
-### Bug Fixes
-
-- 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))
-
-### Features
-
-- upgrade PrismJS, fixed [#534](https://github.com/docsifyjs/docsify/issues/534) ([4805cb5](https://github.com/docsifyjs/docsify/commit/4805cb5))
-
-
-
-# [4.8.0](https://github.com/docsifyjs/docsify/compare/v4.7.1...v4.8.0) (2018-10-31)
-
-### Bug Fixes
-
-- Cache TOC for later usage in the case of cached file html ([#649](https://github.com/docsifyjs/docsify/issues/649)) ([9e86017](https://github.com/docsifyjs/docsify/commit/9e86017))
-- 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))
-
-### Features
-
-- Add docsify version to $window.docsify object ([#641](https://github.com/docsifyjs/docsify/issues/641)) ([94bc415](https://github.com/docsifyjs/docsify/commit/94bc415)), closes [#521](https://github.com/docsifyjs/docsify/issues/521)
-- **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))
-
-
-
-## [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))
-
-### Features
-
-- add logo option, [#264](https://github.com/QingWei-Li/docsify/issues/264) ([#541](https://github.com/QingWei-Li/docsify/issues/541)) ([ee72dd0](https://github.com/QingWei-Li/docsify/commit/ee72dd0))
-- add 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))
-
-### Features
-
-- **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))
-
-### Features
-
-- **fetch:** Add fallback languages configuration. ([#402](https://github.com/QingWei-Li/docsify/issues/402)) ([ecc0e04](https://github.com/QingWei-Li/docsify/commit/ecc0e04))
-
-
-
-## [4.6.3](https://github.com/QingWei-Li/docsify/compare/v4.6.2...v4.6.3) (2018-02-15)
-
-### 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))
-
-
-
-## [4.6.2](https://github.com/QingWei-Li/docsify/compare/v4.6.1...v4.6.2) (2018-02-14)
-
-### Bug Fixes
-
-- **embed:** broken in IE, fixed [#389](https://github.com/QingWei-Li/docsify/issues/389), fixed [#391](https://github.com/QingWei-Li/docsify/issues/391) ([45a7464](https://github.com/QingWei-Li/docsify/commit/45a7464))
-- **embed:** init value ([890a7bf](https://github.com/QingWei-Li/docsify/commit/890a7bf))
-
-
-
-## [4.6.1](https://github.com/QingWei-Li/docsify/compare/v4.6.0...v4.6.1) (2018-02-12)
-
-### Bug Fixes
-
-- **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)
-
-
-
-# [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))
-
-### Features
-
-- click sidebar menu add collapse and expand, close [#294](https://github.com/QingWei-Li/docsify/issues/294) ([5e161a1](https://github.com/QingWei-Li/docsify/commit/5e161a1))
-- **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)
-
-### Features
-
-- add navigation plugin, closed [#180](https://github.com/QingWei-Li/docsify/issues/180) ([f78be4c](https://github.com/QingWei-Li/docsify/commit/f78be4c))
-
-
-
-## [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))
-
-### Features
-
-- add gitalk plugin ([#306](https://github.com/QingWei-Li/docsify/issues/306)) ([9208e64](https://github.com/QingWei-Li/docsify/commit/9208e64))
-
-
-
-## [4.5.3](https://github.com/QingWei-Li/docsify/compare/v4.5.2...v4.5.3) (2017-11-11)
-
-### Features
-
-- add gitalk plugin ([#306](https://github.com/QingWei-Li/docsify/issues/306)) ([9208e64](https://github.com/QingWei-Li/docsify/commit/9208e64))
-
-
-
-## [4.5.2](https://github.com/QingWei-Li/docsify/compare/v4.5.1...v4.5.2) (2017-11-09)
-
-### Features
-
-- github task lists, close [#215](https://github.com/QingWei-Li/docsify/issues/215) ([#305](https://github.com/QingWei-Li/docsify/issues/305)) ([d486eef](https://github.com/QingWei-Li/docsify/commit/d486eef))
-
-
-
-## [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))
+#### Break change
+- Remove `data-router`, `data-sidebar`, `data-sidebar-toggle` APIs
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
deleted file mode 100644
index 77d2ce7..0000000
--- a/CONTRIBUTING.md
+++ /dev/null
@@ -1,67 +0,0 @@
-# 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
index fb720fd..d3cc3e3 100644
--- a/HISTORY.md
+++ b/HISTORY.md
@@ -1,736 +1,287 @@
+### 1.10.5
+#### Bug fixes
+- fix initialize the Vue instance
-
-## [3.7.3](https://github.com/QingWei-Li/docsify/compare/v3.7.2...v3.7.3) (2017-05-22)
+### 1.10.4
+#### Bug fixes
+- fix execute script
+### 1.10.3
+#### Bug fixes
+- compatible vuep QingWei-Li/vuep/issues/2
+- fix sidebar scroll, fixed #63
-### Bug Fixes
+### 1.10.2
+#### Bug fixes
+- Fix render emojis again
-* **render:** find => filter ([eca3368](https://github.com/QingWei-Li/docsify/commit/eca3368))
+### 1.10.1
+#### Bug fixes
+- Fix render emojis
+### 1.10.0
+#### Features
+- Support emoji :laughing:
+### 1.9.0
-
-## [3.7.2](https://github.com/QingWei-Li/docsify/compare/v3.7.1...v3.7.2) (2017-05-19)
+#### Bug fixes
+- Destroys the vue instance when the route is changed
+#### Features
+- Add `!>` and `?>` doc helper.
+#### Break change
+- Remove `!` doc helper.
-
-## [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)
-
+### 1.8.0
+#### Bug fixes
+- Using `v-pre` skip compilation.
### Features
+- Execute script when vue exists.
-* 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))
+### 1.7.4
+#### Bug fixes
+- Fix bugs caused by the previous version
+### 1.7.3
+#### Bug fixes
+- Add `hr` style
+- Fixed option is an empty string
+### 1.7.2
+#### Bug fixes
+- Fix sidebar click event in mobile browser.
-
-## [3.6.6](https://github.com/QingWei-Li/docsify/compare/v3.6.5...v3.6.6) (2017-05-06)
+### 1.7.1
+#### Bug fixes
+- Fix sidebar style in mobile browser.
+### 1.7.0
+
+#### Bug fixes
+- Fixed custom cover background, fixed #52
+- Fixed sticky sidebar
### Features
+- Add `name` and `nameLink`
-* 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))
+### 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
-
-## [3.6.5](https://github.com/QingWei-Li/docsify/compare/v3.6.4...v3.6.5) (2017-04-28)
+### 1.5.1
+#### Bug fixes
+- Remove HTML tag when handling slug
+### 1.5.0
-### Bug Fixes
+#### Bug fixes
+- Fix slugify.
+- Fix nav highlight.
-* **util:** fix crash, fixed [#154](https://github.com/QingWei-Li/docsify/issues/154) ([51832d3](https://github.com/QingWei-Li/docsify/commit/51832d3))
+#### Features
+- Initialize the configuration by `window.$docsify`.
+- Markdown parser is configurable.
+### 1.4.3
+#### Bug fixes
+- Tweak style.
+### 1.4.2
-
-## [3.6.4](https://github.com/QingWei-Li/docsify/compare/v3.6.3...v3.6.4) (2017-04-28)
+#### Bug fixes
+- Fix toggle button style.
+- Support `mailto`, `tel`, etc. href type
+- Fix scroll to top.
-### Bug Fixes
+### 1.4.1
+#### Bug fixes
+- Fix generate slug.
-* **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))
+### 1.4.0 Happly new year 🎉
+#### Features
+- Display TOC in the custom sidebar, `data-sub-max-level`.
+- Custom background in coverpage.
+#### Bug fixes
+- Fix scroll highlight when Vue exist.
+### 1.3.5
+#### Bug fixes
+- Fix vue
-
-## [3.6.3](https://github.com/QingWei-Li/docsify/compare/v3.6.2...v3.6.3) (2017-04-25)
+### 1.3.4
+#### Bug fixes
+- Supports [vuep](https://github.com/QingWei-Li/vuep)
-### Bug Fixes
+### 1.3.3
+#### Bug fixes
+- Fixed cover rendering timing
-* **external-script:** script attrs ([2653849](https://github.com/QingWei-Li/docsify/commit/2653849))
+### 1.3.2
+#### Bug fixes
+- Fixed render link
+### 1.3.1
-
-## [3.6.2](https://github.com/QingWei-Li/docsify/compare/v3.6.0...v3.6.2) (2017-04-12)
+#### 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
-### Features
+#### Bug fixes
+- sidebar highlight
-* **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))
+#### break change
+- Navbar no longer fixed at the top
+### 1.2.0
+#### Features
+- custom basePath
+- custom homepage
-
-# [3.6.0](https://github.com/QingWei-Li/docsify/compare/v3.5.2...v3.6.0) (2017-04-09)
+### 1.1.7
+#### Bug fixes
+- Optimize progress bar
+### 1.1.6
+#### Features
+- Add logo 😂
-### Features
+#### Bug fixes
+- Remove table background color
+- Fixed highlight sidebar using chinese ids
-* **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))
+### 1.1.5
+#### Features
+- Add table style
+#### Bug fixes
+- Not fixed position of hte navbar in the mobile browser
+- Correct calculation of whether the mobile browser
+### 1.1.4
+#### Bug fixes
+- Fixed chinese auchor link
-
-## [3.5.2](https://github.com/QingWei-Li/docsify/compare/v3.5.1...v3.5.2) (2017-04-05)
+### 1.1.3
+#### Bug fixes
+- Optimize progress bar again
+### 1.1.2
+#### Bug fixes
+- fix failed `auto2top` in mobile
-
-## [3.5.1](https://github.com/QingWei-Li/docsify/compare/v3.5.0...v3.5.1) (2017-03-25)
+### 1.1.1
+#### Bug fixes
+- Optimize progress bar
+### 1.1.0
+#### Features
+- Add progress bar
+- Add `auto2top` option for hash router
-### Bug Fixes
+### 1.0.3
+#### Bug fixes
+- Fix cache
-* .md file extension regex ([594299f](https://github.com/QingWei-Li/docsify/commit/594299f))
+### 1.0.2
+#### Bug fixes
+- Fix binding events bug, fixed #24
+- Fix regular expression, fixed #23
+### 1.0.1
+#### Bug fixes
+- `img` style
+### 1.0.0
+#### Features
+- Support hash router
-
-# [3.5.0](https://github.com/QingWei-Li/docsify/compare/v3.4.4...v3.5.0) (2017-03-25)
+#### Bug fixes
+- Improved scrolling on mobile
+### 0.7.0
+#### Breaking change
+- `themes/` was removed, only exists in the npm package.
-### Bug Fixes
+#### Bug fixes
+- Fix style.
+- Fix sidebar animation again.
-* 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))
+### 0.6.1
+#### Bug fixes
+- In the mobile, it should collapse the sidebar when toggle is clicked.
+- Fix the dropdown list style.
+- Fix sidebar animation.
+### 0.6.0
+#### Features
+- Navbar support dropdown list, #6
+- Sidebar with toggle
-### Features
+#### Bug fixes
+- Fix ineffective option, fixed #10
-* **route:** auto remove .md extension ([8f11653](https://github.com/QingWei-Li/docsify/commit/8f11653))
+### 0.5.0
+#### Features
+- Custom sidebars and navbars by markdown file
+### 0.4.2
+#### Bug fixes
+- Correct catch ajax error
+### 0.4.1
+#### Bug fixes
+- catch ajax error
+
+### 0.4.0
+#### Features
+- Custom sidebar
-
-## [3.4.4](https://github.com/QingWei-Li/docsify/compare/v3.4.3...v3.4.4) (2017-03-17)
+#### Bug fixes
+- Fix undefined language
+### 0.3.1
+#### Bug fixes
+- Strip HTML tag when rendering the headings
-### 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)
+### 0.3.0
+#### Features
+- Add minified css files
+- Add max level option
+- Add pure.css
+
+### 0.2.1
+#### Bug fixes
+- Fix vue.css
+
+### 0.2.0
+#### Bug fixes
+- Fix route
+- Remove dynamic title
+
+### 0.1.0
+#### Features
+- Add buble.css
\ No newline at end of file
diff --git a/LICENSE b/LICENSE
index 37a4ac5..58492da 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,6 +1,6 @@
MIT License
-Copyright (c) 2016 - present cinwell.li
+Copyright (c) 2016 - 2017 cinwell.li
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
diff --git a/README.md b/README.md
index b8da0d8..dd7de59 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
-
+
@@ -9,60 +9,59 @@
-
-
-
+
-
-
-
-Gold Sponsor via Open Collective
-
-
-
-
-
## Links
-
-- [`develop` branch preview](https://docsifyjs.netlify.com/)
- [Documentation](https://docsify.js.org)
-- [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)
+- [CLI](https://github.com/QingWei-Li/docsify-cli)
## Features
-
-- No statically built html files
-- Simple and lightweight (~21kB gzipped)
+- Not build static html files
+- Simple and lightweight (~14kB gzipped)
- Smart full-text search plugin
- Multiple themes
- Useful plugin API
-- Compatible with IE11
-- Support SSR ([example](https://github.com/docsifyjs/docsify-ssr-demo))
-- Support embedded files
+- Compatible with IE9+
## Quick start
+Create a `index.html`.
-Look at [this tutorial](https://docsify.js.org/#/quickstart)
+index.html
-[](https://codesandbox.io/s/307qqv236)
+```html
+
+
+
+
+
+
+
+
+
+
+
+```
+
+## Browser Support
+
+Modern browsers and Internet Explorer 9+.
## Showcase
+These open-source projects are using docsify to generate their sites. Pull requests welcome : )
-These projects are using docsify to generate their sites. Pull requests welcome :blush:
-
-Move to [awesome-docsify](https://github.com/docsifyjs/awesome-docsify#showcase)
+- [Snipaste](https://docs.snipaste.com/) - A new way to boost your productivity.
+- [puck](https://puck.zz173.com/) - A small & magical php framework.
+- [Samaritan](http://samaritan.stockdb.org) - An Algorithmic Trading Framework for Digital Currency.
+- [Vudash](http://vudash.github.io/vudash/) - Powerful, Flexible, Open Source dashboards for anything
+- [Trilogy](http://trilogy.js.org) - No-hassle SQLite with a Promise-based, document store style API.
+- [Mybatis-Plus](http://mp.baomidou.com/) - An enhanced toolkit of Mybatis to simplify development
## Similar projects
-
-| Project | Description |
-| ------------------------------------------------ | ---------------------------------------- |
-| [docute](https://github.com/egoist/docute) | 📜 Effortlessly documentation done right |
-| [docpress](https://github.com/docpress/docpress) | Documentation website generator |
+- [docute](https://github.com/egoist/docute) - 📜 Effortlessly documentation done right
+- [docpress](https://github.com/docpress/docpress) - Documentation website generator
## Contributing
@@ -70,42 +69,15 @@ Move to [awesome-docsify](https://github.com/docsifyjs/awesome-docsify#showcase)
- 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
+- Submit a pull request :D
+
## Development
```bash
-npm run bootstrap && npm run dev
+npm i && npm run dev
+open http://localhost:3000
```
-## Backers
-
-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](LICENSE)
-
-[](https://app.fossa.io/projects/git%2Bhttps%3A%2F%2Fgithub.com%2Fdocsifyjs%2Fdocsify?ref=badge_large)
+MIT
diff --git a/app.js b/app.js
new file mode 100644
index 0000000..beada16
--- /dev/null
+++ b/app.js
@@ -0,0 +1,12 @@
+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
new file mode 100644
index 0000000..40672e0
--- /dev/null
+++ b/build/build-css.js
@@ -0,0 +1,47 @@
+var fs = require('fs')
+var cssnano = require('cssnano').process
+var resolve = require('path').resolve
+var postcss = require('postcss')
+var isProd = process.argv[process.argv.length - 1] !== '--dev'
+
+var processor = postcss([require('postcss-salad')({
+ features: {
+ precss: {
+ properties: {
+ preserve: true
+ }
+ }
+ }
+})])
+
+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)
+ isProd && 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 7b61224..cbeefc9 100644
--- a/build/build.js
+++ b/build/build.js
@@ -1,119 +1,60 @@
-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 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')
+var isProd = process.argv[process.argv.length - 1] !== '--dev'
-const build = function (opts) {
+var build = function (opts) {
rollup
.rollup({
- input: opts.input,
- plugins: (opts.plugins || []).concat([
- buble(),
- commonjs(),
- nodeResolve(),
- replace({
- __VERSION__: version,
- 'process.env.SSR': false
- })
- ])
+ entry: 'src/' + opts.entry,
+ plugins: [buble()].concat(opts.plugins || [])
})
.then(function (bundle) {
- var dest = 'lib/' + (opts.output || opts.input)
+ var dest = 'lib/' + (opts.output || opts.entry)
console.log(dest)
bundle.write({
format: 'iife',
- file: dest,
- strict: false
+ moduleName: opts.moduleName || 'D',
+ dest: dest
})
})
.catch(function (err) {
console.error(err)
})
}
-const buildCore = function () {
- build({
- input: 'src/core/index.js',
- output: 'docsify.js'
- })
- 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()
-}
+build({
+ entry: 'index.js',
+ output: 'docsify.js',
+ plugins: [commonjs(), nodeResolve()]
+})
+isProd && build({
+ entry: 'index.js',
+ output: 'docsify.min.js',
+ plugins: [commonjs(), nodeResolve(), uglify()]
+})
+build({
+ entry: 'plugins/search.js',
+ output: 'plugins/search.js',
+ moduleName: 'D.Search'
+})
+isProd && build({
+ entry: 'plugins/search.js',
+ output: 'plugins/search.min.js',
+ moduleName: 'D.Search',
+ plugins: [uglify()]
+})
+build({
+ entry: 'plugins/ga.js',
+ output: 'plugins/ga.js',
+ moduleName: 'D.GA'
+})
+isProd && build({
+ entry: 'plugins/ga.js',
+ output: 'plugins/ga.min.js',
+ moduleName: 'D.GA',
+ plugins: [uglify()]
+})
diff --git a/build/cover.js b/build/cover.js
deleted file mode 100644
index fbd27f7..0000000
--- a/build/cover.js
+++ /dev/null
@@ -1,14 +0,0 @@
-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
deleted file mode 100644
index f6c5ec2..0000000
--- a/build/mincss.js
+++ /dev/null
@@ -1,12 +0,0 @@
-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
deleted file mode 100755
index a328322..0000000
--- a/build/release.sh
+++ /dev/null
@@ -1,50 +0,0 @@
-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
deleted file mode 100644
index 16b93ca..0000000
--- a/build/ssr.js
+++ /dev/null
@@ -1,34 +0,0 @@
-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
new file mode 100644
index 0000000..54becd0
--- /dev/null
+++ b/dev.html
@@ -0,0 +1,34 @@
+
+
+
+
+ docsify
+
+
+
+
+
+ EN
+ 中文
+
+
+
+
+
+
diff --git a/docs/README.md b/docs/README.md
index e625420..529c54b 100644
--- a/docs/README.md
+++ b/docs/README.md
@@ -2,31 +2,26 @@
> A magical documentation site generator.
-## What it is
+## What is it
-docsify generates your documentation website on the fly. Unlike GitBook, it does not generate static html files. Instead, it smartly loads and parses your Markdown files and displays them as a website. To start using it, all you need to do is create an `index.html` and [deploy it on GitHub Pages](deploy.md).
+docsify generates your documentation website on the fly. Unlike GitBook, it does not generate static html files. It smartly loads and parses your Markdown files and displays them in website. All you need to do is create an `index.html` to start and [deploy it on GitHub Pages](/deploy).
-See the [Quick start](quickstart.md) guide for more details.
+See the [Quick start](/quickstart) for more details.
## Features
-- No statically built html files
-- Simple and lightweight (~21kB gzipped)
+- Not build static html files
+- Simple and lightweight (~14kB gzipped)
- Smart full-text search plugin
- Multiple themes
- Useful plugin API
-- Emoji support
-- Compatible with IE11
-- Support server-side rendering ([example](https://github.com/docsifyjs/docsify-ssr-demo))
+- Compatible with IE9+
## Examples
-Check out the [Showcase](https://github.com/docsifyjs/awesome-docsify#showcase) to see docsify in use.
+Check out the [Showcase](https://github.com/QingWei-Li/docsify/#showcase) to see use the docsify generated website.
## Donate
-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:
+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 1decbd6..d0f7bbf 100644
--- a/docs/_coverpage.md
+++ b/docs/_coverpage.md
@@ -1,12 +1,13 @@

-# docsify 4.9.4
+# docsify 2.4.3
> A magical documentation site generator.
-- Simple and lightweight (~21kB gzipped)
-- No statically built html files
+- Simple and lightweight (~14kB gzipped)
+- Not build static html files
- Multiple themes
-[GitHub](https://github.com/docsifyjs/docsify/)
-[Getting Started](#docsify)
+
+[GitHub](https://github.com/QingWei-Li/docsify/)
+[Get Started](#quick-start)
diff --git a/docs/_media/example.html b/docs/_media/example.html
deleted file mode 100644
index d35ee16..0000000
--- a/docs/_media/example.html
+++ /dev/null
@@ -1 +0,0 @@
-To infinity and Beyond!
\ No newline at end of file
diff --git a/docs/_media/example.js b/docs/_media/example.js
deleted file mode 100644
index 7b6f668..0000000
--- a/docs/_media/example.js
+++ /dev/null
@@ -1,16 +0,0 @@
-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
deleted file mode 100644
index 6ee6494..0000000
--- a/docs/_media/example.md
+++ /dev/null
@@ -1 +0,0 @@
-> This is from the `example.md`
diff --git a/docs/_navbar.md b/docs/_navbar.md
deleted file mode 100644
index 47a2356..0000000
--- a/docs/_navbar.md
+++ /dev/null
@@ -1,6 +0,0 @@
-- 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
index 051514b..76261f0 100644
--- a/docs/_sidebar.md
+++ b/docs/_sidebar.md
@@ -1,28 +1,20 @@
- Getting started
+ - [Quick start](/quickstart)
+ - [Writing more pages](/more-pages)
+ - [Custom navbar](/custom-navbar)
+ - [Cover page](/cover)
- - [Quick start](quickstart.md)
- - [Writing more pages](more-pages.md)
- - [Custom navbar](custom-navbar.md)
- - [Cover page](cover.md)
-
-- Customization
-
- - [Configuration](configuration.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)
+- Configuration
+ - [Configuration](/configuration)
+ - [Themes](/themes)
+ - [Using plugins](/plugins)
+ - [Markdown configuration](/markdown)
+ - [Lanuage highlight](/language-highlight)
- Guide
+ - [Deploy](/deploy)
+ - [Doc helper](/helpers)
+ - [Compatible Vue](/vue)
+ - [CDN](/cdn)
- - [Deploy](deploy.md)
- - [Helpers](helpers.md)
- - [Vue compatibility](vue.md)
- - [CDN](cdn.md)
- - [Offline Mode(PWA)](pwa.md)
- - [Server-Side Rendering(SSR)](ssr.md)
- - [Embed Files](embed-files.md)
-
-- [Awesome docsify](awesome.md)
-- [Changelog](changelog.md)
+- [Changelog](/changelog)
\ No newline at end of file
diff --git a/docs/cdn.md b/docs/cdn.md
index eba77a8..1e0b2ec 100644
--- a/docs/cdn.md
+++ b/docs/cdn.md
@@ -2,8 +2,10 @@
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
@@ -12,10 +14,9 @@ Recommended: [unpkg](//unpkg.com), which will reflect the latest version as soon
```
-Alternatively, use [compressed files](#compressed-file).
-
## Specific version
+
```html
@@ -26,6 +27,7 @@ Alternatively, use [compressed files](#compressed-file).
## Compressed file
+
```html
@@ -34,17 +36,7 @@ Alternatively, use [compressed files](#compressed-file).
```
-```html
-
-
-
-
-
-```
-
## Other CDN
-- http://www.bootcdn.cn/docsify
-- https://cdn.jsdelivr.net/npm/docsify/
-- https://cdnjs.com/libraries/docsify
+[jsDelivr](http://www.jsdelivr.com/projects/docsify) is available.
diff --git a/docs/configuration.md b/docs/configuration.md
index ba48475..5af2515 100644
--- a/docs/configuration.md
+++ b/docs/configuration.md
@@ -1,17 +1,30 @@
# Configuration
-You can configure the `window.$docsify`.
+docsify supports two ways to configure. You can configure the `window.$docsify` or write configuration on the script tag via `data-*` attributes.
```html
+
+
+
+
```
+Both ways are compatible. However, the first way is recommended. It is clear and can be configured in a separate file.
+
+!> In `window.$docsfiy`, the options should be written by camelCase.
+
## el
- Type: `String`
@@ -22,7 +35,7 @@ The DOM element to be mounted on initialization. It can be a CSS selector string
```js
window.$docsify = {
el: '#app'
-};
+}
```
## repo
@@ -34,13 +47,14 @@ Configure the repository url or a string of `username/repo` can add the [GitHub
```js
window.$docsify = {
- repo: 'docsifyjs/docsify',
+ repo: 'QingWei-Li/docsify',
// or
- repo: 'https://github.com/docsifyjs/docsify/'
-};
+ repo: 'https://github.com/QingWei-Li/docsify/'
+}
```
-## maxLevel
+
+## max-level
- Type: `Number`
- Default: `6`
@@ -50,15 +64,15 @@ Maximum Table of content level.
```js
window.$docsify = {
maxLevel: 4
-};
+}
```
-## loadNavbar
+## load-navbar
- Type: `Boolean|String`
- Default: `false`
-Loads navbar from the Markdown file `_navbar.md` if **true**, or else from the path specified.
+Load navbar from Markdown file. If **true** it will be loaded from `_navbar.md`.
```js
window.$docsify = {
@@ -67,15 +81,16 @@ window.$docsify = {
// load from nav.md
loadNavbar: 'nav.md'
-};
+}
```
-## loadSidebar
+## load-sidebar
- Type: `Boolean|String`
- Default: `false`
-Loads sidebar from the Markdown file `_sidebar.md` if **true**, or else from the path specified.
+
+Load sidebar from Markdown file. If **true** it will be loaded from `_sidebar.md`.
```js
window.$docsify = {
@@ -84,40 +99,44 @@ window.$docsify = {
// load from summary.md
loadSidebar: 'summary.md'
-};
+}
```
-## subMaxLevel
+## sub-max-level
- Type: `Number`
- Default: `0`
-Add table of contents (TOC) in custom sidebar.
+Add TOC in custom sidebar.
```js
window.$docsify = {
- subMaxLevel: 2
-};
+ subMaxLevel: 3
+}
```
+
## 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
@@ -126,12 +145,11 @@ window.$docsify = {
homepage: 'home.md',
// Or use the readme in your repo
- homepage:
- 'https://raw.githubusercontent.com/docsifyjs/docsify/master/README.md'
-};
+ homepage: 'https://raw.githubusercontent.com/QingWei-Li/docsify/master/README.md'
+}
```
-## basePath
+## base-path
- Type: `String`
@@ -145,101 +163,41 @@ window.$docsify = {
basePath: 'https://docsify.js.org/',
// Even can load files from other repo
- basePath:
- 'https://raw.githubusercontent.com/ryanmcdermott/clean-code-javascript/master/'
-};
+ 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`
+- Type: `Boolean|String`
- Default: `false`
-Activate the [cover feature](cover.md). If true, it will load from `_coverpage.md`.
+Activate the [cover feature](/cover). If ture, 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'
-};
+ coverpage: 'cover.md'
+}
```
## name
- Type: `String`
-Website name as it appears in the sidebar.
+
+Website name appears in the sidebar.
```js
window.$docsify = {
name: 'docsify'
-};
+}
```
-## nameLink
+## name-link
- Type: `String`
- Default: `window.location.pathname`
@@ -248,271 +206,51 @@ The name of the link.
```js
window.$docsify = {
- nameLink: '/',
-
- // For each route
- nameLink: {
- '/zh-cn/': '/zh-cn/',
- '/': '/'
- }
-};
+ nameLink: '/'
+}
```
## markdown
- Type: `Function`
-See [Markdown configuration](markdown.md).
+See [Markdown configuration](/markdown).
+
```js
window.$docsify = {
- // object
- markdown: {
- smartypants: true,
- renderer: {
- link: function() {
- // ...
- }
- }
- },
-
- // function
- markdown: function(marked, renderer) {
+ markdown: function (marked, renderer) {
// ...
- return marked;
+ return marked
}
-};
+}
```
-## themeColor
+## theme-color
- Type: `String`
-Customize the theme color. Use [CSS3 variables](https://developer.mozilla.org/en-US/docs/Web/CSS/Using_CSS_variables) feature and polyfill in old browser.
+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.
+
+Set the route alias. You can freely manage routing rules.
```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
+ '/changelog': 'https://raw.githubusercontent.com/QingWei-Li/docsify/master/CHANGELOG'
}
-};
+}
```
-
-## 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
index 555f4ff..7054a06 100644
--- a/docs/cover.md
+++ b/docs/cover.md
@@ -1,99 +1,57 @@
# Cover
-Activate the cover feature by setting `coverpage` to **true**, compare [coverpage configuration](configuration.md#coverpage).
+Activate the cover feature by setting `coverpage`. The detail in [Configuration#coverpage](zh-cn/configuration#coverpage).
## Basic usage
-Set `coverpage` to **true**, and create a `_coverpage.md`:
+Set `coverpage` to **true**, and create a `_coverpage.md`. You can see the effect in current website.
+
+
+*index.html*
```html
-
-
-
+
```
-```markdown
-
+*_coverpage.md*
+```markdown

-# docsify 3.5
+# docsify
> A magical documentation site generator.
-- Simple and lightweight (~21kB gzipped)
-- No statically built html files
+- Simple and lightweight (~12kb gzipped)
- Multiple themes
+- Not build static html files
-[GitHub](https://github.com/docsifyjs/docsify/)
-[Get Started](#docsify)
+
+[GitHub](https://github.com/QingWei-Li/docsify/)
+[Get Started](#quick-start)
```
-!> A document site can have only one coverpage!
+!> A document site can have only one cover page.
## Custom background
-The background color is generated randomly by default. You can customize the background color or a background image:
+The background color is generated randomly by default. You can customize the background color or image.
+
+*_coverpage.md*
```markdown
-
+# docsify
-# docsify 3.5
-
-[GitHub](https://github.com/docsifyjs/docsify/)
+[GitHub](https://github.com/QingWei-Li/docsify/)
[Get Started](#quick-start)
-

-
-

```
-
-## 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
index 324ad81..cc78741 100644
--- a/docs/custom-navbar.md
+++ b/docs/custom-navbar.md
@@ -1,14 +1,10 @@
# Custom navbar
-## HTML
+You can create navbar in HTML file. But note that the link begins with `#/`.
-If you need custom navigation, you can create a HTML-based navigation bar.
-
-!> Note that documentation links begin with `#/`.
+*index.html*
```html
-
-
EN
@@ -18,79 +14,53 @@ If you need custom navigation, you can create a HTML-based navigation bar.
```
-## Markdown
+## Writing by Markdown
+
+You can custom navbar by Markdown file. Set the `loadNavbar` to **true** and create a `_navbar.md`. The detail in [Configuration#load-navbar](configuration#load-navbar).
+
+*index.html*
-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
-
-
-
+
```
+*_navbar.md*
+
+
```markdown
-
-
-* [En](/)
-* [chinese](/zh-cn/)
+- [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`.
+`_navbar.md` is loaded from each level directory. If this directory doesn't have `_navbar.md`, it will fallback to parent directory. For example, the current path is `/guide/quick-start`, the `_navbar.md` will be loaded from `/guide/_navbar.md`.
## Nesting
You can create sub-lists by indenting items that are under a certain parent.
```markdown
-
+- Getting started
+ - [Quick start](/quickstart)
+ - [Writing more pages](/more-pages)
+ - [Custom navbar](/custom-navbar)
+ - [Cover page](/cover)
-* 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)
+- Configuration
+ - [Configuration](/configuration)
+ - [Themes](/themes)
+ - [Using plugins](/plugins)
+ - [Markdown configuration](/markdown)
+ - [Lanuage highlight](/language-highlight)
```
-renders as
+Example.
-
+
-## 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
index a879f2e..ed25b02 100644
--- a/docs/deploy.md
+++ b/docs/deploy.md
@@ -1,62 +1,20 @@
# Deploy
-Similar to [GitBook](https://www.gitbook.com), you can deploy files to GitHub Pages, GitLab Pages or VPS.
+As as GitBook, you can deploy files to GitHub Pages or VPS.
## GitHub Pages
-There're three places to populate your docs for your Github repository:
+There're three places to populate your docs
- `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.
+You can save your files in `./docs` and setting `master branch /docs folder`.

!> 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
@@ -68,64 +26,8 @@ server {
server_name your.domain.com;
location / {
- alias /path/to/dir/of/docs/;
+ 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
deleted file mode 100644
index dab2efe..0000000
--- a/docs/embed-files.md
+++ /dev/null
@@ -1,81 +0,0 @@
-# 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
index b047d36..85a7035 100644
--- a/docs/helpers.md
+++ b/docs/helpers.md
@@ -4,142 +4,23 @@ docsify extends Markdown syntax to make your documents more readable.
## important content
-Important content like:
+Suitable for displaying important information.
```markdown
!> **Time** is money, my friend!
```
-is rendered as:
-
!> **Time** is money, my friend!
+
## General tips
-General tips like:
+General tips.
+
```markdown
-?> _TODO_ unit test
+?> *TODO* unit test
```
-are rendered as:
+?> *TODO* unit test
-?> _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
-
-
-
-
-
-
-```
-
-
-
-
-
-## 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 6d0e008..7748c82 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -1,104 +1,38 @@
-
docsify
-
-
-
-
-
-
-
-
+
-
- Loading ...
-
-
-
-
-
-
-
-
-
-
-
+
+ En
+ 中文
+
+
-
+
+
+
+
+
+
diff --git a/docs/language-highlight.md b/docs/language-highlight.md
index 793a39e..22a5700 100644
--- a/docs/language-highlight.md
+++ b/docs/language-highlight.md
@@ -1,11 +1,13 @@
# 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:
+
+The code language highlight tool is [Prism](https://github.com/PrismJS/prism). Only supports CSS, JavaScipt and HTML by default. You can load its component to highlight the language you need.
+
```html
-
-
-
+
+
+
```
-?> Check the [component files](https://github.com/PrismJS/prism/tree/gh-pages/components) list for more options.
+?> See fully supported highlight component [files list](https://github.com/PrismJS/prism/tree/gh-pages/components).
diff --git a/docs/markdown.md b/docs/markdown.md
index c506e17..d384365 100644
--- a/docs/markdown.md
+++ b/docs/markdown.md
@@ -1,21 +1,17 @@
# 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`:
+The Markdown parser is [marked](https://github.com/chjj/marked). You can customize how docsify renders your Markdown content to HTML.
```js
window.$docsify = {
markdown: {
- smartypants: true,
- renderer: {
- link: function() {
- // ...
- }
- }
+ smartypants: true
+ // ...
}
}
```
-?> Configuration Options Reference [marked documentation](https://marked.js.org/#/USING_ADVANCED.md)
+?> Configuration Options Reference [marked documentation](https://github.com/chjj/marked#options-1)
Even you can completely customize the parsing rules.
@@ -28,29 +24,3 @@ window.$docsify = {
}
}
```
-
-## 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
index 46e7df8..9ac0be5 100644
--- a/docs/more-pages.md
+++ b/docs/more-pages.md
@@ -1,21 +1,22 @@
# 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`.
+If you need more pages multi-level routing site. It is easy to achieve in docsify. A simple example: If you create a `guide.md`, then get the route is `/#/guide`.
For example, the directory structure is as follows:
+
```text
-.
-└── docs
- ├── README.md
- ├── guide.md
- └── zh-cn
- ├── README.md
- └── guide.md
+-| docs/
+ -| README.md
+ -| guide.md
+ -| zh-cn/
+ -| README.md
+ -| guide.md
```
Matching routes
+
```text
docs/README.md => http://domain.com
docs/guide.md => http://domain.com/guide
@@ -23,103 +24,43 @@ docs/zh-cn/README.md => http://domain.com/zh-cn/
docs/zh-cn/guide.md => http://domain.com/zh-cn/guide
```
-## Sidebar
+## Custom 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):
+By default, the TOC in sidebar is automatically generated based on Markdown file. You can create a Table of Contents page to list down pages in your site.
-First, you need to set `loadSidebar` to **true**. Details are available in the [configuration paragraph](configuration.md#loadsidebar).
+First, you need to set `loadSidebar` to **true**. The detail in [Configuration#load-sidebar](configuration#load-sidebar).
```html
-
-
-
+
```
-Create the `_sidebar.md`:
+Create the `_sidebar.md`
```markdown
-
-
-* [Home](/)
-* [Guide](guide.md)
+- [Home](/)
+- [Guide](/guide)
```
-You need to create a `.nojekyll` in `./docs` to prevent GitHub Pages from ignoring files that begin with an underscore.
+!> Need 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")
-```
+`_sidebar.md` is loaded from each level directory. If this directory doesn't have `_sidebar.md`, it will fallback to parent directory. For example, the current path is `/guide/quick-start`, the `_sidebar.md` will be loaded from `/guide/_sidebar.md`.
## 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).
+Custom sidebar can also be automatically generate TOC by setting `subMaxLevel`. The detail in [Configuration#sub-max-level](configuration#sub-max-level).
```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
index 3706b89..2dd75e9 100644
--- a/docs/plugins.md
+++ b/docs/plugins.md
@@ -1,9 +1,12 @@
-# List of Plugins
+# Using plugins
-## Full text search
+## 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
+
+### Google Analytics
Install the plugin and configure the track id.
@@ -61,137 +42,83 @@ Install the plugin and configure the track id.
ga: 'UA-XXXXX-Y'
}
-
-
+
+
```
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.
+## Write a plugin
-```html
-
-```
+A plugin is simply a function that takes `hook` as arguments.
+The hook supports handling asynchronous tasks.
-## Zoom image
-
-Medium's image zoom. Based on [medium-zoom](https://github.com/francoischalifour/medium-zoom).
-
-```html
-
-```
-
-Exclude the special image
-
-```markdown
-
-```
-
-## 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"
-
-```
-
+#### Full configuration
+```js
window.$docsify = {
- plugins: [
- DocsifyCodefund.create('xxxx-xxx-xxx') // change to your codefund id
- ]
+ plugins: [
+ function (hook) {
+ 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.ready(function() {
+ // Called after initialization is complete. Only trigger once, no arguments.
+ })
+ }
+ ]
}
```
-## Tabs
+!> You can get internal methods through `window.Docsify.utils`.
-A docsify.js plugin for displaying tabbed content from markdown.
+#### Example
-- [Documentation & Demos](https://jhildenbiddle.github.io/docsify-tabs)
+Add footer component in each pages.
-Provided by [@jhildenbiddle](https://github.com/jhildenbiddle/docsify-tabs).
+```js
+window.$docsify = {
+ plugins: [
+ function (hook) {
+ var footer = [
+ ' ',
+ ''
+ ].join('')
-## More plugins
-
-See [awesome-docsify](awesome?id=plugins)
+ hook.afterEach(function (html) {
+ return html + footer
+ })
+ }
+ ]
+}
+```
diff --git a/docs/pwa.md b/docs/pwa.md
deleted file mode 100644
index e8d1c74..0000000
--- a/docs/pwa.md
+++ /dev/null
@@ -1,115 +0,0 @@
-# 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
index 08666d2..0628e70 100644
--- a/docs/quickstart.md
+++ b/docs/quickstart.md
@@ -1,14 +1,14 @@
# Quick start
-It is recommended to install `docsify-cli` globally, which helps initializing and previewing the website locally.
+Recommended install `docsify-cli` globally, which can help us to initialize and preview the website locally.
```bash
npm i docsify-cli -g
```
-## Initialize
+## initialize
-If you want to write the documentation in the `./docs` subdirectory, you can use the `init` command.
+If you want to write the documentation in `./docs` directory, you can use the `init` command.
```bash
docsify init ./docs
@@ -16,79 +16,48 @@ docsify init ./docs
## Writing content
-After the `init` is complete, you can see the file list in the `./docs` subdirectory.
+After the init is complete, you can see the file list in the docs directory.
-* `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).
+- `index.html` as the entry file
+- `README.md` as the home page
+- `.nojekyll` can prevent GitHub Pages from ignoring files that begin with an underscore
+
+You can easily update the documentation in `docs/README.md`, of course you can add [more pages](more-pages).
## Preview your site
-Run the local server with `docsify serve`. You can preview your site in your browser on `http://localhost:3000`.
+Run the local server via `docsify serve`. You can preview your site in browser via 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).
+?> More usages of reference [docsify-cli documentation](https://github.com/QingWei-Li/docsify-cli).
-## Manual initialization
+## Manually
-If you don't like `npm` or have trouble installing the tool, you can manually create `index.html`:
+If you don't like npm or feel the trouble to install the tool. What we need is an `index.html`.
+
+*index.html*
```html
-
-
-
-
-
-
+
```
-If you installed python on your system, you can easily use it to run a static server to preview your site.
+If your system has Python, you can easily 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
deleted file mode 100644
index e9c435f..0000000
--- a/docs/ssr.md
+++ /dev/null
@@ -1,124 +0,0 @@
-# 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
index 1de9125..67b9a5d 100644
--- a/docs/themes.md
+++ b/docs/themes.md
@@ -2,59 +2,13 @@
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).
+!> This compressed files in `/lib/themes/`.
-#### Click to preview
-
-
-
-
-
-
-
-## Other themes
-
-- [docsify-themeable](https://jhildenbiddle.github.io/docsify-themeable/#/) A delightfully simple theme system for docsify.
+If you have any ideas or would like to develop new theme, welcome submit [PR](https://github.com/QingWei-Li/docsify/pulls).
diff --git a/docs/vue.md b/docs/vue.md
index a1b5683..40b98fd 100644
--- a/docs/vue.md
+++ b/docs/vue.md
@@ -1,25 +1,23 @@
# Compatible with Vue
-You can write Vue components directly in the Markdown file, and it will be parsed. You can use this feature to write vue demo and documentation together.
+You can write Vue components directly in the Markdown file, and it will be parsed.
+You can use this feature to write vue demo and documentation together.
## Basic usage
-Load the Vue in `./index.html`.
+Load the Vue in `index.html`.
```html
-
-
-
-
```
-Then you can immediately write Vue code at Markdown file. `new Vue({ el: '#main' })` script is executed by default to create instance.
+Then you can immediately write Vue code at Markdown file.
+`new Vue({ el: 'main' })` script is executed by default to create instance.
*README.md*
-````markdown
+```markdown
# Vue guide
`v-for` usage.
@@ -28,12 +26,12 @@ Then you can immediately write Vue code at Markdown file. `new Vue({ el: '#main'
-```
+``
-````
+```
You can manually initialize a Vue instance.
@@ -42,11 +40,11 @@ You can manually initialize a Vue instance.
```markdown
# Vue demo
-hello {{ msg }}
+hello {{ msg }}
@@ -61,18 +59,9 @@ You can manually initialize a Vue instance.
*index.html*
```html
-
-
-
-
-
-
-
-
-
```
*README.md*
@@ -81,13 +70,13 @@ You can manually initialize a Vue instance.
-
```
-?> Example Refer to the [Vuep documentation](https://qingwei-li.github.io/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
deleted file mode 100644
index baa894e..0000000
--- a/docs/write-a-plugin.md
+++ /dev/null
@@ -1,111 +0,0 @@
-# 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/README.md b/docs/zh-cn/README.md
new file mode 100644
index 0000000..e5051b1
--- /dev/null
+++ b/docs/zh-cn/README.md
@@ -0,0 +1,27 @@
+## docsify
+
+> 一个神奇的文档网站生成工具
+
+## 是什么
+
+docsify 是一个动态生成文档网站的工具。不同于 GitBook、Hexo 的地方是它不会生成将 `.md` 转成 `.html` 文件,所有转换工作都是在运行时进行。
+
+这将非常实用,如果只是需要快速的搭建一个小型的文档网站,或者不想因为生成的一堆 `.html` 文件“污染” commit 记录,只需要创建一个 `index.html` 就可以开始写文档而且直接[部署在 GitHub Pages](zh-cn/deploy)。
+
+查看[快速开始](zh-cn/quickstart)了解详情。
+
+## 特性
+- 无需构建,写完文档直接发布
+- 容易使用并且轻量 (~14kB gzipped)
+- 智能的全文搜索
+- 提供多套主题
+- 丰富的 API
+- 兼容 IE9+
+
+## 例子
+
+可以查看 [Showcase](https://github.com/QingWei-Li/docsify/#showcase) 来了解使用 docsify 的文档项目。
+
+## 捐赠
+
+如果你觉得 docsify 对你有帮助,或者想对我微小的工作一点资瓷,欢迎给我[捐赠](https://github.com/QingWei-Li/donate)。
diff --git a/docs/zh-cn/_sidebar.md b/docs/zh-cn/_sidebar.md
new file mode 100644
index 0000000..e911c38
--- /dev/null
+++ b/docs/zh-cn/_sidebar.md
@@ -0,0 +1,20 @@
+- 入门
+ - [快速开始](zh-cn/quickstart)
+ - [多页文档](zh-cn/more-pages)
+ - [定制导航栏](zh-cn/custom-navbar)
+ - [封面](zh-cn/cover)
+
+- 配置
+ - [配置项](zh-cn/configuration)
+ - [主题](zh-cn/themes)
+ - [使用插件](zh-cn/plugins)
+ - [Markdown 配置](zh-cn/markdown)
+ - [代码高亮](zh-cn/language-highlight)
+
+- 指南
+ - [部署](zh-cn/deploy)
+ - [文档助手](zh-cn/helpers)
+ - [兼容 Vue](zh-cn/vue)
+ - [CDN](zh-cn/cdn)
+
+- [Changelog](zh-cn/changelog)
\ No newline at end of file
diff --git a/docs/zh-cn/cdn.md b/docs/zh-cn/cdn.md
new file mode 100644
index 0000000..b9697f5
--- /dev/null
+++ b/docs/zh-cn/cdn.md
@@ -0,0 +1,48 @@
+# CDN
+
+推荐使用 [unpkg](//unpkg.com) —— 能及时获取到最新版。
+
+## 获取最新版本
+
+根据 UNPKG 的规则,不指定特定版本号时将引入最新版。
+
+```html
+
+
+
+
+
+```
+
+## 获取指定版本
+
+如果担心频繁地版本更新又可能引入未知 Bug,我们也可以使用具体的版本。规则是 `//unpkg.com/docsify@VERSION/`
+
+```html
+
+
+
+
+
+```
+
+!> 指定 *VERSION* 为 `latest` 可以强制每次都请求最新版本。
+
+## 压缩版
+
+CSS 的压缩文件位于 `/lib/themes/` 目录下
+
+```html
+
+```
+
+JS 的压缩文件是原有文件路径的基础上加 `.min`后缀
+
+```html
+
+```
+
+## 其他 CDN
+
+[jsDelivr](http://www.jsdelivr.com/projects/docsify) 也是可用的,具体用法参考其文档。
+
diff --git a/docs/zh-cn/configuration.md b/docs/zh-cn/configuration.md
new file mode 100644
index 0000000..23c96d4
--- /dev/null
+++ b/docs/zh-cn/configuration.md
@@ -0,0 +1,255 @@
+# 配置项
+
+docsify 有两种配置参数的方式。一种是配置在 `window.$docsify` 里,另一种是给 `script` 标签添加 `data-*` 属性。
+
+```html
+
+
+
+
+
+```
+
+两种方式可以共存,推荐第一种做法——直接配置 `window.$docsify` 对象——这会让你的配置更加清晰,同时也可以方便的将配置单独写到另一个文件里。
+
+!> 通过 `window.$docsify` 配置属性,需要将属性改成驼峰命名法。通过 `data-*` 属性配置,保持短横线的命名规则。
+
+
+## el
+
+- 类型:`String`
+- 默认值:`#app`
+
+docsify 初始化的挂载元素,可以是一个 CSS 选择器,默认为 `#app` 如果不存在就直接绑定在 `body` 上。
+
+```js
+window.$docsify = {
+ el: '#app'
+}
+```
+
+## repo
+
+- 类型:`String`
+- 默认值: `null`
+
+配置仓库地址或者 `username/repo` 的字符串,会在页面右上角渲染一个 [GitHub Corner](http://tholman.com/github-corners/) 挂件。
+
+```js
+window.$docsify = {
+ repo: 'QingWei-Li/docsify',
+ // or
+ repo: 'https://github.com/QingWei-Li/docsify/'
+}
+```
+
+
+## max-level
+
+- 类型:`Number`
+- 默认值: `6`
+
+默认情况下会抓取文档中所有标题渲染成目录,可配置最大支持渲染的标题层级。
+
+
+```js
+window.$docsify = {
+ maxLevel: 4
+}
+```
+
+## load-navbar
+
+- 类型:`Boolean|String`
+- 默认值: `false`
+
+加载自定义导航栏,参考[定制导航栏](zh-cn/custom-navbar) 了解用法。设置为 `true` 后会加载 `_navbar.md` 文件,也可以自定义加载的文件名。
+
+```js
+window.$docsify = {
+ // 加载 _navbar.md
+ loadNavbar: true,
+
+ // 加载 nav.md
+ loadNavbar: 'nav.md'
+}
+```
+
+## load-sidebar
+
+- 类型:`Boolean|String`
+- 默认值: `false`
+
+加载自定义侧边栏,参考[多页文档](zh-cn/more-pages)。设置为 `true` 后会加载 `_sidebar.md` 文件,也可以自定义加载的文件名。
+
+```js
+window.$docsify = {
+ // 加载 _sidebar.md
+ loadSidebar: true,
+
+ // 加载 summary.md
+ loadSidebar: 'summary.md'
+}
+```
+
+## sub-max-level
+
+- 类型:`Number`
+- 默认值: `0`
+
+自定义侧边栏后默认不会再生成目录,你也可以通过设置生成目录的最大层级开启这个功能。
+
+
+```js
+window.$docsify = {
+ subMaxLevel: 3
+}
+```
+
+
+## auto2top
+
+- 类型:`Boolean`
+- 默认值: `false`
+
+切换页面后是否自动跳转到页面顶部。
+
+```js
+window.$docsify = {
+ auto2top: true
+}
+```
+
+
+## homepage
+
+- 类型:`String`
+- 默认值: `README.md`
+
+设置首页文件加载路径。适合不想将 `README.md` 作为入口文件渲染,或者是文档存放在其他位置的情况使用。
+
+```js
+window.$docsify = {
+ // 入口文件改为 /home.md
+ homepage: 'home.md',
+
+ // 文档和仓库根目录下的 README.md 内容一致
+ homepage: 'https://raw.githubusercontent.com/QingWei-Li/docsify/master/README.md'
+}
+```
+
+## base-path
+
+- 类型:`String`
+
+文档加载的根路径,可以是二级路径或者是其他域名的路径。
+
+```js
+window.$docsify = {
+ basePath: '/path/',
+
+ // 直接渲染其他域名的文档
+ basePath: 'https://docsify.js.org/',
+
+ // 甚至直接渲染其他仓库 readme
+ basePath: 'https://raw.githubusercontent.com/ryanmcdermott/clean-code-javascript/master/'
+}
+```
+
+
+## coverpage
+
+- 类型:`Boolean|String`
+- 默认值: `false`
+
+启用[封面页](/zh-cn/cover)。开启后是加载 `_coverpage.md` 文件,也可以自定义文件名。
+
+```js
+window.$docsify = {
+ coverpage: true,
+
+ // 自定义文件名
+ coverpage: 'cover.md'
+}
+```
+
+## name
+
+- 类型:`String`
+
+
+文档标题,会显示在侧边栏顶部。
+
+```js
+window.$docsify = {
+ name: 'docsify'
+}
+```
+
+## name-link
+
+- 类型:`String`
+- 默认值:`window.location.pathname`
+
+点击文档标题后跳转的链接地址。
+
+```js
+window.$docsify = {
+ nameLink: '/'
+}
+```
+
+## markdown
+
+- 类型: `Function`
+
+参考 [Markdown 配置](/zh-cn/markdown)。
+
+```js
+window.$docsify = {
+ markdown: function (marked, renderer) {
+ // ...
+ return marked
+ }
+}
+```
+
+## theme-color
+
+- 类型:`String`
+
+替换主题色。利用 [CSS3 支持变量]((https://developer.mozilla.org/en-US/docs/Web/CSS/Using_CSS_variables)的特性,对于老的浏览器有 polyfill 处理。
+
+```js
+window.$docsify = {
+ themeColor: '#3F51B5'
+}
+```
+
+## alias
+
+- 类型:`Object`
+
+定义路由别名,可以更自由的定义路由规则。
+
+
+```js
+window.$docsify = {
+ alias: {
+ '/zh-cn/changelog': '/changelog',
+ '/changelog': 'https://raw.githubusercontent.com/QingWei-Li/docsify/master/CHANGELOG'
+ }
+}
+```
+
diff --git a/docs/zh-cn/cover.md b/docs/zh-cn/cover.md
new file mode 100644
index 0000000..01efe71
--- /dev/null
+++ b/docs/zh-cn/cover.md
@@ -0,0 +1,58 @@
+# 封面
+
+通过设置 `coverpage` 参数,可以开启渲染封面的功能。具体用法见[配置项#coverpage](zh-cn/configuration#coverpage)。
+
+## 基本用法
+
+封面的生成同样是从 markdown 文件渲染来的。开启渲染封面功能后在文档根目录创建 `_coverpage.md` 文件。渲染效果如本文档。
+
+*index.html*
+
+```html
+
+
+```
+
+*_coverpage.md*
+
+```markdown
+
+
+# docsify
+
+> A magical documentation site generator.
+
+- Simple and lightweight (~12kb gzipped)
+- Multiple themes
+- Not build static html files
+
+
+[GitHub](https://github.com/QingWei-Li/docsify/)
+[Get Started](#quick-start)
+```
+
+
+
+!> 一份文档只会在根目录下加载封面,其他页面或者二级目录下都不会加载。
+
+## 自定义背景
+
+目前的背景是随机生成的渐变色,我们自定义背景色或者背景图。在文档末尾用添加图片的 Markdown 语法设置背景。
+
+*_coverpage.md*
+
+```markdown
+# docsify
+
+[GitHub](https://github.com/QingWei-Li/docsify/)
+[Get Started](#quick-start)
+
+
+
+
+
+```
diff --git a/docs/zh-cn/custom-navbar.md b/docs/zh-cn/custom-navbar.md
new file mode 100644
index 0000000..5670865
--- /dev/null
+++ b/docs/zh-cn/custom-navbar.md
@@ -0,0 +1,67 @@
+# 自定义导航栏
+
+我们可以直接在 HTML 里定义导航栏,要注意链接要以 `#/` 开头。
+
+*index.html*
+
+```html
+
+
+ EN
+ 中文
+
+
+
+```
+
+
+## 配置文件
+
+那我们可以通过 Markdown 文件来配置导航。首先配置 `loadNavbar`,默认加载的文件为 `_navbar.md`。具体配置规则见[配置项#load-navbar](zh-cn/configuration#load-navbar)。
+
+*index.html*
+
+
+```html
+
+
+```
+
+*_navbar.md*
+
+```markdown
+- [En](/)
+- [中文](/zh-cn/)
+```
+
+`_navbar.md` 加载逻辑和 `sidebar` 文件一致,从每层目录下获取。例如当前路由为 `/zh-cn/custom-navbar` 那么是从 `/zh-cn/_navbar.md` 获取导航栏。
+
+## 嵌套
+
+如果导航内容过多,可以写成嵌套的列表,会被渲染成下拉列表的形式。
+
+*_navbar.md*
+
+
+```markdown
+- 基础
+ - [快速开始](zh-cn/quickstart)
+ - [多页文档](zh-cn/more-pages)
+ - [定制导航栏](zh-cn/custom-navbar)
+ - [封面](zh-cn/cover)
+
+- 配置
+ - [配置项](zh-cn/configuration)
+ - [主题](zh-cn/themes)
+ - [使用插件](zh-cn/plugins)
+ - [Markdown 配置](zh-cn/markdown)
+ - [代码高亮](zh-cn/language-highlight)
+```
+
+效果图
+
+
diff --git a/docs/zh-cn/deploy.md b/docs/zh-cn/deploy.md
new file mode 100644
index 0000000..7126f55
--- /dev/null
+++ b/docs/zh-cn/deploy.md
@@ -0,0 +1,34 @@
+# 部署
+
+和 GitBook 生成的文档一样,我们可以直接把文档网站部署到 GitHub Pages 或者 VPS 上。
+
+## GitHub Pages
+
+GitHub Pages 支持从三个地方读取文件
+- `docs/` 目录
+- master 分支
+- gh-pages 分支
+
+我们推荐直接将文档放在 `docs/` 目录下,在设置页面开启 **GitHub Pages** 功能并选择 `master branch /docs folder` 选项。
+
+
+
+!> 可以将文档放在根目录下,然后选择 **master 分支** 作为文档目录。
+
+## VPS
+
+和部署所有静态网站一样,只需将服务器的访问根目录设定为 `index.html` 文件。
+
+例如 nginx 的配置
+
+```nginx
+server {
+ listen 80;
+ server_name your.domain.com;
+
+ location / {
+ alias /path/to/dir/of/docs;
+ index index.html;
+ }
+}
+```
diff --git a/docs/zh-cn/helpers.md b/docs/zh-cn/helpers.md
new file mode 100644
index 0000000..ec8b76e
--- /dev/null
+++ b/docs/zh-cn/helpers.md
@@ -0,0 +1,26 @@
+# 文档助手
+
+docsify 扩展了一些 Markdown 语法,可以让文档更易读。
+
+
+## 强调内容
+
+适合显示重要的提示信息,语法为 `!> 内容`。
+
+```markdown
+!> 一段重要的内容,可以和其他 **Markdown** 语法混用。
+```
+
+!> 一段重要的内容,可以和其他 **Markdown** 语法混用。
+
+
+## 普通提示
+
+普通的提示信息,比如写 TODO 或者参考内容等。
+
+```markdown
+?> *TODO* 完善示例
+```
+
+?> *TODO* 完善示例
+
diff --git a/docs/zh-cn/language-highlight.md b/docs/zh-cn/language-highlight.md
new file mode 100644
index 0000000..dffae89
--- /dev/null
+++ b/docs/zh-cn/language-highlight.md
@@ -0,0 +1,11 @@
+# 代码高亮
+
+内置的代码高亮工具是 [Prism](https://github.com/PrismJS/prism),默认支持 CSS、JavaScript 和 HTML。如果需要高亮其语言——例如 PHP——可以手动引入代码高亮插件。
+
+```html
+
+
+
+```
+
+?> 其他的语言高亮插件可以查看[Prims 仓库](https://github.com/PrismJS/prism/tree/gh-pages/components)。
\ No newline at end of file
diff --git a/docs/zh-cn/markdown.md b/docs/zh-cn/markdown.md
new file mode 100644
index 0000000..d134e1f
--- /dev/null
+++ b/docs/zh-cn/markdown.md
@@ -0,0 +1,26 @@
+# Markdown 配置
+
+内置的 Markdown 解析器是 [marked](https://github.com/chjj/marked),可以修改它的配置。
+
+```js
+window.$docsify = {
+ markdown: {
+ smartypants: true
+ // ...
+ }
+}
+```
+
+?> 完整配置参数参考 [marked 文档](https://github.com/chjj/marked#options-1)
+
+当然也可以完全定制 Markdown 解析规则。
+
+```js
+window.$docsify = {
+ markdown: function(marked, renderer) {
+ // ...
+
+ return marked
+ }
+}
+```
\ No newline at end of file
diff --git a/docs/zh-cn/more-pages.md b/docs/zh-cn/more-pages.md
new file mode 100644
index 0000000..455b203
--- /dev/null
+++ b/docs/zh-cn/more-pages.md
@@ -0,0 +1,66 @@
+# 多页文档
+
+如果需要创建多个页面,或者需要多级路由的网站,在 docsify 里也能很容易的实现。例如创建一个 `guide.md` 文件,那么对应的路由就是 `/#/guide`。
+
+假设你的目录结构如下:
+
+```text
+-| docs/
+ -| README.md
+ -| guide.md
+ -| zh-cn/
+ -| README.md
+ -| guide.md
+```
+
+那么对应的访问页面将是
+
+```text
+docs/README.md => http://domain.com
+docs/guide.md => http://domain.com/guide
+docs/zh-cn/README.md => http://domain.com/zh-cn/
+docs/zh-cn/guide.md => http://domain.com/zh-cn/guide
+```
+
+## 定制侧边栏
+
+默认情况下,侧边栏会根据当前文档的标题生成目录。也可以设置文档链接,通过 Markdown 文件生成,效果如当前的文档的侧边栏。
+
+首先配置 `loadSidebar` 选项,具体配置规则见[配置项#load-sidebar](zh-cn/configuration#load-sidebar)。
+
+```html
+
+
+```
+
+接着创建 `_sidebar.md` 文件,内容如下
+
+```markdown
+- [首页](zh-cn/)
+- [指南](zh-cn/guide)
+```
+
+!> 需要在文档根目录创建 `.nojekyll` 命名的空文件,阻止 GitHub Pages 忽略命名是下划线开头的文件。
+
+
+`_sidebar.md` 的加载逻辑是从每层目录下获取文件,如果当前目录不存在该文件则回退到上一级目录。例如当前路径为 `/zh-cn/more-pages` 则从 `/zh-cn/_sidebar.md` 获取文件,如果不存在则从 `/_sidebar.md` 获取。
+
+## 显示目录
+
+自定义侧边栏同时也可以开启目录功能。设置 `subMaxLevel` 配置项,具体介绍见 [配置项#sub-max-level](zh-cn/configuration#sub-max-level)。
+
+```html
+
+
+```
+
+
diff --git a/docs/zh-cn/plugins.md b/docs/zh-cn/plugins.md
new file mode 100644
index 0000000..8145f01
--- /dev/null
+++ b/docs/zh-cn/plugins.md
@@ -0,0 +1,119 @@
+# 使用插件
+
+## 内置插件
+
+### 全文搜索 - Search
+
+全文搜索插件会根据当前页面上的超链接获取文档内容,在 `localStorage` 内建立文档索引。默认过期时间为一天,当然我们可以自己指定需要缓存的文件列表或者配置过期时间。
+
+
+```html
+
+
+
+```
+
+### 谷歌统计 - Google Analytics
+
+需要配置 track id 才能使用。
+
+```html
+
+
+
+```
+
+也可以通过 `data-ga` 配置 id。
+
+```html
+
+
+```
+
+## 自定义插件
+
+docsify 提供了一套插件机制,其中提供的钩子(hook)支持处理异步逻辑,可以很方便的扩展功能。
+
+#### 完整功能
+
+```js
+window.$docsify = {
+ plugins: [
+ function (hook) {
+ hook.init(function() {
+ // 初始化时调用,只调用一次,没有参数。
+ })
+
+ hook.beforeEach(function(content) {
+ // 每次开始解析 Markdown 内容时调用
+ // ...
+ return content
+ })
+
+ hook.afterEach(function(html, next) {
+ // 解析成 html 后调用。beforeEach 和 afterEach 支持处理异步逻辑
+ // ...
+ // 异步处理完成后调用 next(html) 返回结果
+ next(html)
+ })
+
+ hook.doneEach(function() {
+ // 每次路由切换时数据全部加载完成后调用,没有参数。
+ // ...
+ })
+
+ hook.ready(function() {
+ // 初始化完成后调用,只调用一次,没有参数。
+ })
+ }
+ ]
+}
+```
+
+!> 如果需要用 docsify 的内部方法,可以通过 `window.Docsify.utils` 获取。
+
+#### 例子
+
+给每个页面的末尾加上 `footer`
+
+```js
+window.$docsify = {
+ plugins: [
+ function (hook) {
+ var footer = [
+ ' ',
+ ''
+ ].join('')
+
+ hook.afterEach(function (html) {
+ return html + footer
+ })
+ }
+ ]
+}
+```
diff --git a/docs/zh-cn/quickstart.md b/docs/zh-cn/quickstart.md
new file mode 100644
index 0000000..c4ebc28
--- /dev/null
+++ b/docs/zh-cn/quickstart.md
@@ -0,0 +1,61 @@
+# 快速开始
+
+推荐安装 `docsify-cli` 工具,可以方便创建及本地预览文档网站。
+
+```bash
+npm i docsify-cli -g
+```
+
+## 初始化项目
+
+如果想在项目的 `./docs` 目录里写文档,直接通过 `init` 初始化项目。
+
+```bash
+docsify init ./docs
+```
+
+## 开始写文档
+
+初始化成功后,可以看到 `./docs` 目录下创建的几个文件
+
+- `index.html` 入口文件
+- `README.md` 会做为主页内容渲染
+- `.nojekyll` 用于阻止 GitHub Pages 会忽略掉下划线开头的文件
+
+直接编辑 `docs/README.md` 就能更新网站内容,当然也可以[写多个页面](zh-cn/more-pages)。
+
+## 本地预览网站
+
+运行一个本地服务器通过 `docsify serve` 可以方便的预览效果,而且提供 LiveReload 功能,可以让实时的预览。默认访问 http://localhost:3000 。
+
+```bash
+docsify serve docs
+```
+
+?> 更多命令行工具用法,参考 [docsify-cli 文档](https://github.com/QingWei-Li/docsify-cli)。
+
+## 手动初始化
+
+如果不喜欢 npm 或者觉得安装工具太麻烦,我们其实只需要直接创建一个 `index.html` 文件。
+
+*index.html*
+
+```html
+
+
+
+
+
+
+
+
+
+
+
+```
+
+如果系统里安装 Python 的话,也可以很轻易的启动一个静态服务器。
+
+```bash
+cd docs && python -m SimpleHTTPServer 3000
+```
diff --git a/docs/zh-cn/themes.md b/docs/zh-cn/themes.md
new file mode 100644
index 0000000..b728d7a
--- /dev/null
+++ b/docs/zh-cn/themes.md
@@ -0,0 +1,13 @@
+# 主题
+
+目前提供三套主题可供选择,模仿 [Vue](//vuejs.org) 和 [buble](//buble.surge.sh) 官网订制的主题样式。还有 [@liril-net](https://github.com/liril-net) 贡献的黑色风格的主题。
+
+```html
+
+
+
+```
+
+!> CSS 的压缩文件位于 `/lib/themes/`
+
+如果你有其他想法或者想开发别的主题,欢迎提 [PR](https://github.com/QingWei-Li/docsify/pulls)。
\ No newline at end of file
diff --git a/docs/zh-cn/vue.md b/docs/zh-cn/vue.md
new file mode 100644
index 0000000..37dd807
--- /dev/null
+++ b/docs/zh-cn/vue.md
@@ -0,0 +1,87 @@
+# 兼容 Vue
+
+你可以直接在 Markdown 文件里写 Vue 代码,它将被执行。我们可以用它写一些 Vue 的 Demo 或者示例代码。
+
+
+## 基础用法
+
+在 `index.html` 里引入 Vue。
+
+```html
+
+
+```
+
+接着就可以愉快地在 Markdown 里写 Vue 了。默认会执行 `new Vue({ el: 'main' })` 创建示例。
+
+*README.md*
+
+```markdown
+# Vue 介绍
+
+`v-for` 的用法
+
+```html
+
+``
+
+
+```
+
+当然你也可以手动初始化 Vue,这样你可以自定义一些配置。
+
+*README.md*
+
+```markdown
+# Vue 的基本用法
+
+hello {{ msg }}
+
+
+```
+
+!> 一个 Markdown 文件里只有第一个 `script` 标签内的内容会被执行。
+
+## 搭配 Vuep 写 Playground
+
+[Vuep](https://github.com/QingWei-Li/vuep) 是一个提供在线编辑和预览效果的 Vue 组件,搭配 docsify 可以直接在文档里写 Vue 的示例代码,支持 Vue component spec 和 JSX。
+
+*index.html*
+
+```html
+
+
+
+```
+
+*README.md*
+```markdown
+# Vuep 使用
+
+
+
+
+
+```
+
+?> 具体效果参考 [Vuep 文档](https://qingwei-li.github.io/vuep/)。
diff --git a/index.html b/index.html
deleted file mode 100644
index 59e6911..0000000
--- a/index.html
+++ /dev/null
@@ -1,84 +0,0 @@
-
-
-
-
-
- docsify
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/lerna.json b/lerna.json
deleted file mode 100644
index 26fa22a..0000000
--- a/lerna.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "lerna": "2.0.0-rc.5",
- "packages": [
- "packages/*"
- ],
- "version": "0.0.0"
-}
diff --git a/lib/docsify.js b/lib/docsify.js
new file mode 100644
index 0000000..518bafb
--- /dev/null
+++ b/lib/docsify.js
@@ -0,0 +1,3015 @@
+var D = (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.replace(/%23/g, '#').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(/<(pre|template)[^>]*?>([\s\S]+)<\/(pre|template)>/g, function (match) { return match.replace(/:/g, '__colon__'); })
+ .replace(/:(\w+?):/ig, ' ')
+ .replace(/__colon__/g, ':')
+}
+
+
+var utils = Object.freeze({
+ load: load,
+ genTree: genTree,
+ camel2kebab: camel2kebab,
+ isNil: isNil,
+ getRoute: getRoute,
+ isMobile: isMobile,
+ slugify: slugify,
+ merge: merge,
+ emojify: emojify
+});
+
+/**
+ * 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('.sidebar');
+ var sidebarContainer = sidebar.querySelector('.sidebar-nav');
+ var sidebarHeight = sidebar.clientHeight;
+
+ 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 a = li.querySelector('a');
+ if (!a) { continue }
+ var href = 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;
+
+ // scroll into view
+ // https://github.com/vuejs/vuejs.org/blob/master/themes/vue/source/js/common.js#L282-L297
+ if (!hoveredOverSidebar && !sticky.noSticky) {
+ var currentPageOffset = 0;
+ var currentActiveOffset = active.offsetTop + active.clientHeight + 40;
+ var currentActiveIsInView = (
+ active.offsetTop >= sidebarContainer.scrollTop &&
+ currentActiveOffset <= sidebarContainer.scrollTop + sidebarHeight
+ );
+ var linkNotFurtherThanSidebarHeight = currentActiveOffset - currentPageOffset < sidebarHeight;
+ var newScrollTop = currentActiveIsInView
+ ? sidebarContainer.scrollTop
+ : linkNotFurtherThanSidebarHeight
+ ? currentPageOffset
+ : currentActiveOffset - sidebarHeight;
+
+ sidebar.scrollTop = newScrollTop;
+ }
+ }
+
+ 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('.sidebar');
+ sidebar.addEventListener('click', function () {
+ body.classList.toggle('close');
+ setTimeout(function () { return activeLink(sidebar, true); }, 0);
+ });
+ }
+}
+
+var scrollingElement = document.scrollingElement || document.documentElement;
+
+function scroll2Top (offset) {
+ if ( offset === void 0 ) offset = 0;
+
+ scrollingElement.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: /^ *\[([^\]]+)\]: *([^\s>]+)>?(?: +["(]([^\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 '\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 + '' + type + '>\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 + '' + type + '>\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 = '' + text + ' ';
+ return out;
+};
+
+Renderer.prototype.image = function(href, title, text) {
+ var out = ' ' : '>';
+ 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 + '' + env.tag + '>';
+
+};
+
+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: /(")
+}
+
+function replaceVar (block) {
+ block.innerHTML = block.innerHTML.replace(/var\(\s*--theme-color.*?\)/g, $docsify.themeColor);
+}
+
+function cssVars () {
+ // variable support
+ if (window.CSS && window.CSS.supports && window.CSS.supports('(--foo: red)')) { return }
+
+ var styleBlocks = document.querySelectorAll('style:not(.inserted),link');[].forEach.call(styleBlocks, function (block) {
+ if (block.nodeName === 'STYLE') {
+ replaceVar(block);
+ } else if (block.nodeName === 'LINK') {
+ var href = block.getAttribute('href');
+
+ if (!/\.css$/.test(href)) { return }
+
+ load(href).then(function (res) {
+ var style = document.createElement('style');
+
+ style.innerHTML = res;
+ document.head.appendChild(style);
+ replaceVar(style);
+ });
+ }
+ });
+}
+
+var markdown = marked;
+var toc = [];
+var CACHE = {};
+var originTitle = document.title;
+
+var renderTo = function (dom, content) {
+ dom = typeof dom === 'object' ? dom : document.querySelector(dom);
+ dom.innerHTML = content;
+ slugify.clear();
+
+ return dom
+};
+
+/**
+ * init render
+ */
+function init () {
+ 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 = '';
+
+ 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 + " ")
+ };
+ renderer.link = function (href, title, text) {
+ if (!/:|(\/{2})/.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 + "
")
+ };
+ renderer.image = function (href, title, text) {
+ var url = /:|(\/{2})/.test(href) ? href : ($docsify.basePath + href).replace(/\/+/g, '/');
+ var titleHTML = title ? (" title=\"" + title + "\"") : '';
+
+ return (" ")
+ };
+
+ if (typeof $docsify.markdown === 'function') {
+ markdown = $docsify.markdown.call(this, markdown, renderer);
+ } else {
+ if ($docsify.markdown && $docsify.markdown.renderer) {
+ $docsify.markdown.renderer = merge(renderer, $docsify.markdown.renderer);
+ }
+ markdown.setOptions(merge({ renderer: renderer }, $docsify.markdown));
+ }
+
+ var md = markdown;
+
+ markdown = function (text) { return emojify(md(text)); };
+
+ window.Docsify.utils.marked = function (text) {
+ var result = markdown(text);
+ toc = [];
+ return result
+ };
+}
+
+/**
+ * App
+ */
+function renderApp (dom, replace) {
+ var nav = document.querySelector('nav') || document.createElement('nav');
+ var body = document.body;
+ var head = document.head;
+
+ if (!$docsify.repo) { nav.classList.add('no-badge'); }
+
+ dom[replace ? 'outerHTML' : 'innerHTML'] = corner($docsify.repo) +
+ ($docsify.coverpage ? cover() : '') +
+ main();
+ body.insertBefore(nav, body.children[0]);
+
+ // theme color
+ if ($docsify.themeColor) {
+ head.innerHTML += theme($docsify.themeColor);
+ cssVars();
+ }
+
+ // render name
+ if ($docsify.name) {
+ var aside = document.querySelector('.sidebar');
+ aside.innerHTML = "" + aside.innerHTML;
+ }
+
+ // bind toggle
+ bindToggle('button.sidebar-toggle');
+ // bind sticky effect
+ if ($docsify.coverpage) {
+ !isMobile() && window.addEventListener('scroll', sticky);
+ } else {
+ body.classList.add('sticky');
+ }
+}
+
+/**
+ * article
+ */
+function renderArticle (content) {
+ var hook = window.Docsify.hook;
+ var renderFn = function (data) {
+ renderTo('article', data);
+ if (!$docsify.loadSidebar) { renderSidebar(); }
+
+ if (data && typeof Vue !== 'undefined') {
+ CACHE.vm && CACHE.vm.$destroy();
+
+ var script = [].slice.call(
+ document.body.querySelectorAll('article>script'))
+ .filter(function (script) { return !/template/.test(script.type); }
+ )[0];
+ var code = script ? script.innerText.trim() : null;
+
+ script && script.remove();
+ CACHE.vm = code
+ ? new Function(("return " + code))()
+ : new Vue({ el: 'main' }); // eslint-disable-line
+ CACHE.vm && CACHE.vm.$nextTick(function (_) { return scrollActiveSidebar(); });
+ }
+ if ($docsify.auto2top) { setTimeout(function () { return scroll2Top($docsify.auto2top); }, 0); }
+ };
+
+ hook.emit('before', content, function (result) {
+ var html = result ? markdown(result) : '';
+
+ hook.emit('after', html, function (result) { return renderFn(result || 'not found'); });
+ });
+}
+
+/**
+ * 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 {
+ html = tree(genTree(toc, $docsify.maxLevel), '');
+ }
+
+ renderTo('.sidebar-nav', html);
+
+ if (toc[0] && toc[0].level === 1) {
+ document.title = "" + (toc[0].title) + (originTitle ? ' - ' + originTitle : '');
+ }
+
+ var target = activeLink('.sidebar-nav', true);
+ if (target) { renderSubSidebar(target); }
+
+ toc = [];
+ scrollActiveSidebar();
+}
+
+function renderSubSidebar (target) {
+ if (!$docsify.subMaxLevel) { return }
+ toc[0] && toc[0].level === 1 && toc.shift();
+ target.parentNode.innerHTML += tree(genTree(toc, $docsify.subMaxLevel), '');
+}
+
+/**
+ * Cover Page
+ */
+function renderCover (content) {
+ renderCover.dom = renderCover.dom || document.querySelector('section.cover');
+ if (!content) {
+ renderCover.dom.classList.remove('show');
+ return
+ }
+ renderCover.dom.classList.add('show');
+ if (renderCover.rendered) { return sticky() }
+
+ // render cover
+ var cacheToc = toc.slice();
+ var html = markdown(content);
+ var match = html.trim().match(' ([^<]*?)
$');
+
+ toc = cacheToc.slice();
+
+ // render background
+ if (match) {
+ var coverEl = document.querySelector('section.cover');
+
+ if (match[2] === 'color') {
+ coverEl.style.background = match[1] + (match[3] || '');
+ } else {
+ coverEl.classList.add('has-mask');
+ coverEl.style.backgroundImage = "url(" + (match[1]) + ")";
+ }
+ html = html.replace(match[0], '');
+ }
+
+ renderTo('.cover-main', html);
+ renderCover.rendered = true;
+
+ sticky();
+}
+
+/**
+ * render loading bar
+ * @return {[type]} [description]
+ */
+function renderLoading (ref) {
+ var loaded = ref.loaded;
+ var total = ref.total;
+ var step = ref.step;
+
+ var num;
+
+ if (!CACHE.loading) {
+ var div = document.createElement('div');
+
+ div.classList.add('progress');
+ document.body.appendChild(div);
+ CACHE.loading = div;
+ }
+ if (step) {
+ num = parseInt(CACHE.loading.style.width, 10) + step;
+ num = num > 80 ? 80 : num;
+ } else {
+ num = Math.floor(loaded / total * 100);
+ }
+
+ CACHE.loading.style.opacity = 1;
+ CACHE.loading.style.width = num >= 95 ? '100%' : num + '%';
+
+ if (num >= 95) {
+ clearTimeout(renderLoading.cacheTimeout);
+ renderLoading.cacheTimeout = setTimeout(function (_) {
+ CACHE.loading.style.opacity = 0;
+ CACHE.loading.style.width = '0%';
+ }, 200);
+ }
+}
+
+var Hook = function Hook () {
+ this.beforeHooks = [];
+ this.afterHooks = [];
+ this.initHooks = [];
+ this.readyHooks = [];
+ this.doneEachHooks = [];
+};
+
+Hook.prototype.beforeEach = function beforeEach (fn) {
+ this.beforeHooks.push(fn);
+};
+
+Hook.prototype.afterEach = function afterEach (fn) {
+ this.afterHooks.push(fn);
+};
+
+Hook.prototype.doneEach = function doneEach (fn) {
+ this.doneEachHooks.push(fn);
+};
+
+Hook.prototype.init = function init (fn) {
+ this.initHooks.push(fn);
+};
+
+Hook.prototype.ready = function ready (fn) {
+ this.readyHooks.push(fn);
+};
+
+Hook.prototype.emit = function emit (name, data, next) {
+ var newData = data;
+ var queue = this[name + 'Hooks'];
+ var step = function (index) {
+ var hook = queue[index];
+ if (index >= queue.length) {
+ next && next(newData);
+ } else {
+ if (typeof hook === 'function') {
+ if (hook.length === 2) {
+ hook(data, function (result) {
+ newData = result;
+ step(index + 1);
+ });
+ } else {
+ var result = hook(data);
+ newData = result !== undefined ? result : newData;
+ step(index + 1);
+ }
+ } else {
+ step(index + 1);
+ }
+ }
+ };
+
+ step(0);
+};
+
+var OPTIONS = merge({
+ el: '#app',
+ repo: '',
+ maxLevel: 6,
+ subMaxLevel: 0,
+ loadSidebar: null,
+ loadNavbar: null,
+ homepage: 'README.md',
+ coverpage: '',
+ basePath: '',
+ auto2top: false,
+ name: '',
+ themeColor: '',
+ nameLink: window.location.pathname,
+ ga: ''
+}, window.$docsify);
+var script = document.currentScript || [].slice.call(document.getElementsByTagName('script')).pop();
+
+// load configuration for script attribute
+if (script) {
+ for (var prop in OPTIONS) {
+ var val = script.getAttribute('data-' + camel2kebab(prop));
+ OPTIONS[prop] = isNil(val) ? OPTIONS[prop] : (val || true);
+ }
+ if (OPTIONS.loadSidebar === true) { OPTIONS.loadSidebar = '_sidebar.md'; }
+ if (OPTIONS.loadNavbar === true) { OPTIONS.loadNavbar = '_navbar.md'; }
+ if (OPTIONS.coverpage === true) { OPTIONS.coverpage = '_coverpage.md'; }
+ if (OPTIONS.repo === true) { OPTIONS.repo = ''; }
+ if (OPTIONS.name === true) { OPTIONS.name = ''; }
+}
+
+var hook = new Hook();
+
+// utils
+window.$docsify = OPTIONS;
+window.Docsify = {
+ installed: true,
+ utils: merge({}, utils),
+ hook: hook
+};
+
+// load options
+init();
+
+var cacheRoute = null;
+var cacheXhr = null;
+
+var getAlias = function (route) {
+ if (OPTIONS.alias[route]) {
+ return getAlias(OPTIONS.alias[route])
+ } else {
+ return route
+ }
+};
+
+var mainRender = function (cb) {
+ var page;
+ var route = getRoute();
+ if (cacheRoute === route) { return cb() }
+
+ var basePath = cacheRoute = OPTIONS.basePath + route;
+
+ if (!/\//.test(basePath)) {
+ basePath = '';
+ } else if (basePath && !/\/$/.test(basePath)) {
+ basePath = basePath.match(/(\S*\/)[^\/]+$/)[1];
+ }
+
+ // replace route
+ if (OPTIONS.alias && OPTIONS.alias['/' + route]) {
+ route = getAlias('/' + route);
+ } else {
+ route = (OPTIONS.basePath + route).replace(/\/+/, '/');
+ }
+
+ if (!route) {
+ page = OPTIONS.homepage || 'README.md';
+ } else if (/\.md$/.test(route)) {
+ page = route;
+ } else if (/\/$/.test(route)) {
+ page = route + "README.md";
+ } else {
+ page = route + ".md";
+ }
+
+ // Render Cover page
+ if (OPTIONS.coverpage && page === OPTIONS.homepage) {
+ load(OPTIONS.coverpage).then(renderCover);
+ }
+
+ cacheXhr && cacheXhr.abort && cacheXhr.abort();
+ // Render markdown file
+ cacheXhr = load(page, 'GET', renderLoading);
+ cacheXhr.then(function (result) {
+ renderArticle(result);
+ // clear cover
+ if (OPTIONS.coverpage && page !== OPTIONS.homepage) { renderCover(); }
+ // render sidebar
+ if (OPTIONS.loadSidebar) {
+ var renderSidebar$$1 = function (result) { renderSidebar(result); cb(); };
+
+ load(basePath + OPTIONS.loadSidebar).then(renderSidebar$$1,
+ function (_) { return load(OPTIONS.loadSidebar).then(renderSidebar$$1); });
+ } else {
+ cb();
+ }
+ }, function (_) { return renderArticle(null); });
+
+ // Render navbar
+ if (OPTIONS.loadNavbar) {
+ load(basePath + OPTIONS.loadNavbar).then(renderNavbar,
+ function (_) { return load(OPTIONS.loadNavbar).then(renderNavbar); });
+ }
+};
+
+var Docsify = function () {
+ setTimeout(function (_) {
+ [].concat(OPTIONS.plugins).forEach(function (fn) { return typeof fn === 'function' && fn(hook); });
+ window.Docsify.hook.emit('init');
+
+ var dom = document.querySelector(OPTIONS.el) || document.body;
+ var replace = dom !== document.body;
+ var main = function () {
+ mainRender(function (_) {
+ scrollIntoView();
+ activeLink('nav');
+ window.Docsify.hook.emit('doneEach');
+ });
+ };
+
+ // Render app
+ renderApp(dom, replace);
+ main();
+ if (!/^#\//.test(window.location.hash)) { window.location.hash = '#/'; }
+ window.addEventListener('hashchange', main);
+ window.Docsify.hook.emit('ready');
+ }, 0);
+};
+
+var index = Docsify();
+
+return index;
+
+}());
diff --git a/lib/docsify.min.js b/lib/docsify.min.js
new file mode 100644
index 0000000..15d2f5a
--- /dev/null
+++ b/lib/docsify.min.js
@@ -0,0 +1,2 @@
+var D=function(){"use strict";function e(e,t,n){void 0===t&&(t="GET");var r=new XMLHttpRequest;return r.open(t,e),r.send(),{then:function(e,t){if(void 0===t&&(t=function(){}),n){var i=setInterval(function(e){return n({step:Math.floor(5*Math.random()+1)})},500);r.addEventListener("progress",n),r.addEventListener("loadend",function(e){n(e),clearInterval(i)})}r.addEventListener("error",t),r.addEventListener("load",function(n){var r=n.target;r.status>=400?t(r):e(r.response)})},abort:function(){return 4!==r.readyState&&r.abort()}}}function t(e,t){var n=[],r={};return e.forEach(function(e){var i=e.level||1,o=i-1;i>t||(r[o]?(r[o].children=r[o].children||[],r[o].children.push(e)):n.push(e),r[i]=e)}),n}function n(e){return e.replace(/([A-Z])/g,function(e){return"-"+e.toLowerCase()})}function r(e){return null===e||void 0===e}function i(){var e=window.location;if(M===e.hash&&!r(j))return j;var t=e.hash.replace(/%23/g,"#").match(/^#\/([^#]+)/);return t=t&&2===t.length?t[1]:/^#\//.test(e.hash)?"":e.pathname,j=t,M=e.hash,t}function o(){return document.body.clientWidth<=600}function a(e){var t=/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,.\/:;<=>?@\[\]^`{|}~]/g,n=!1,r="-";if(a.occurrences=a.occurrences||{},"string"!=typeof e)return"";n||(e=e.toLowerCase());var i=e.trim().replace(/<[^>\d]+>/g,"").replace(t,"").replace(/\s/g,r).replace(/-+/g,r).replace(/^(\d)/,"_$1"),o=a.occurrences[i];return a.occurrences.hasOwnProperty(i)?o++:o=0,a.occurrences[i]=o,o&&(i=i+"-"+o),i}function s(e){return e.replace(/<(pre|template)[^>]*?>([\s\S]+)<\/(pre|template)>/g,function(e){return e.replace(/:/g,"__colon__")}).replace(/:(\w+?):/gi,' ').replace(/__colon__/g,":")}function l(){function e(){for(var e,o=document.body.scrollTop,l=0,u=n.length;lo){e||(e=d);break}e=d}if(e){var p=s[e.getAttribute("data-id")];if(p&&p!==c&&(c&&c.classList.remove("active"),p.classList.add("active"),c=p,!t&&!h.noSticky)){var g=0,f=c.offsetTop+c.clientHeight+40,m=c.offsetTop>=i.scrollTop&&f<=i.scrollTop+a,y=f-g=e||h.dom.classList.contains("hidden")?(document.body.classList.add("sticky"),h.noSticky=!1):(document.body.classList.remove("sticky"),h.noSticky=!0)}()}function g(e,t){return t={exports:{}},e(t,t.exports),t.exports}function f(e){return e?(/\/\//.test(e)||(e="https://github.com/"+e),e=e.replace(/^git\+/,""),'\n \n \n \n \n \n \n '):""}function m(){var e=b()+'';return(o()?e+"":""+e)+'\n '}function y(){var e=", 100%, 85%",t="linear-gradient(to left bottom, hsl("+(Math.floor(255*Math.random())+e)+") 0%, hsl("+(Math.floor(255*Math.random())+e)+") 100%)";return''}function b(){return''}function v(e,t){return void 0===t&&(t=""),e&&e.length?(e.forEach(function(e){t+=''+e.title+" ",e.children&&(t+=' ")}),t):""}function k(e,t){return''+t.slice(5).trim()+"
"}function w(e){return""}function x(e){e.innerHTML=e.innerHTML.replace(/var\(\s*--theme-color.*?\)/g,$docsify.themeColor)}function L(){if(!(window.CSS&&window.CSS.supports&&window.CSS.supports("(--foo: red)"))){var t=document.querySelectorAll("style:not(.inserted),link");[].forEach.call(t,function(t){if("STYLE"===t.nodeName)x(t);else if("LINK"===t.nodeName){var n=t.getAttribute("href");if(!/\.css$/.test(n))return;e(n).then(function(e){var t=document.createElement("style");t.innerHTML=e,document.head.appendChild(t),x(t)})}})}}function S(){var e=new F.Renderer;e.heading=function(e,t){var n=a(e),r="";return r="#/"+i(),D.push({level:t,slug:r+"#"+encodeURIComponent(n),title:e}),"'+e+" "},e.code=function(e,t){void 0===t&&(t="");var n=W.highlight(e,W.languages[t]||W.languages.markup);return' '+n+" "},e.link=function(e,t,n){return/:|(\/{2})/.test(e)||(e=("#/"+e).replace(/\/+/g,"/")),''+n+" "},e.paragraph=function(e){return/^!>/.test(e)?k("tip",e):/^\?>/.test(e)?k("warn",e):""+e+"
"},e.image=function(e,t,n){var r=/:|(\/{2})/.test(e)?e:($docsify.basePath+e).replace(/\/+/g,"/"),i=t?' title="'+t+'"':"";return' "},"function"==typeof $docsify.markdown?z=$docsify.markdown.call(this,z,e):($docsify.markdown&&$docsify.markdown.renderer&&($docsify.markdown.renderer=O(e,$docsify.markdown.renderer)),z.setOptions(O({renderer:e},$docsify.markdown)));var t=z;z=function(e){return s(t(e))},window.Docsify.utils.marked=function(e){var t=z(e);return D=[],t}}function $(e,t){var n=document.querySelector("nav")||document.createElement("nav"),r=document.body,i=document.head;if($docsify.repo||n.classList.add("no-badge"),e[t?"outerHTML":"innerHTML"]=f($docsify.repo)+($docsify.coverpage?y():"")+m(),r.insertBefore(n,r.children[0]),$docsify.themeColor&&(i.innerHTML+=w($docsify.themeColor),L()),$docsify.name){var a=document.querySelector(".sidebar");a.innerHTML='"+a.innerHTML}d("button.sidebar-toggle"),$docsify.coverpage?!o()&&window.addEventListener("scroll",h):r.classList.add("sticky")}function _(e){var t=window.Docsify.hook,n=function(e){if(G("article",e),$docsify.loadSidebar||E(),e&&"undefined"!=typeof Vue){R.vm&&R.vm.$destroy();var t=[].slice.call(document.body.querySelectorAll("article>script")).filter(function(e){return!/template/.test(e.type)})[0],n=t?t.innerText.trim():null;t&&t.remove(),R.vm=n?new Function("return "+n)():new Vue({el:"main"}),R.vm&&R.vm.$nextTick(function(e){return l()})}$docsify.auto2top&&setTimeout(function(){return p($docsify.auto2top)},0)};t.emit("before",e,function(e){var r=e?z(e):"";t.emit("after",r,function(e){return n(e||"not found")})})}function C(e){R.navbar&&R.navbar===e||(R.navbar=e,e&&G("nav",z(e)),u("nav"))}function E(e){var n;e?(n=z(e),n=n.match(/]*>([\s\S]+)<\/ul>/g)[0]):n=v(t(D,$docsify.maxLevel),""),G(".sidebar-nav",n),D[0]&&1===D[0].level&&(document.title=""+D[0].title+(B?" - "+B:""));var r=u(".sidebar-nav",!0);r&&A(r),D=[],l()}function A(e){$docsify.subMaxLevel&&(D[0]&&1===D[0].level&&D.shift(),e.parentNode.innerHTML+=v(t(D,$docsify.subMaxLevel),""))}function T(e){if(T.dom=T.dom||document.querySelector("section.cover"),!e)return void T.dom.classList.remove("show");if(T.dom.classList.add("show"),T.rendered)return h();var t=D.slice(),n=z(e),r=n.trim().match(' ([^<]*?)
$');if(D=t.slice(),r){var i=document.querySelector("section.cover");"color"===r[2]?i.style.background=r[1]+(r[3]||""):(i.classList.add("has-mask"),i.style.backgroundImage="url("+r[1]+")"),n=n.replace(r[0],"")}G(".cover-main",n),T.rendered=!0,h()}function q(e){var t,n=e.loaded,r=e.total,i=e.step;if(!R.loading){var o=document.createElement("div");o.classList.add("progress"),document.body.appendChild(o),R.loading=o}i?(t=parseInt(R.loading.style.width,10)+i,t=t>80?80:t):t=Math.floor(n/r*100),R.loading.style.opacity=1,R.loading.style.width=t>=95?"100%":t+"%",t>=95&&(clearTimeout(q.cacheTimeout),q.cacheTimeout=setTimeout(function(e){R.loading.style.opacity=0,R.loading.style.width="0%"},200))}var j=null,M=null;a.clear=function(){a.occurrences={}};var N=Object.prototype.hasOwnProperty,O=Object.assign||function(e){for(var t=arguments,n=1;n /g,">").replace(/"/g,""").replace(/'/g,"'")}function a(e){return e.replace(/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/g,function(e,t){return t=t.toLowerCase(),"colon"===t?":":"#"===t.charAt(0)?"x"===t.charAt(1)?String.fromCharCode(parseInt(t.substring(2),16)):String.fromCharCode(+t.substring(1)):""})}function s(e,t){return e=e.source,t=t||"",function n(r,i){return r?(i=i.source||i,i=i.replace(/(^|[^\[])\^/g,"$1"),e=e.replace(r,i),n):new RegExp(e,t)}}function l(){}function c(e){for(var t,n,r=arguments,i=1;iAn error occured:"+o(e.message+"",!0)+" ";throw e}}var d={newline:/^\n+/,code:/^( {4}[^\n]+\n*)+/,fences:l,hr:/^( *[-*_]){3,} *(?:\n+|$)/,heading:/^ *(#{1,6}) *([^\n]+?) *#* *(?:\n+|$)/,nptable:l,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:/^ *\[([^\]]+)\]: *([^\s>]+)>?(?: +["(]([^\n]+)[")])? *(?:\n+|$)/,table:l,paragraph:/^((?:[^\n]+\n?(?!hr|heading|lheading|blockquote|tag|def))+)\n*/,text:/^[^\n]+/};d.bullet=/(?:[*+-]|\d+\.)/,d.item=/^( *)(bull) [^\n]*(?:\n(?!\1bull )[^\n]*)*/,d.item=s(d.item,"gm")(/bull/g,d.bullet)(),d.list=s(d.list)(/bull/g,d.bullet)("hr","\\n+(?=\\1?(?:[-*_] *){3,}(?:\\n+|$))")("def","\\n+(?="+d.def.source+")")(),d.blockquote=s(d.blockquote)("def",d.def)(),d._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",d.html=s(d.html)("comment",//)("closed",/<(tag)[\s\S]+?<\/\1>/)("closing",/])*?>/)(/tag/g,d._tag)(),d.paragraph=s(d.paragraph)("hr",d.hr)("heading",d.heading)("lheading",d.lheading)("blockquote",d.blockquote)("tag","<"+d._tag)("def",d.def)(),d.normal=c({},d),d.gfm=c({},d.normal,{fences:/^ *(`{3,}|~{3,})[ \.]*(\S+)? *\n([\s\S]*?)\s*\1 *(?:\n+|$)/,paragraph:/^/,heading:/^ *(#{1,6}) +([^\n]+?) *#* *(?:\n+|$)/}),d.gfm.paragraph=s(d.paragraph)("(?!","(?!"+d.gfm.fences.source.replace("\\1","\\2")+"|"+d.list.source.replace("\\1","\\3")+"|")(),d.tables=c({},d.gfm,{nptable:/^ *(\S.*\|.*)\n *([-:]+ *\|[-| :]*)\n((?:.*\|.*(?:\n|$))*)\n*/,table:/^ *\|(.+)\n *\|( *[-:]+[-| :]*)\n((?: *\|.*(?:\n|$))*)\n*/}),t.rules=d,t.lex=function(e,n){var r=new t(n);return r.lex(e)},t.prototype.lex=function(e){return e=e.replace(/\r\n|\r/g,"\n").replace(/\t/g," ").replace(/\u00a0/g," ").replace(/\u2424/g,"\n"),this.token(e,!0)},t.prototype.token=function(e,t,n){for(var r,i,o,a,s,l,c,u,p,h=this,e=e.replace(/^ +$/gm,"");e;)if((o=h.rules.newline.exec(e))&&(e=e.substring(o[0].length),o[0].length>1&&h.tokens.push({type:"space"})),o=h.rules.code.exec(e))e=e.substring(o[0].length),o=o[0].replace(/^ {4}/gm,""),h.tokens.push({type:"code",text:h.options.pedantic?o:o.replace(/\n+$/,"")});else if(o=h.rules.fences.exec(e))e=e.substring(o[0].length),h.tokens.push({type:"code",lang:o[2],text:o[3]||""});else if(o=h.rules.heading.exec(e))e=e.substring(o[0].length),h.tokens.push({type:"heading",depth:o[1].length,text:o[2]});else if(t&&(o=h.rules.nptable.exec(e))){for(e=e.substring(o[0].length),l={type:"table",header:o[1].replace(/^ *| *\| *$/g,"").split(/ *\| */),align:o[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:o[3].replace(/\n$/,"").split("\n")},u=0;u ?/gm,""),h.token(o,t,!0),h.tokens.push({type:"blockquote_end"});else if(o=h.rules.list.exec(e)){for(e=e.substring(o[0].length),a=o[2],h.tokens.push({type:"list_start",ordered:a.length>1}),o=o[0].match(h.rules.item),r=!1,p=o.length,u=0;u1&&s.length>1||(e=o.slice(u+1).join("\n")+e,u=p-1)),i=r||/\n\n(?!\s*$)/.test(l),u!==p-1&&(r="\n"===l.charAt(l.length-1),i||(i=r)),h.tokens.push({type:i?"loose_item_start":"list_item_start"}),h.token(l,!1,n),h.tokens.push({type:"list_item_end"});h.tokens.push({type:"list_end"})}else if(o=h.rules.html.exec(e))e=e.substring(o[0].length),h.tokens.push({type:h.options.sanitize?"paragraph":"html",pre:!h.options.sanitizer&&("pre"===o[1]||"script"===o[1]||"style"===o[1]),text:o[0]});else if(!n&&t&&(o=h.rules.def.exec(e)))e=e.substring(o[0].length),h.tokens.links[o[1].toLowerCase()]={href:o[2],title:o[3]};else if(t&&(o=h.rules.table.exec(e))){for(e=e.substring(o[0].length),l={type:"table",header:o[1].replace(/^ *| *\| *$/g,"").split(/ *\| */),align:o[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:o[3].replace(/(?: *\| *)?\n$/,"").split("\n")},u=0;u])/,autolink:/^<([^ >]+(@|:\/)[^ >]+)>/,url:l,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:l,text:/^[\s\S]+?(?=[\\?(?:\s+['"]([\s\S]*?)['"])?\s*/,p.link=s(p.link)("inside",p._inside)("href",p._href)(),p.reflink=s(p.reflink)("inside",p._inside)(),p.normal=c({},p),p.pedantic=c({},p.normal,{strong:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,em:/^_(?=\S)([\s\S]*?\S)_(?!_)|^\*(?=\S)([\s\S]*?\S)\*(?!\*)/}),p.gfm=c({},p.normal,{escape:s(p.escape)("])","~|])")(),url:/^(https?:\/\/[^\s<]+[^<.,:;"')\]\s])/,del:/^~~(?=\S)([\s\S]*?\S)~~/,text:s(p.text)("]|","~]|")("|","|https?://|")()}),p.breaks=c({},p.gfm,{br:s(p.br)("{2,}","*")(),text:s(p.gfm.text)("{2,}","*")()}),n.rules=p,n.output=function(e,t,r){var i=new n(t,r);return i.output(e)},n.prototype.output=function(e){for(var t,n,r,i,a=this,s="";e;)if(i=a.rules.escape.exec(e))e=e.substring(i[0].length),s+=i[1];else if(i=a.rules.autolink.exec(e))e=e.substring(i[0].length),"@"===i[2]?(n=":"===i[1].charAt(6)?a.mangle(i[1].substring(7)):a.mangle(i[1]),r=a.mangle("mailto:")+n):(n=o(i[1]),r=n),s+=a.renderer.link(r,null,n);else if(a.inLink||!(i=a.rules.url.exec(e))){if(i=a.rules.tag.exec(e))!a.inLink&&/^/i.test(i[0])&&(a.inLink=!1),e=e.substring(i[0].length),s+=a.options.sanitize?a.options.sanitizer?a.options.sanitizer(i[0]):o(i[0]):i[0];else if(i=a.rules.link.exec(e))e=e.substring(i[0].length),a.inLink=!0,s+=a.outputLink(i,{href:i[2],title:i[3]}),a.inLink=!1;else if((i=a.rules.reflink.exec(e))||(i=a.rules.nolink.exec(e))){if(e=e.substring(i[0].length),t=(i[2]||i[1]).replace(/\s+/g," "),t=a.links[t.toLowerCase()],!t||!t.href){s+=i[0].charAt(0),e=i[0].substring(1)+e;continue}a.inLink=!0,s+=a.outputLink(i,t),a.inLink=!1}else if(i=a.rules.strong.exec(e))e=e.substring(i[0].length),s+=a.renderer.strong(a.output(i[2]||i[1]));else if(i=a.rules.em.exec(e))e=e.substring(i[0].length),s+=a.renderer.em(a.output(i[2]||i[1]));else if(i=a.rules.code.exec(e))e=e.substring(i[0].length),s+=a.renderer.codespan(o(i[2],!0));else if(i=a.rules.br.exec(e))e=e.substring(i[0].length),s+=a.renderer.br();else if(i=a.rules.del.exec(e))e=e.substring(i[0].length),s+=a.renderer.del(a.output(i[1]));else if(i=a.rules.text.exec(e))e=e.substring(i[0].length),s+=a.renderer.text(o(a.smartypants(i[0])));else if(e)throw new Error("Infinite loop on byte: "+e.charCodeAt(0))}else e=e.substring(i[0].length),n=o(i[1]),r=n,s+=a.renderer.link(r,null,n);return s},n.prototype.outputLink=function(e,t){var n=o(t.href),r=t.title?o(t.title):null;return"!"!==e[0].charAt(0)?this.renderer.link(n,r,this.output(e[1])):this.renderer.image(n,r,o(e[1]))},n.prototype.smartypants=function(e){return this.options.smartypants?e.replace(/---/g,"—").replace(/--/g,"–").replace(/(^|[-\u2014\/(\[{"\s])'/g,"$1‘").replace(/'/g,"’").replace(/(^|[-\u2014\/(\[{\u2018\s])"/g,"$1“").replace(/"/g,"”").replace(/\.{3}/g,"…"):e},n.prototype.mangle=function(e){if(!this.options.mangle)return e;for(var t,n="",r=e.length,i=0;i.5&&(t="x"+t.toString(16)),n+=""+t+";";return n},r.prototype.code=function(e,t,n){if(this.options.highlight){var r=this.options.highlight(e,t);null!=r&&r!==e&&(n=!0,e=r)}return t?''+(n?e:o(e,!0))+"\n \n":""+(n?e:o(e,!0))+"\n "},r.prototype.blockquote=function(e){return"\n"+e+" \n"},r.prototype.html=function(e){return e},r.prototype.heading=function(e,t,n){return"\n"},r.prototype.hr=function(){return this.options.xhtml?" \n":" \n"},r.prototype.list=function(e,t){var n=t?"ol":"ul";return"<"+n+">\n"+e+""+n+">\n"},r.prototype.listitem=function(e){return""+e+" \n"},r.prototype.paragraph=function(e){return""+e+"
\n"},r.prototype.table=function(e,t){return"\n"},r.prototype.tablerow=function(e){return"\n"+e+" \n"},r.prototype.tablecell=function(e,t){var n=t.header?"th":"td",r=t.align?"<"+n+' style="text-align:'+t.align+'">':"<"+n+">";return r+e+""+n+">\n"},r.prototype.strong=function(e){return""+e+" "},r.prototype.em=function(e){return""+e+" "},r.prototype.codespan=function(e){return""+e+""},r.prototype.br=function(){return this.options.xhtml?" ":" "},r.prototype.del=function(e){return""+e+""},r.prototype.link=function(e,t,n){if(this.options.sanitize){try{var r=decodeURIComponent(a(e)).replace(/[^\w:]/g,"").toLowerCase()}catch(e){return""}if(0===r.indexOf("javascript:")||0===r.indexOf("vbscript:"))return""}var i='"+n+" "},r.prototype.image=function(e,t,n){var r=' ":">"},r.prototype.text=function(e){return e},i.parse=function(e,t,n){var r=new i(t,n);return r.parse(e)},i.prototype.parse=function(e){var t=this;this.inline=new n(e.links,this.options,this.renderer),this.tokens=e.reverse();for(var r="";this.next();)r+=t.tok();return r},i.prototype.next=function(){return this.token=this.tokens.pop()},i.prototype.peek=function(){return this.tokens[this.tokens.length-1]||0},i.prototype.parseText=function(){for(var e=this,t=this.token.text;"text"===this.peek().type;)t+="\n"+e.next().text;return this.inline.output(t)},i.prototype.tok=function(){var e=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 t,n,r,i,o,a="",s="";for(r="",t=0;te.length)break e;if(!(v instanceof i)){u.lastIndex=0;var k=u.exec(v),w=1;if(!k&&h&&y!=o.length-1){if(u.lastIndex=b,k=u.exec(e),!k)break;for(var x=k.index+(p?k[1].length:0),L=k.index+k[0].length,S=y,$=b,_=o.length;S<_&&$=$&&(++y,b=$);if(o[y]instanceof i||o[S-1].greedy)continue;w=S-y,v=e.slice(b,$),k.index-=b}if(k){p&&(g=k[1].length);var x=k.index+g,k=k[0].slice(g),L=x+k.length,C=v.slice(0,x),E=v.slice(L),A=[y,w];C&&A.push(C);var T=new i(s,d?r.tokenize(k,d):k,f,k,h);A.push(T),E&&A.push(E),Array.prototype.splice.apply(o,A)}}}}}return o},hooks:{all:{},add:function(e,t){var n=r.hooks.all;n[e]=n[e]||[],n[e].push(t)},run:function(e,t){var n=r.hooks.all[e];if(n&&n.length)for(var i,o=0;i=n[o++];)i(t)}}},i=r.Token=function(e,t,n,r,i){this.type=e,this.content=t,this.alias=n,this.length=0|(r||"").length,this.greedy=!!i};if(i.stringify=function(e,t,n){if("string"==typeof e)return e;if("Array"===r.util.type(e))return e.map(function(n){return i.stringify(n,t,e)}).join("");var o={type:e.type,content:i.stringify(e.content,t,n),tag:"span",classes:["token",e.type],attributes:{},language:t,parent:n};if("comment"==o.type&&(o.attributes.spellcheck="true"),e.alias){var a="Array"===r.util.type(e.alias)?e.alias:[e.alias];Array.prototype.push.apply(o.classes,a)}r.hooks.run("wrap",o);var s=Object.keys(o.attributes).map(function(e){return e+'="'+(o.attributes[e]||"").replace(/"/g,""")+'"'}).join(" ");return"<"+o.tag+' class="'+o.classes.join(" ")+'"'+(s?" "+s:"")+">"+o.content+""+o.tag+">"},!t.document)return t.addEventListener?(t.addEventListener("message",function(e){var n=JSON.parse(e.data),i=n.language,o=n.code,a=n.immediateClose;
+t.postMessage(r.highlight(o,r.languages[i],i)),a&&t.close()},!1),t.Prism):t.Prism;var o=document.currentScript||[].slice.call(document.getElementsByTagName("script")).pop();return o&&(r.filename=o.src,document.addEventListener&&!o.hasAttribute("data-manual")&&("loading"!==document.readyState?window.requestAnimationFrame?window.requestAnimationFrame(r.highlightAll):window.setTimeout(r.highlightAll,16):document.addEventListener("DOMContentLoaded",r.highlightAll))),t.Prism}();e.exports&&(e.exports=n),"undefined"!=typeof I&&(I.Prism=n),n.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},n.hooks.add("wrap",function(e){"entity"===e.type&&(e.attributes.title=e.content.replace(/&/,"&"))}),n.languages.xml=n.languages.markup,n.languages.html=n.languages.markup,n.languages.mathml=n.languages.markup,n.languages.svg=n.languages.markup,n.languages.css={comment:/\/\*[\w\W]*?\*\//,atrule:{pattern:/@[\w-]+?.*?(;|(?=\s*\{))/i,inside:{rule:/@[\w-]+/}},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:!0},property:/(\b|\B)[\w-]+(?=\s*:)/i,important:/\B!important\b/i,function:/[-a-z0-9]+(?=\()/i,punctuation:/[(){};:]/},n.languages.css.atrule.inside.rest=n.util.clone(n.languages.css),n.languages.markup&&(n.languages.insertBefore("markup","tag",{style:{pattern:/(`
-}
diff --git a/src/core/router/history/abstract.js b/src/core/router/history/abstract.js
deleted file mode 100644
index 2c0bd95..0000000
--- a/src/core/router/history/abstract.js
+++ /dev/null
@@ -1,25 +0,0 @@
-import {History} from './base'
-import {parseQuery} from '../util'
-
-export class AbstractHistory extends History {
- constructor(config) {
- super(config)
- this.mode = 'abstract'
- }
-
- parse(path) {
- let query = ''
-
- const queryIndex = path.indexOf('?')
- if (queryIndex >= 0) {
- query = path.slice(queryIndex + 1)
- path = path.slice(0, queryIndex)
- }
-
- return {
- path,
- file: this.getFile(path),
- query: parseQuery(query)
- }
- }
-}
diff --git a/src/core/router/history/base.js b/src/core/router/history/base.js
deleted file mode 100644
index 7ea763d..0000000
--- a/src/core/router/history/base.js
+++ /dev/null
@@ -1,86 +0,0 @@
-import {
- getPath,
- isAbsolutePath,
- stringifyQuery,
- cleanPath,
- replaceSlug,
- resolvePath
-} from '../util'
-import {noop, merge} from '../../util/core'
-
-const cached = {}
-
-function getAlias(path, alias, last) {
- const match = Object.keys(alias).filter(key => {
- const re = cached[key] || (cached[key] = new RegExp(`^${key}$`))
- return re.test(path) && path !== last
- })[0]
-
- return match ?
- getAlias(path.replace(cached[match], alias[match]), alias, path) :
- path
-}
-
-function getFileName(path, ext) {
- return new RegExp(`\\.(${ext.replace(/^\./, '')}|html)$`, 'g').test(path) ?
- path :
- /\/$/g.test(path) ? `${path}README${ext}` : `${path}${ext}`
-}
-
-export class History {
- constructor(config) {
- this.config = config
- }
-
- getBasePath() {
- return this.config.basePath
- }
-
- getFile(path = this.getCurrentPath(), isRelative) {
- const {config} = this
- const base = this.getBasePath()
- const ext = typeof config.ext === 'string' ? config.ext : '.md'
-
- path = config.alias ? getAlias(path, config.alias) : path
- path = getFileName(path, ext)
- path = path === `/README${ext}` ? config.homepage || path : path
- path = isAbsolutePath(path) ? path : getPath(base, path)
-
- if (isRelative) {
- path = path.replace(new RegExp(`^${base}`), '')
- }
-
- return path
- }
-
- onchange(cb = noop) {
- cb()
- }
-
- getCurrentPath() {}
-
- normalize() {}
-
- parse() {}
-
- toURL(path, params, currentRoute) {
- const local = currentRoute && path[0] === '#'
- const route = this.parse(replaceSlug(path))
-
- route.query = merge({}, route.query, params)
- path = route.path + stringifyQuery(route.query)
- path = path.replace(/\.md(\?)|\.md$/, '$1')
-
- if (local) {
- const idIndex = currentRoute.indexOf('?')
- path =
- (idIndex > 0 ? currentRoute.substring(0, idIndex) : currentRoute) + path
- }
-
- if (this.config.relativePath && path.indexOf('/') !== 0) {
- const currentDir = currentRoute.substring(0, currentRoute.lastIndexOf('/') + 1)
- return cleanPath(resolvePath(currentDir + path))
- }
- return cleanPath('/' + path)
- }
-}
diff --git a/src/core/router/history/hash.js b/src/core/router/history/hash.js
deleted file mode 100644
index 2674d5d..0000000
--- a/src/core/router/history/hash.js
+++ /dev/null
@@ -1,76 +0,0 @@
-import {History} from './base'
-import {noop} from '../../util/core'
-import {on} from '../../util/dom'
-import {parseQuery, cleanPath, replaceSlug} from '../util'
-
-function replaceHash(path) {
- const i = location.href.indexOf('#')
- location.replace(location.href.slice(0, i >= 0 ? i : 0) + '#' + path)
-}
-
-export class HashHistory extends History {
- constructor(config) {
- super(config)
- this.mode = 'hash'
- }
-
- getBasePath() {
- const path = window.location.pathname || ''
- const base = this.config.basePath
-
- return /^(\/|https?:)/g.test(base) ? base : cleanPath(path + '/' + base)
- }
-
- getCurrentPath() {
- // We can't use location.hash here because it's not
- // consistent across browsers - Firefox will pre-decode it!
- const href = location.href
- const index = href.indexOf('#')
- return index === -1 ? '' : href.slice(index + 1)
- }
-
- onchange(cb = noop) {
- on('hashchange', cb)
- }
-
- normalize() {
- let path = this.getCurrentPath()
-
- path = replaceSlug(path)
-
- if (path.charAt(0) === '/') {
- return replaceHash(path)
- }
- replaceHash('/' + path)
- }
-
- /**
- * Parse the url
- * @param {string} [path=location.herf]
- * @return {object} { path, query }
- */
- parse(path = location.href) {
- let query = ''
-
- const hashIndex = path.indexOf('#')
- if (hashIndex >= 0) {
- path = path.slice(hashIndex + 1)
- }
-
- const queryIndex = path.indexOf('?')
- if (queryIndex >= 0) {
- query = path.slice(queryIndex + 1)
- path = path.slice(0, queryIndex)
- }
-
- return {
- path,
- file: this.getFile(path, true),
- query: parseQuery(query)
- }
- }
-
- toURL(path, params, currentRoute) {
- return '#' + super.toURL(path, params, currentRoute)
- }
-}
diff --git a/src/core/router/history/html5.js b/src/core/router/history/html5.js
deleted file mode 100644
index 04c5391..0000000
--- a/src/core/router/history/html5.js
+++ /dev/null
@@ -1,65 +0,0 @@
-import {History} from './base'
-import {noop} from '../../util/core'
-import {on} from '../../util/dom'
-import {parseQuery, getPath} from '../util'
-
-export class HTML5History extends History {
- constructor(config) {
- super(config)
- this.mode = 'history'
- }
-
- getCurrentPath() {
- const base = this.getBasePath()
- let path = window.location.pathname
-
- if (base && path.indexOf(base) === 0) {
- path = path.slice(base.length)
- }
-
- return (path || '/') + window.location.search + window.location.hash
- }
-
- onchange(cb = noop) {
- on('click', e => {
- const el = e.target.tagName === 'A' ? e.target : e.target.parentNode
-
- if (el.tagName === 'A' && !/_blank/.test(el.target)) {
- e.preventDefault()
- const url = el.href
- window.history.pushState({key: url}, '', url)
- cb()
- }
- })
-
- on('popstate', cb)
- }
-
- /**
- * Parse the url
- * @param {string} [path=location.href]
- * @return {object} { path, query }
- */
- parse(path = location.href) {
- let query = ''
-
- const queryIndex = path.indexOf('?')
- if (queryIndex >= 0) {
- query = path.slice(queryIndex + 1)
- path = path.slice(0, queryIndex)
- }
-
- const base = getPath(location.origin)
- const baseIndex = path.indexOf(base)
-
- if (baseIndex > -1) {
- path = path.slice(baseIndex + base.length)
- }
-
- return {
- path,
- file: this.getFile(path),
- query: parseQuery(query)
- }
- }
-}
diff --git a/src/core/router/index.js b/src/core/router/index.js
deleted file mode 100644
index 943fe6c..0000000
--- a/src/core/router/index.js
+++ /dev/null
@@ -1,45 +0,0 @@
-import {HashHistory} from './history/hash'
-import {HTML5History} from './history/html5'
-import {supportsPushState} from '../util/env'
-import * as dom from '../util/dom'
-
-export function routerMixin(proto) {
- proto.route = {}
-}
-
-let lastRoute = {}
-
-function updateRender(vm) {
- vm.router.normalize()
- vm.route = vm.router.parse()
- dom.body.setAttribute('data-page', vm.route.file)
-}
-
-export function initRouter(vm) {
- const config = vm.config
- const mode = config.routerMode || 'hash'
- let router
-
- if (mode === 'history' && supportsPushState) {
- router = new HTML5History(config)
- } else {
- router = new HashHistory(config)
- }
-
- vm.router = router
- updateRender(vm)
- lastRoute = vm.route
-
- router.onchange(_ => {
- updateRender(vm)
- vm._updateRender()
-
- if (lastRoute.path === vm.route.path) {
- vm.$resetEvents()
- return
- }
-
- vm.$fetch()
- lastRoute = vm.route
- })
-}
diff --git a/src/core/router/util.js b/src/core/router/util.js
deleted file mode 100644
index 2ed88c5..0000000
--- a/src/core/router/util.js
+++ /dev/null
@@ -1,76 +0,0 @@
-import {cached} from '../util/core'
-
-const decode = decodeURIComponent
-const encode = encodeURIComponent
-
-export function parseQuery(query) {
- const res = {}
-
- query = query.trim().replace(/^(\?|#|&)/, '')
-
- if (!query) {
- return res
- }
-
- // Simple parse
- query.split('&').forEach(function (param) {
- const parts = param.replace(/\+/g, ' ').split('=')
-
- res[parts[0]] = parts[1] && decode(parts[1])
- })
-
- return res
-}
-
-export function stringifyQuery(obj, ignores = []) {
- const qs = []
-
- for (const key in obj) {
- if (ignores.indexOf(key) > -1) {
- continue
- }
- qs.push(
- obj[key] ?
- `${encode(key)}=${encode(obj[key])}`.toLowerCase() :
- encode(key)
- )
- }
-
- return qs.length ? `?${qs.join('&')}` : ''
-}
-
-export const isAbsolutePath = cached(path => {
- return /(:|(\/{2}))/g.test(path)
-})
-
-export const getParentPath = cached(path => {
- return /\/$/g.test(path) ?
- path :
- (path = path.match(/(\S*\/)[^/]+$/)) ? path[1] : ''
-})
-
-export const cleanPath = cached(path => {
- return path.replace(/^\/+/, '/').replace(/([^:])\/{2,}/g, '$1/')
-})
-
-export const resolvePath = cached(path => {
- const segments = path.replace(/^\//, '').split('/')
- let resolved = []
- for (let i = 0, len = segments.length; i < len; i++) {
- const segment = segments[i]
- if (segment === '..') {
- resolved.pop()
- } else if (segment !== '.') {
- resolved.push(segment)
- }
- }
- return '/' + resolved.join('/')
-})
-
-export function getPath(...args) {
- return cleanPath(args.join('/'))
-}
-
-export const replaceSlug = cached(path => {
- return path.replace('#', '?id=')
-})
diff --git a/src/core/util/core.js b/src/core/util/core.js
deleted file mode 100644
index a94472d..0000000
--- a/src/core/util/core.js
+++ /dev/null
@@ -1,58 +0,0 @@
-/**
- * Create a cached version of a pure function.
- */
-export function cached(fn) {
- const cache = Object.create(null)
- return function (str) {
- const key = isPrimitive(str) ? str : JSON.stringify(str)
- const hit = cache[key]
- return hit || (cache[key] = fn(str))
- }
-}
-
-/**
- * Hyphenate a camelCase string.
- */
-export const hyphenate = cached(str => {
- return str.replace(/([A-Z])/g, m => '-' + m.toLowerCase())
-})
-
-export const hasOwn = Object.prototype.hasOwnProperty
-
-/**
- * Simple Object.assign polyfill
- */
-export const merge =
- Object.assign ||
- function (to) {
- for (let i = 1; i < arguments.length; i++) {
- const from = Object(arguments[i])
-
- for (const key in from) {
- if (hasOwn.call(from, key)) {
- to[key] = from[key]
- }
- }
- }
-
- return to
- }
-
-/**
- * Check if value is primitive
- */
-export function isPrimitive(value) {
- return typeof value === 'string' || typeof value === 'number'
-}
-
-/**
- * Perform no operation.
- */
-export function noop() {}
-
-/**
- * Check if value is function
- */
-export function isFn(obj) {
- return typeof obj === 'function'
-}
diff --git a/src/core/util/dom.js b/src/core/util/dom.js
deleted file mode 100644
index 388927d..0000000
--- a/src/core/util/dom.js
+++ /dev/null
@@ -1,92 +0,0 @@
-import {isFn} from '../util/core'
-import {inBrowser} from './env'
-
-const cacheNode = {}
-
-/**
- * Get Node
- * @param {String|Element} el
- * @param {Boolean} noCache
- * @return {Element}
- */
-export function getNode(el, noCache = false) {
- if (typeof el === 'string') {
- if (typeof window.Vue !== 'undefined') {
- return find(el)
- }
- el = noCache ? find(el) : cacheNode[el] || (cacheNode[el] = find(el))
- }
-
- return el
-}
-
-export const $ = inBrowser && document
-
-export const body = inBrowser && $.body
-
-export const head = inBrowser && $.head
-
-/**
- * Find element
- * @example
- * find('nav') => document.querySelector('nav')
- * find(nav, 'a') => nav.querySelector('a')
- */
-export function find(el, node) {
- return node ? el.querySelector(node) : $.querySelector(el)
-}
-
-/**
- * Find all elements
- * @example
- * findAll('a') => [].slice.call(document.querySelectorAll('a'))
- * findAll(nav, 'a') => [].slice.call(nav.querySelectorAll('a'))
- */
-export function findAll(el, node) {
- return [].slice.call(
- node ? el.querySelectorAll(node) : $.querySelectorAll(el)
- )
-}
-
-export function create(node, tpl) {
- node = $.createElement(node)
- if (tpl) {
- node.innerHTML = tpl
- }
- return node
-}
-
-export function appendTo(target, el) {
- return target.appendChild(el)
-}
-
-export function before(target, el) {
- return target.insertBefore(el, target.children[0])
-}
-
-export function on(el, type, handler) {
- isFn(type) ?
- window.addEventListener(el, type) :
- el.addEventListener(type, handler)
-}
-
-export function off(el, type, handler) {
- isFn(type) ?
- window.removeEventListener(el, type) :
- el.removeEventListener(type, handler)
-}
-
-/**
- * Toggle class
- *
- * @example
- * toggleClass(el, 'active') => el.classList.toggle('active')
- * toggleClass(el, 'add', 'active') => el.classList.add('active')
- */
-export function toggleClass(el, type, val) {
- el && el.classList[val ? type : 'toggle'](val || type)
-}
-
-export function style(content) {
- appendTo(head, create('style', content))
-}
diff --git a/src/core/util/env.js b/src/core/util/env.js
deleted file mode 100644
index cd51635..0000000
--- a/src/core/util/env.js
+++ /dev/null
@@ -1,21 +0,0 @@
-export const inBrowser = !process.env.SSR
-
-export const isMobile = inBrowser && document.body.clientWidth <= 600
-
-/**
- * @see https://github.com/MoOx/pjax/blob/master/lib/is-supported.js
- */
-export const supportsPushState =
- inBrowser &&
- (function () {
- // Borrowed wholesale from https://github.com/defunkt/jquery-pjax
- return (
- window.history &&
- window.history.pushState &&
- window.history.replaceState &&
- // PushState isn’t reliable on iOS until 5.
- !navigator.userAgent.match(
- /((iPod|iPhone|iPad).+\bOS\s+[1-4]\D|WebApps\/.+CFNetwork)/
- )
- )
- })()
diff --git a/src/core/util/index.js b/src/core/util/index.js
deleted file mode 100644
index eba6598..0000000
--- a/src/core/util/index.js
+++ /dev/null
@@ -1,3 +0,0 @@
-export * from './core'
-export * from './env'
-export * from '../router/util'
diff --git a/src/core/util/polyfill/css-vars.js b/src/core/util/polyfill/css-vars.js
deleted file mode 100644
index fb3a80a..0000000
--- a/src/core/util/polyfill/css-vars.js
+++ /dev/null
@@ -1,36 +0,0 @@
-import * as dom from '../dom'
-import {get} from '../../fetch/ajax'
-
-function replaceVar(block, color) {
- block.innerHTML = block.innerHTML.replace(
- /var\(\s*--theme-color.*?\)/g,
- color
- )
-}
-
-export default function (color) {
- // Variable support
- if (window.CSS && window.CSS.supports && window.CSS.supports('(--v:red)')) {
- return
- }
-
- const styleBlocks = dom.findAll('style:not(.inserted),link');
- [].forEach.call(styleBlocks, block => {
- if (block.nodeName === 'STYLE') {
- replaceVar(block, color)
- } else if (block.nodeName === 'LINK') {
- const href = block.getAttribute('href')
-
- if (!/\.css$/.test(href)) {
- return
- }
-
- get(href).then(res => {
- const style = dom.create('style', res)
-
- dom.head.appendChild(style)
- replaceVar(style, color)
- })
- }
- })
-}
diff --git a/src/event.js b/src/event.js
new file mode 100644
index 0000000..536899c
--- /dev/null
+++ b/src/event.js
@@ -0,0 +1,159 @@
+import { isMobile } from './util'
+
+/**
+ * Active sidebar when scroll
+ * @link https://buble.surge.sh/
+ */
+export function scrollActiveSidebar () {
+ if (isMobile()) return
+
+ let hoveredOverSidebar = false
+ const anchors = document.querySelectorAll('.anchor')
+ const sidebar = document.querySelector('.sidebar')
+ const sidebarContainer = sidebar.querySelector('.sidebar-nav')
+ const sidebarHeight = sidebar.clientHeight
+
+ const nav = {}
+ const lis = sidebar.querySelectorAll('li')
+ let active = sidebar.querySelector('li.active')
+
+ for (let i = 0, len = lis.length; i < len; i += 1) {
+ const li = lis[i]
+ const a = li.querySelector('a')
+ if (!a) continue
+ let href = a.getAttribute('href')
+
+ if (href !== '/') {
+ const match = href.match('#([^#]+)$')
+ if (match && match.length) href = match[0].slice(1)
+ }
+
+ nav[decodeURIComponent(href)] = li
+ }
+
+ function highlight () {
+ const top = document.body.scrollTop
+ let last
+
+ for (let i = 0, len = anchors.length; i < len; i += 1) {
+ const node = anchors[i]
+
+ if (node.offsetTop > top) {
+ if (!last) last = node
+ break
+ } else {
+ last = node
+ }
+ }
+ if (!last) return
+ const li = nav[last.getAttribute('data-id')]
+
+ if (!li || li === active) return
+ if (active) active.classList.remove('active')
+
+ li.classList.add('active')
+ active = li
+
+ // scroll into view
+ // https://github.com/vuejs/vuejs.org/blob/master/themes/vue/source/js/common.js#L282-L297
+ if (!hoveredOverSidebar && !sticky.noSticky) {
+ const currentPageOffset = 0
+ const currentActiveOffset = active.offsetTop + active.clientHeight + 40
+ const currentActiveIsInView = (
+ active.offsetTop >= sidebarContainer.scrollTop &&
+ currentActiveOffset <= sidebarContainer.scrollTop + sidebarHeight
+ )
+ const linkNotFurtherThanSidebarHeight = currentActiveOffset - currentPageOffset < sidebarHeight
+ const newScrollTop = currentActiveIsInView
+ ? sidebarContainer.scrollTop
+ : linkNotFurtherThanSidebarHeight
+ ? currentPageOffset
+ : currentActiveOffset - sidebarHeight
+
+ sidebar.scrollTop = newScrollTop
+ }
+ }
+
+ window.removeEventListener('scroll', highlight)
+ window.addEventListener('scroll', highlight)
+ sidebar.addEventListener('mouseover', () => { hoveredOverSidebar = true })
+ sidebar.addEventListener('mouseleave', () => { hoveredOverSidebar = false })
+}
+
+export function scrollIntoView () {
+ const id = window.location.hash.match(/#[^#\/]+$/g)
+ if (!id || !id.length) return
+ const section = document.querySelector(decodeURIComponent(id[0]))
+
+ if (section) setTimeout(() => section.scrollIntoView(), 0)
+
+ return section
+}
+
+/**
+ * Acitve link
+ */
+export function activeLink (dom, activeParent) {
+ const host = window.location.href
+
+ dom = typeof dom === 'object' ? dom : document.querySelector(dom)
+ if (!dom) return
+ let target
+
+ ;[].slice.call(dom.querySelectorAll('a'))
+ .sort((a, b) => b.href.length - a.href.length)
+ .forEach(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
+ */
+export function bindToggle (dom) {
+ dom = typeof dom === 'object' ? dom : document.querySelector(dom)
+ if (!dom) return
+ const body = document.body
+
+ dom.addEventListener('click', () => body.classList.toggle('close'))
+
+ if (isMobile()) {
+ const sidebar = document.querySelector('.sidebar')
+ sidebar.addEventListener('click', () => {
+ body.classList.toggle('close')
+ setTimeout(() => activeLink(sidebar, true), 0)
+ })
+ }
+}
+
+const scrollingElement = document.scrollingElement || document.documentElement
+
+export function scroll2Top (offset = 0) {
+ scrollingElement.scrollTop = offset === true ? 0 : Number(offset)
+}
+
+export function sticky () {
+ sticky.dom = sticky.dom || document.querySelector('section.cover')
+ const 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
+ }
+ })()
+}
diff --git a/src/hook.js b/src/hook.js
new file mode 100644
index 0000000..401765a
--- /dev/null
+++ b/src/hook.js
@@ -0,0 +1,57 @@
+export default class Hook {
+ constructor () {
+ this.beforeHooks = []
+ this.afterHooks = []
+ this.initHooks = []
+ this.readyHooks = []
+ this.doneEachHooks = []
+ }
+
+ beforeEach (fn) {
+ this.beforeHooks.push(fn)
+ }
+
+ afterEach (fn) {
+ this.afterHooks.push(fn)
+ }
+
+ doneEach (fn) {
+ this.doneEachHooks.push(fn)
+ }
+
+ init (fn) {
+ this.initHooks.push(fn)
+ }
+
+ ready (fn) {
+ this.readyHooks.push(fn)
+ }
+
+ emit (name, data, next) {
+ let newData = data
+ const queue = this[name + 'Hooks']
+ const step = function (index) {
+ const hook = queue[index]
+ if (index >= queue.length) {
+ next && next(newData)
+ } else {
+ if (typeof hook === 'function') {
+ if (hook.length === 2) {
+ hook(data, result => {
+ newData = result
+ step(index + 1)
+ })
+ } else {
+ const result = hook(data)
+ newData = result !== undefined ? result : newData
+ step(index + 1)
+ }
+ } else {
+ step(index + 1)
+ }
+ }
+ }
+
+ step(0)
+ }
+}
diff --git a/src/index.js b/src/index.js
new file mode 100644
index 0000000..49dac57
--- /dev/null
+++ b/src/index.js
@@ -0,0 +1,145 @@
+import * as utils from './util'
+import { scrollIntoView, activeLink } from './event'
+import * as render from './render'
+import Hook from './hook'
+
+const OPTIONS = utils.merge({
+ el: '#app',
+ repo: '',
+ maxLevel: 6,
+ subMaxLevel: 0,
+ loadSidebar: null,
+ loadNavbar: null,
+ homepage: 'README.md',
+ coverpage: '',
+ basePath: '',
+ auto2top: false,
+ name: '',
+ themeColor: '',
+ nameLink: window.location.pathname,
+ ga: ''
+}, window.$docsify)
+const script = document.currentScript || [].slice.call(document.getElementsByTagName('script')).pop()
+
+// load configuration for script attribute
+if (script) {
+ for (const prop in OPTIONS) {
+ const val = script.getAttribute('data-' + utils.camel2kebab(prop))
+ OPTIONS[prop] = utils.isNil(val) ? OPTIONS[prop] : (val || true)
+ }
+ if (OPTIONS.loadSidebar === true) OPTIONS.loadSidebar = '_sidebar.md'
+ if (OPTIONS.loadNavbar === true) OPTIONS.loadNavbar = '_navbar.md'
+ if (OPTIONS.coverpage === true) OPTIONS.coverpage = '_coverpage.md'
+ if (OPTIONS.repo === true) OPTIONS.repo = ''
+ if (OPTIONS.name === true) OPTIONS.name = ''
+}
+
+const hook = new Hook()
+
+// utils
+window.$docsify = OPTIONS
+window.Docsify = {
+ installed: true,
+ utils: utils.merge({}, utils),
+ hook
+}
+
+// load options
+render.init()
+
+let cacheRoute = null
+let cacheXhr = null
+
+const getAlias = function (route) {
+ if (OPTIONS.alias[route]) {
+ return getAlias(OPTIONS.alias[route])
+ } else {
+ return route
+ }
+}
+
+const mainRender = function (cb) {
+ let page
+ let route = utils.getRoute()
+ if (cacheRoute === route) return cb()
+
+ let basePath = cacheRoute = OPTIONS.basePath + route
+
+ if (!/\//.test(basePath)) {
+ basePath = ''
+ } else if (basePath && !/\/$/.test(basePath)) {
+ basePath = basePath.match(/(\S*\/)[^\/]+$/)[1]
+ }
+
+ // replace route
+ if (OPTIONS.alias && OPTIONS.alias['/' + route]) {
+ route = getAlias('/' + route)
+ } else {
+ route = (OPTIONS.basePath + route).replace(/\/+/, '/')
+ }
+
+ if (!route) {
+ page = OPTIONS.homepage || 'README.md'
+ } else if (/\.md$/.test(route)) {
+ page = route
+ } else if (/\/$/.test(route)) {
+ page = `${route}README.md`
+ } else {
+ page = `${route}.md`
+ }
+
+ // Render Cover page
+ if (OPTIONS.coverpage && page === OPTIONS.homepage) {
+ utils.load(OPTIONS.coverpage).then(render.renderCover)
+ }
+
+ cacheXhr && cacheXhr.abort && cacheXhr.abort()
+ // Render markdown file
+ cacheXhr = utils.load(page, 'GET', render.renderLoading)
+ cacheXhr.then(result => {
+ render.renderArticle(result)
+ // clear cover
+ if (OPTIONS.coverpage && page !== OPTIONS.homepage) render.renderCover()
+ // render sidebar
+ if (OPTIONS.loadSidebar) {
+ const renderSidebar = result => { render.renderSidebar(result); cb() }
+
+ utils.load(basePath + OPTIONS.loadSidebar).then(renderSidebar,
+ _ => utils.load(OPTIONS.loadSidebar).then(renderSidebar))
+ } else {
+ cb()
+ }
+ }, _ => render.renderArticle(null))
+
+ // Render navbar
+ if (OPTIONS.loadNavbar) {
+ utils.load(basePath + OPTIONS.loadNavbar).then(render.renderNavbar,
+ _ => utils.load(OPTIONS.loadNavbar).then(render.renderNavbar))
+ }
+}
+
+const Docsify = function () {
+ setTimeout(_ => {
+ ;[].concat(OPTIONS.plugins).forEach(fn => typeof fn === 'function' && fn(hook))
+ window.Docsify.hook.emit('init')
+
+ const dom = document.querySelector(OPTIONS.el) || document.body
+ const replace = dom !== document.body
+ const main = function () {
+ mainRender(_ => {
+ scrollIntoView()
+ activeLink('nav')
+ window.Docsify.hook.emit('doneEach')
+ })
+ }
+
+ // Render app
+ render.renderApp(dom, replace)
+ main()
+ if (!/^#\//.test(window.location.hash)) window.location.hash = '#/'
+ window.addEventListener('hashchange', main)
+ window.Docsify.hook.emit('ready')
+ }, 0)
+}
+
+export default Docsify()
diff --git a/src/plugins/disqus.js b/src/plugins/disqus.js
deleted file mode 100644
index dba7aef..0000000
--- a/src/plugins/disqus.js
+++ /dev/null
@@ -1,51 +0,0 @@
-const fixedPath = location.href.replace('/-/', '/#/')
-if (fixedPath !== location.href) {
- location.href = fixedPath
-}
-
-function install(hook, vm) {
- const dom = Docsify.dom
- const disqus = vm.config.disqus
- if (!disqus) {
- throw Error('$docsify.disqus is required')
- }
-
- hook.init(_ => {
- const script = dom.create('script')
-
- script.async = true
- script.src = `https://${disqus}.disqus.com/embed.js`
- script.setAttribute('data-timestamp', Number(new Date()))
- dom.appendTo(dom.body, script)
- })
-
- hook.mounted(_ => {
- const div = dom.create('div')
- div.id = 'disqus_thread'
- const main = dom.getNode('#main')
- div.style = `width: ${main.clientWidth}px; margin: 0 auto 20px;`
- dom.appendTo(dom.find('.content'), div)
-
- // eslint-disable-next-line
- window.disqus_config = function() {
- this.page.url = location.origin + '/-' + vm.route.path
- this.page.identifier = vm.route.path
- this.page.title = document.title
- }
- })
-
- hook.doneEach(_ => {
- if (typeof window.DISQUS !== 'undefined') {
- window.DISQUS.reset({
- reload: true,
- config: function () {
- this.page.url = location.origin + '/-' + vm.route.path
- this.page.identifier = vm.route.path
- this.page.title = document.title
- }
- })
- }
- })
-}
-
-$docsify.plugins = [].concat(install, $docsify.plugins)
diff --git a/src/plugins/emoji.js b/src/plugins/emoji.js
deleted file mode 100644
index 31f1059..0000000
--- a/src/plugins/emoji.js
+++ /dev/null
@@ -1,900 +0,0 @@
-const AllGithubEmoji = [
- '+1',
- '100',
- '1234',
- '8ball',
- 'a',
- 'ab',
- 'abc',
- 'abcd',
- 'accept',
- 'aerial_tramway',
- 'airplane',
- 'alarm_clock',
- 'alien',
- 'ambulance',
- 'anchor',
- 'angel',
- 'anger',
- 'angry',
- 'anguished',
- 'ant',
- 'apple',
- 'aquarius',
- 'aries',
- 'arrow_backward',
- 'arrow_double_down',
- 'arrow_double_up',
- 'arrow_down',
- 'arrow_down_small',
- 'arrow_forward',
- 'arrow_heading_down',
- 'arrow_heading_up',
- 'arrow_left',
- 'arrow_lower_left',
- 'arrow_lower_right',
- 'arrow_right',
- 'arrow_right_hook',
- 'arrow_up',
- 'arrow_up_down',
- 'arrow_up_small',
- 'arrow_upper_left',
- 'arrow_upper_right',
- 'arrows_clockwise',
- 'arrows_counterclockwise',
- 'art',
- 'articulated_lorry',
- 'astonished',
- 'athletic_shoe',
- 'atm',
- 'b',
- 'baby',
- 'baby_bottle',
- 'baby_chick',
- 'baby_symbol',
- 'back',
- 'baggage_claim',
- 'balloon',
- 'ballot_box_with_check',
- 'bamboo',
- 'banana',
- 'bangbang',
- 'bank',
- 'bar_chart',
- 'barber',
- 'baseball',
- 'basketball',
- 'bath',
- 'bathtub',
- 'battery',
- 'bear',
- 'bee',
- 'beer',
- 'beers',
- 'beetle',
- 'beginner',
- 'bell',
- 'bento',
- 'bicyclist',
- 'bike',
- 'bikini',
- 'bird',
- 'birthday',
- 'black_circle',
- 'black_joker',
- 'black_large_square',
- 'black_medium_small_square',
- 'black_medium_square',
- 'black_nib',
- 'black_small_square',
- 'black_square_button',
- 'blossom',
- 'blowfish',
- 'blue_book',
- 'blue_car',
- 'blue_heart',
- 'blush',
- 'boar',
- 'boat',
- 'bomb',
- 'book',
- 'bookmark',
- 'bookmark_tabs',
- 'books',
- 'boom',
- 'boot',
- 'bouquet',
- 'bow',
- 'bowling',
- 'bowtie',
- 'boy',
- 'bread',
- 'bride_with_veil',
- 'bridge_at_night',
- 'briefcase',
- 'broken_heart',
- 'bug',
- 'bulb',
- 'bullettrain_front',
- 'bullettrain_side',
- 'bus',
- 'busstop',
- 'bust_in_silhouette',
- 'busts_in_silhouette',
- 'cactus',
- 'cake',
- 'calendar',
- 'calling',
- 'camel',
- 'camera',
- 'cancer',
- 'candy',
- 'capital_abcd',
- 'capricorn',
- 'car',
- 'card_index',
- 'carousel_horse',
- 'cat',
- 'cat2',
- 'cd',
- 'chart',
- 'chart_with_downwards_trend',
- 'chart_with_upwards_trend',
- 'checkered_flag',
- 'cherries',
- 'cherry_blossom',
- 'chestnut',
- 'chicken',
- 'children_crossing',
- 'chocolate_bar',
- 'christmas_tree',
- 'church',
- 'cinema',
- 'circus_tent',
- 'city_sunrise',
- 'city_sunset',
- 'cl',
- 'clap',
- 'clapper',
- 'clipboard',
- 'clock1',
- 'clock10',
- 'clock1030',
- 'clock11',
- 'clock1130',
- 'clock12',
- 'clock1230',
- 'clock130',
- 'clock2',
- 'clock230',
- 'clock3',
- 'clock330',
- 'clock4',
- 'clock430',
- 'clock5',
- 'clock530',
- 'clock6',
- 'clock630',
- 'clock7',
- 'clock730',
- 'clock8',
- 'clock830',
- 'clock9',
- 'clock930',
- 'closed_book',
- 'closed_lock_with_key',
- 'closed_umbrella',
- 'cloud',
- 'clubs',
- 'cn',
- 'cocktail',
- 'coffee',
- 'cold_sweat',
- 'collision',
- 'computer',
- 'confetti_ball',
- 'confounded',
- 'confused',
- 'congratulations',
- 'construction',
- 'construction_worker',
- 'convenience_store',
- 'cookie',
- 'cool',
- 'cop',
- 'copyright',
- 'corn',
- 'couple',
- 'couple_with_heart',
- 'couplekiss',
- 'cow',
- 'cow2',
- 'credit_card',
- 'crescent_moon',
- 'crocodile',
- 'crossed_flags',
- 'crown',
- 'cry',
- 'crying_cat_face',
- 'crystal_ball',
- 'cupid',
- 'curly_loop',
- 'currency_exchange',
- 'curry',
- 'custard',
- 'customs',
- 'cyclone',
- 'dancer',
- 'dancers',
- 'dango',
- 'dart',
- 'dash',
- 'date',
- 'de',
- 'deciduous_tree',
- 'department_store',
- 'diamond_shape_with_a_dot_inside',
- 'diamonds',
- 'disappointed',
- 'disappointed_relieved',
- 'dizzy',
- 'dizzy_face',
- 'do_not_litter',
- 'dog',
- 'dog2',
- 'dollar',
- 'dolls',
- 'dolphin',
- 'door',
- 'doughnut',
- 'dragon',
- 'dragon_face',
- 'dress',
- 'dromedary_camel',
- 'droplet',
- 'dvd',
- 'e-mail',
- 'ear',
- 'ear_of_rice',
- 'earth_africa',
- 'earth_americas',
- 'earth_asia',
- 'egg',
- 'eggplant',
- 'eight',
- 'eight_pointed_black_star',
- 'eight_spoked_asterisk',
- 'electric_plug',
- 'elephant',
- 'email',
- 'end',
- 'envelope',
- 'envelope_with_arrow',
- 'es',
- 'euro',
- 'european_castle',
- 'european_post_office',
- 'evergreen_tree',
- 'exclamation',
- 'expressionless',
- 'eyeglasses',
- 'eyes',
- 'facepunch',
- 'factory',
- 'fallen_leaf',
- 'family',
- 'fast_forward',
- 'fax',
- 'fearful',
- 'feelsgood',
- 'feet',
- 'ferris_wheel',
- 'file_folder',
- 'finnadie',
- 'fire',
- 'fire_engine',
- 'fireworks',
- 'first_quarter_moon',
- 'first_quarter_moon_with_face',
- 'fish',
- 'fish_cake',
- 'fishing_pole_and_fish',
- 'fist',
- 'five',
- 'flags',
- 'flashlight',
- 'flipper',
- 'floppy_disk',
- 'flower_playing_cards',
- 'flushed',
- 'foggy',
- 'football',
- 'footprints',
- 'fork_and_knife',
- 'fountain',
- 'four',
- 'four_leaf_clover',
- 'fr',
- 'free',
- 'fried_shrimp',
- 'fries',
- 'frog',
- 'frowning',
- 'fu',
- 'fuelpump',
- 'full_moon',
- 'full_moon_with_face',
- 'game_die',
- 'gb',
- 'gem',
- 'gemini',
- 'ghost',
- 'gift',
- 'gift_heart',
- 'girl',
- 'globe_with_meridians',
- 'goat',
- 'goberserk',
- 'godmode',
- 'golf',
- 'grapes',
- 'green_apple',
- 'green_book',
- 'green_heart',
- 'grey_exclamation',
- 'grey_question',
- 'grimacing',
- 'grin',
- 'grinning',
- 'guardsman',
- 'guitar',
- 'gun',
- 'haircut',
- 'hamburger',
- 'hammer',
- 'hamster',
- 'hand',
- 'handbag',
- 'hankey',
- 'hash',
- 'hatched_chick',
- 'hatching_chick',
- 'headphones',
- 'hear_no_evil',
- 'heart',
- 'heart_decoration',
- 'heart_eyes',
- 'heart_eyes_cat',
- 'heartbeat',
- 'heartpulse',
- 'hearts',
- 'heavy_check_mark',
- 'heavy_division_sign',
- 'heavy_dollar_sign',
- 'heavy_exclamation_mark',
- 'heavy_minus_sign',
- 'heavy_multiplication_x',
- 'heavy_plus_sign',
- 'helicopter',
- 'herb',
- 'hibiscus',
- 'high_brightness',
- 'high_heel',
- 'hocho',
- 'honey_pot',
- 'honeybee',
- 'horse',
- 'horse_racing',
- 'hospital',
- 'hotel',
- 'hotsprings',
- 'hourglass',
- 'hourglass_flowing_sand',
- 'house',
- 'house_with_garden',
- 'hurtrealbad',
- 'hushed',
- 'ice_cream',
- 'icecream',
- 'id',
- 'ideograph_advantage',
- 'imp',
- 'inbox_tray',
- 'incoming_envelope',
- 'information_desk_person',
- 'information_source',
- 'innocent',
- 'interrobang',
- 'iphone',
- 'it',
- 'izakaya_lantern',
- 'jack_o_lantern',
- 'japan',
- 'japanese_castle',
- 'japanese_goblin',
- 'japanese_ogre',
- 'jeans',
- 'joy',
- 'joy_cat',
- 'jp',
- 'key',
- 'keycap_ten',
- 'kimono',
- 'kiss',
- 'kissing',
- 'kissing_cat',
- 'kissing_closed_eyes',
- 'kissing_heart',
- 'kissing_smiling_eyes',
- 'koala',
- 'koko',
- 'kr',
- 'lantern',
- 'large_blue_circle',
- 'large_blue_diamond',
- 'large_orange_diamond',
- 'last_quarter_moon',
- 'last_quarter_moon_with_face',
- 'laughing',
- 'leaves',
- 'ledger',
- 'left_luggage',
- 'left_right_arrow',
- 'leftwards_arrow_with_hook',
- 'lemon',
- 'leo',
- 'leopard',
- 'libra',
- 'light_rail',
- 'link',
- 'lips',
- 'lipstick',
- 'lock',
- 'lock_with_ink_pen',
- 'lollipop',
- 'loop',
- 'loud_sound',
- 'loudspeaker',
- 'love_hotel',
- 'love_letter',
- 'low_brightness',
- 'm',
- 'mag',
- 'mag_right',
- 'mahjong',
- 'mailbox',
- 'mailbox_closed',
- 'mailbox_with_mail',
- 'mailbox_with_no_mail',
- 'man',
- 'man_with_gua_pi_mao',
- 'man_with_turban',
- 'mans_shoe',
- 'maple_leaf',
- 'mask',
- 'massage',
- 'meat_on_bone',
- 'mega',
- 'melon',
- 'memo',
- 'mens',
- 'metal',
- 'metro',
- 'microphone',
- 'microscope',
- 'milky_way',
- 'minibus',
- 'minidisc',
- 'mobile_phone_off',
- 'money_with_wings',
- 'moneybag',
- 'monkey',
- 'monkey_face',
- 'monorail',
- 'moon',
- 'mortar_board',
- 'mount_fuji',
- 'mountain_bicyclist',
- 'mountain_cableway',
- 'mountain_railway',
- 'mouse',
- 'mouse2',
- 'movie_camera',
- 'moyai',
- 'muscle',
- 'mushroom',
- 'musical_keyboard',
- 'musical_note',
- 'musical_score',
- 'mute',
- 'nail_care',
- 'name_badge',
- 'neckbeard',
- 'necktie',
- 'negative_squared_cross_mark',
- 'neutral_face',
- 'new',
- 'new_moon',
- 'new_moon_with_face',
- 'newspaper',
- 'ng',
- 'night_with_stars',
- 'nine',
- 'no_bell',
- 'no_bicycles',
- 'no_entry',
- 'no_entry_sign',
- 'no_good',
- 'no_mobile_phones',
- 'no_mouth',
- 'no_pedestrians',
- 'no_smoking',
- 'non-potable_water',
- 'nose',
- 'notebook',
- 'notebook_with_decorative_cover',
- 'notes',
- 'nut_and_bolt',
- 'o',
- 'o2',
- 'ocean',
- 'octocat',
- 'octopus',
- 'oden',
- 'office',
- 'ok',
- 'ok_hand',
- 'ok_woman',
- 'older_man',
- 'older_woman',
- 'on',
- 'oncoming_automobile',
- 'oncoming_bus',
- 'oncoming_police_car',
- 'oncoming_taxi',
- 'one',
- 'open_book',
- 'open_file_folder',
- 'open_hands',
- 'open_mouth',
- 'ophiuchus',
- 'orange_book',
- 'outbox_tray',
- 'ox',
- 'package',
- 'page_facing_up',
- 'page_with_curl',
- 'pager',
- 'palm_tree',
- 'panda_face',
- 'paperclip',
- 'parking',
- 'part_alternation_mark',
- 'partly_sunny',
- 'passport_control',
- 'paw_prints',
- 'peach',
- 'pear',
- 'pencil',
- 'pencil2',
- 'penguin',
- 'pensive',
- 'performing_arts',
- 'persevere',
- 'person_frowning',
- 'person_with_blond_hair',
- 'person_with_pouting_face',
- 'phone',
- 'pig',
- 'pig2',
- 'pig_nose',
- 'pill',
- 'pineapple',
- 'pisces',
- 'pizza',
- 'point_down',
- 'point_left',
- 'point_right',
- 'point_up',
- 'point_up_2',
- 'police_car',
- 'poodle',
- 'poop',
- 'post_office',
- 'postal_horn',
- 'postbox',
- 'potable_water',
- 'pouch',
- 'poultry_leg',
- 'pound',
- 'pouting_cat',
- 'pray',
- 'princess',
- 'punch',
- 'purple_heart',
- 'purse',
- 'pushpin',
- 'put_litter_in_its_place',
- 'question',
- 'rabbit',
- 'rabbit2',
- 'racehorse',
- 'radio',
- 'radio_button',
- 'rage',
- 'rage1',
- 'rage2',
- 'rage3',
- 'rage4',
- 'railway_car',
- 'rainbow',
- 'raised_hand',
- 'raised_hands',
- 'raising_hand',
- 'ram',
- 'ramen',
- 'rat',
- 'recycle',
- 'red_car',
- 'red_circle',
- 'registered',
- 'relaxed',
- 'relieved',
- 'repeat',
- 'repeat_one',
- 'restroom',
- 'revolving_hearts',
- 'rewind',
- 'ribbon',
- 'rice',
- 'rice_ball',
- 'rice_cracker',
- 'rice_scene',
- 'ring',
- 'rocket',
- 'roller_coaster',
- 'rooster',
- 'rose',
- 'rotating_light',
- 'round_pushpin',
- 'rowboat',
- 'ru',
- 'rugby_football',
- 'runner',
- 'running',
- 'running_shirt_with_sash',
- 'sa',
- 'sagittarius',
- 'sailboat',
- 'sake',
- 'sandal',
- 'santa',
- 'satellite',
- 'satisfied',
- 'saxophone',
- 'school',
- 'school_satchel',
- 'scissors',
- 'scorpius',
- 'scream',
- 'scream_cat',
- 'scroll',
- 'seat',
- 'secret',
- 'see_no_evil',
- 'seedling',
- 'seven',
- 'shaved_ice',
- 'sheep',
- 'shell',
- 'ship',
- 'shipit',
- 'shirt',
- 'shit',
- 'shoe',
- 'shower',
- 'signal_strength',
- 'six',
- 'six_pointed_star',
- 'ski',
- 'skull',
- 'sleeping',
- 'sleepy',
- 'slot_machine',
- 'small_blue_diamond',
- 'small_orange_diamond',
- 'small_red_triangle',
- 'small_red_triangle_down',
- 'smile',
- 'smile_cat',
- 'smiley',
- 'smiley_cat',
- 'smiling_imp',
- 'smirk',
- 'smirk_cat',
- 'smoking',
- 'snail',
- 'snake',
- 'snowboarder',
- 'snowflake',
- 'snowman',
- 'sob',
- 'soccer',
- 'soon',
- 'sos',
- 'sound',
- 'space_invader',
- 'spades',
- 'spaghetti',
- 'sparkle',
- 'sparkler',
- 'sparkles',
- 'sparkling_heart',
- 'speak_no_evil',
- 'speaker',
- 'speech_balloon',
- 'speedboat',
- 'squirrel',
- 'star',
- 'star2',
- 'stars',
- 'station',
- 'statue_of_liberty',
- 'steam_locomotive',
- 'stew',
- 'straight_ruler',
- 'strawberry',
- 'stuck_out_tongue',
- 'stuck_out_tongue_closed_eyes',
- 'stuck_out_tongue_winking_eye',
- 'sun_with_face',
- 'sunflower',
- 'sunglasses',
- 'sunny',
- 'sunrise',
- 'sunrise_over_mountains',
- 'surfer',
- 'sushi',
- 'suspect',
- 'suspension_railway',
- 'sweat',
- 'sweat_drops',
- 'sweat_smile',
- 'sweet_potato',
- 'swimmer',
- 'symbols',
- 'syringe',
- 'tada',
- 'tanabata_tree',
- 'tangerine',
- 'taurus',
- 'taxi',
- 'tea',
- 'telephone',
- 'telephone_receiver',
- 'telescope',
- 'tennis',
- 'tent',
- 'thought_balloon',
- 'three',
- 'thumbsdown',
- 'thumbsup',
- 'ticket',
- 'tiger',
- 'tiger2',
- 'tired_face',
- 'tm',
- 'toilet',
- 'tokyo_tower',
- 'tomato',
- 'tongue',
- 'top',
- 'tophat',
- 'tractor',
- 'traffic_light',
- 'train',
- 'train2',
- 'tram',
- 'triangular_flag_on_post',
- 'triangular_ruler',
- 'trident',
- 'triumph',
- 'trolleybus',
- 'trollface',
- 'trophy',
- 'tropical_drink',
- 'tropical_fish',
- 'truck',
- 'trumpet',
- 'tshirt',
- 'tulip',
- 'turtle',
- 'tv',
- 'twisted_rightwards_arrows',
- 'two',
- 'two_hearts',
- 'two_men_holding_hands',
- 'two_women_holding_hands',
- 'u5272',
- 'u5408',
- 'u55b6',
- 'u6307',
- 'u6708',
- 'u6709',
- 'u6e80',
- 'u7121',
- 'u7533',
- 'u7981',
- 'u7a7a',
- 'uk',
- 'umbrella',
- 'unamused',
- 'underage',
- 'unlock',
- 'up',
- 'us',
- 'v',
- 'vertical_traffic_light',
- 'vhs',
- 'vibration_mode',
- 'video_camera',
- 'video_game',
- 'violin',
- 'virgo',
- 'volcano',
- 'vs',
- 'walking',
- 'waning_crescent_moon',
- 'waning_gibbous_moon',
- 'warning',
- 'watch',
- 'water_buffalo',
- 'watermelon',
- 'wave',
- 'wavy_dash',
- 'waxing_crescent_moon',
- 'waxing_gibbous_moon',
- 'wc',
- 'weary',
- 'wedding',
- 'whale',
- 'whale2',
- 'wheelchair',
- 'white_check_mark',
- 'white_circle',
- 'white_flower',
- 'white_large_square',
- 'white_medium_small_square',
- 'white_medium_square',
- 'white_small_square',
- 'white_square_button',
- 'wind_chime',
- 'wine_glass',
- 'wink',
- 'wolf',
- 'woman',
- 'womans_clothes',
- 'womans_hat',
- 'womens',
- 'worried',
- 'wrench',
- 'x',
- 'yellow_heart',
- 'yen',
- 'yum',
- 'zap',
- 'zero',
- 'zzz'
-]
-
-// Emoji from All-Github-Emoji-Icons
-// https://github.com/scotch-io/All-Github-Emoji-Icons
-window.emojify = function (match, $1) {
- return AllGithubEmoji.indexOf($1) === -1 ?
- match :
- ' '
-}
diff --git a/src/plugins/external-script.js b/src/plugins/external-script.js
deleted file mode 100644
index 2954030..0000000
--- a/src/plugins/external-script.js
+++ /dev/null
@@ -1,25 +0,0 @@
-function handleExternalScript() {
- const container = Docsify.dom.getNode('#main')
- const scripts = Docsify.dom.findAll(container, 'script')
-
- for (let i = scripts.length; i--;) {
- const script = scripts[i]
-
- if (script && script.src) {
- const newScript = document.createElement('script')
-
- Array.prototype.slice.call(script.attributes).forEach(attribute => {
- newScript[attribute.name] = attribute.value
- })
-
- script.parentNode.insertBefore(newScript, script)
- script.parentNode.removeChild(script)
- }
- }
-}
-
-const install = function (hook) {
- hook.doneEach(handleExternalScript)
-}
-
-window.$docsify.plugins = [].concat(install, window.$docsify.plugins)
diff --git a/src/plugins/front-matter/index.js b/src/plugins/front-matter/index.js
deleted file mode 100644
index cb90ed9..0000000
--- a/src/plugins/front-matter/index.js
+++ /dev/null
@@ -1,13 +0,0 @@
-import parser from './parser'
-
-const install = function (hook, vm) {
- hook.beforeEach(content => {
- const {attributes, body} = parser(content)
-
- vm.frontmatter = attributes
-
- return body
- })
-}
-
-$docsify.plugins = [].concat(install, $docsify.plugins)
diff --git a/src/plugins/front-matter/parser.js b/src/plugins/front-matter/parser.js
deleted file mode 100644
index f0ae377..0000000
--- a/src/plugins/front-matter/parser.js
+++ /dev/null
@@ -1,55 +0,0 @@
-/**
- * Fork https://github.com/egoist/docute/blob/master/src/utils/front-matter.js
- */
-/* eslint-disable */
-import parser from './yaml'
-
-var optionalByteOrderMark = '\\ufeff?'
-var pattern =
- '^(' +
- optionalByteOrderMark +
- '(= yaml =|---)' +
- '$([\\s\\S]*?)' +
- '(?:\\2|\\.\\.\\.)' +
- '$' +
- '' +
- '(?:\\n)?)'
-// NOTE: If this pattern uses the 'g' flag the `regex` variable definition will
-// need to be moved down into the functions that use it.
-var regex = new RegExp(pattern, 'm')
-
-function extractor(string) {
- string = string || ''
-
- var lines = string.split(/(\r?\n)/)
- if (lines[0] && /= yaml =|---/.test(lines[0])) {
- return parse(string)
- } else {
- return { attributes: {}, body: string }
- }
-}
-
-function parse(string) {
- var match = regex.exec(string)
-
- if (!match) {
- return {
- attributes: {},
- body: string
- }
- }
-
- var yaml = match[match.length - 1].replace(/^\s+|\s+$/g, '')
- var attributes = parser(yaml) || {}
- var body = string.replace(match[0], '')
-
- return { attributes: attributes, body: body, frontmatter: yaml }
-}
-
-function test(string) {
- string = string || ''
-
- return regex.test(string)
-}
-
-export default extractor
diff --git a/src/plugins/front-matter/yaml.js b/src/plugins/front-matter/yaml.js
deleted file mode 100644
index b947463..0000000
--- a/src/plugins/front-matter/yaml.js
+++ /dev/null
@@ -1,466 +0,0 @@
-/**
- * Fork https://github.com/egoist/docute/blob/master/src/utils/yaml.js
- */
-/* eslint-disable */
-/*
-YAML parser for Javascript
-Author: Diogo Costa
-This program is released under the MIT License as follows:
-Copyright (c) 2011 Diogo Costa (costa.h4evr@gmail.com)
-Permission is hereby granted, free of charge, to any person obtaining a copy
- of this software and associated documentation files (the "Software"), to deal
- in the Software without restriction, including without limitation the rights
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- copies of the Software, and to permit persons to whom the Software is
- furnished to do so, subject to the following conditions:
-The above copyright notice and this permission notice shall be included in
- all copies or substantial portions of the Software.
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- THE SOFTWARE.
-*/
-
-/**
- * @name YAML
- * @namespace
-*/
-
-var errors = [],
- reference_blocks = [],
- processing_time = 0,
- regex = {
- regLevel: new RegExp('^([\\s\\-]+)'),
- invalidLine: new RegExp('^\\-\\-\\-|^\\.\\.\\.|^\\s*#.*|^\\s*$'),
- dashesString: new RegExp('^\\s*\\"([^\\"]*)\\"\\s*$'),
- quotesString: new RegExp("^\\s*\\'([^\\']*)\\'\\s*$"),
- float: new RegExp('^[+-]?[0-9]+\\.[0-9]+(e[+-]?[0-9]+(\\.[0-9]+)?)?$'),
- integer: new RegExp('^[+-]?[0-9]+$'),
- array: new RegExp('\\[\\s*(.*)\\s*\\]'),
- map: new RegExp('\\{\\s*(.*)\\s*\\}'),
- key_value: new RegExp('([a-z0-9_-][ a-z0-9_-]*):( .+)', 'i'),
- single_key_value: new RegExp('^([a-z0-9_-][ a-z0-9_-]*):( .+?)$', 'i'),
- key: new RegExp('([a-z0-9_-][ a-z0-9_-]+):( .+)?', 'i'),
- item: new RegExp('^-\\s+'),
- trim: new RegExp('^\\s+|\\s+$'),
- comment: new RegExp('([^\\\'\\"#]+([\\\'\\"][^\\\'\\"]*[\\\'\\"])*)*(#.*)?')
- }
-
-/**
- * @class A block of lines of a given level.
- * @param {int} lvl The block's level.
- * @private
- */
-function Block(lvl) {
- return {
- /* The block's parent */
- parent: null,
- /* Number of children */
- length: 0,
- /* Block's level */
- level: lvl,
- /* Lines of code to process */
- lines: [],
- /* Blocks with greater level */
- children: [],
- /* Add a block to the children collection */
- addChild: function(obj) {
- this.children.push(obj)
- obj.parent = this
- ++this.length
- }
- }
-}
-
-// function to create an XMLHttpClient in a cross-browser manner
-function createXMLHTTPRequest() {
- var xmlhttp
-
- try {
- // Mozilla / Safari / IE7
- xmlhttp = new XMLHttpRequest()
- } catch (e) {
- // IE
- var XMLHTTP_IDS = new Array(
- 'MSXML2.XMLHTTP.5.0',
- 'MSXML2.XMLHTTP.4.0',
- 'MSXML2.XMLHTTP.3.0',
- 'MSXML2.XMLHTTP',
- 'Microsoft.XMLHTTP'
- )
- var success = false
- for (var i = 0; i < XMLHTTP_IDS.length && !success; i++) {
- try {
- xmlhttp = new ActiveXObject(XMLHTTP_IDS[i])
- success = true
- } catch (e) {}
- }
- if (!success) {
- throw new Error('Unable to create XMLHttpRequest.')
- }
- }
-
- return xmlhttp
-}
-
-function parser(str) {
- var regLevel = regex['regLevel']
- var invalidLine = regex['invalidLine']
- var lines = str.split('\n')
- var m
- var level = 0,
- curLevel = 0
-
- var blocks = []
-
- var result = new Block(-1)
- var currentBlock = new Block(0)
- result.addChild(currentBlock)
- var levels = []
- var line = ''
-
- blocks.push(currentBlock)
- levels.push(level)
-
- for (var i = 0, len = lines.length; i < len; ++i) {
- line = lines[i]
-
- if (line.match(invalidLine)) {
- continue
- }
-
- if ((m = regLevel.exec(line))) {
- level = m[1].length
- } else level = 0
-
- if (level > curLevel) {
- var oldBlock = currentBlock
- currentBlock = new Block(level)
- oldBlock.addChild(currentBlock)
- blocks.push(currentBlock)
- levels.push(level)
- } else if (level < curLevel) {
- var added = false
-
- var k = levels.length - 1
- for (; k >= 0; --k) {
- if (levels[k] == level) {
- currentBlock = new Block(level)
- blocks.push(currentBlock)
- levels.push(level)
- if (blocks[k].parent != null) blocks[k].parent.addChild(currentBlock)
- added = true
- break
- }
- }
-
- if (!added) {
- errors.push('Error: Invalid indentation at line ' + i + ': ' + line)
- return
- }
- }
-
- currentBlock.lines.push(line.replace(regex['trim'], ''))
- curLevel = level
- }
-
- return result
-}
-
-function processValue(val) {
- val = val.replace(regex['trim'], '')
- var m = null
-
- if (val == 'true') {
- return true
- } else if (val == 'false') {
- return false
- } else if (val == '.NaN') {
- return Number.NaN
- } else if (val == 'null') {
- return null
- } else if (val == '.inf') {
- return Number.POSITIVE_INFINITY
- } else if (val == '-.inf') {
- return Number.NEGATIVE_INFINITY
- } else if ((m = val.match(regex['dashesString']))) {
- return m[1]
- } else if ((m = val.match(regex['quotesString']))) {
- return m[1]
- } else if ((m = val.match(regex['float']))) {
- return parseFloat(m[0])
- } else if ((m = val.match(regex['integer']))) {
- return parseInt(m[0])
- } else if (!isNaN((m = Date.parse(val)))) {
- return new Date(m)
- } else if ((m = val.match(regex['single_key_value']))) {
- var res = {}
- res[m[1]] = processValue(m[2])
- return res
- } else if ((m = val.match(regex['array']))) {
- var count = 0,
- c = ' '
- var res = []
- var content = ''
- var str = false
- for (var j = 0, lenJ = m[1].length; j < lenJ; ++j) {
- c = m[1][j]
- if (c == "'" || c == '"') {
- if (str === false) {
- str = c
- content += c
- continue
- } else if ((c == "'" && str == "'") || (c == '"' && str == '"')) {
- str = false
- content += c
- continue
- }
- } else if (str === false && (c == '[' || c == '{')) {
- ++count
- } else if (str === false && (c == ']' || c == '}')) {
- --count
- } else if (str === false && count == 0 && c == ',') {
- res.push(processValue(content))
- content = ''
- continue
- }
-
- content += c
- }
-
- if (content.length > 0) res.push(processValue(content))
- return res
- } else if ((m = val.match(regex['map']))) {
- var count = 0,
- c = ' '
- var res = []
- var content = ''
- var str = false
- for (var j = 0, lenJ = m[1].length; j < lenJ; ++j) {
- c = m[1][j]
- if (c == "'" || c == '"') {
- if (str === false) {
- str = c
- content += c
- continue
- } else if ((c == "'" && str == "'") || (c == '"' && str == '"')) {
- str = false
- content += c
- continue
- }
- } else if (str === false && (c == '[' || c == '{')) {
- ++count
- } else if (str === false && (c == ']' || c == '}')) {
- --count
- } else if (str === false && count == 0 && c == ',') {
- res.push(content)
- content = ''
- continue
- }
-
- content += c
- }
-
- if (content.length > 0) res.push(content)
-
- var newRes = {}
- for (var j = 0, lenJ = res.length; j < lenJ; ++j) {
- if ((m = res[j].match(regex['key_value']))) {
- newRes[m[1]] = processValue(m[2])
- }
- }
-
- return newRes
- } else return val
-}
-
-function processFoldedBlock(block) {
- var lines = block.lines
- var children = block.children
- var str = lines.join(' ')
- var chunks = [str]
- for (var i = 0, len = children.length; i < len; ++i) {
- chunks.push(processFoldedBlock(children[i]))
- }
- return chunks.join('\n')
-}
-
-function processLiteralBlock(block) {
- var lines = block.lines
- var children = block.children
- var str = lines.join('\n')
- for (var i = 0, len = children.length; i < len; ++i) {
- str += processLiteralBlock(children[i])
- }
- return str
-}
-
-function processBlock(blocks) {
- var m = null
- var res = {}
- var lines = null
- var children = null
- var currentObj = null
-
- var level = -1
-
- var processedBlocks = []
-
- var isMap = true
-
- for (var j = 0, lenJ = blocks.length; j < lenJ; ++j) {
- if (level != -1 && level != blocks[j].level) continue
-
- processedBlocks.push(j)
-
- level = blocks[j].level
- lines = blocks[j].lines
- children = blocks[j].children
- currentObj = null
-
- for (var i = 0, len = lines.length; i < len; ++i) {
- var line = lines[i]
-
- if ((m = line.match(regex['key']))) {
- var key = m[1]
-
- if (key[0] == '-') {
- key = key.replace(regex['item'], '')
- if (isMap) {
- isMap = false
- if (typeof res.length === 'undefined') {
- res = []
- }
- }
- if (currentObj != null) res.push(currentObj)
- currentObj = {}
- isMap = true
- }
-
- if (typeof m[2] != 'undefined') {
- var value = m[2].replace(regex['trim'], '')
- if (value[0] == '&') {
- var nb = processBlock(children)
- if (currentObj != null) currentObj[key] = nb
- else res[key] = nb
- reference_blocks[value.substr(1)] = nb
- } else if (value[0] == '|') {
- if (currentObj != null)
- currentObj[key] = processLiteralBlock(children.shift())
- else res[key] = processLiteralBlock(children.shift())
- } else if (value[0] == '*') {
- var v = value.substr(1)
- var no = {}
-
- if (typeof reference_blocks[v] == 'undefined') {
- errors.push("Reference '" + v + "' not found!")
- } else {
- for (var k in reference_blocks[v]) {
- no[k] = reference_blocks[v][k]
- }
-
- if (currentObj != null) currentObj[key] = no
- else res[key] = no
- }
- } else if (value[0] == '>') {
- if (currentObj != null)
- currentObj[key] = processFoldedBlock(children.shift())
- else res[key] = processFoldedBlock(children.shift())
- } else {
- if (currentObj != null) currentObj[key] = processValue(value)
- else res[key] = processValue(value)
- }
- } else {
- if (currentObj != null) currentObj[key] = processBlock(children)
- else res[key] = processBlock(children)
- }
- } else if (line.match(/^-\s*$/)) {
- if (isMap) {
- isMap = false
- if (typeof res.length === 'undefined') {
- res = []
- }
- }
- if (currentObj != null) res.push(currentObj)
- currentObj = {}
- isMap = true
- continue
- } else if ((m = line.match(/^-\s*(.*)/))) {
- if (currentObj != null) currentObj.push(processValue(m[1]))
- else {
- if (isMap) {
- isMap = false
- if (typeof res.length === 'undefined') {
- res = []
- }
- }
- res.push(processValue(m[1]))
- }
- continue
- }
- }
-
- if (currentObj != null) {
- if (isMap) {
- isMap = false
- if (typeof res.length === 'undefined') {
- res = []
- }
- }
- res.push(currentObj)
- }
- }
-
- for (var j = processedBlocks.length - 1; j >= 0; --j) {
- blocks.splice.call(blocks, processedBlocks[j], 1)
- }
-
- return res
-}
-
-function semanticAnalysis(blocks) {
- var res = processBlock(blocks.children)
- return res
-}
-
-function preProcess(src) {
- var m
- var lines = src.split('\n')
-
- var r = regex['comment']
-
- for (var i in lines) {
- if ((m = lines[i].match(r))) {
- /* var cmt = "";
- if(typeof m[3] != "undefined")
- lines[i] = m[1];
- else if(typeof m[3] != "undefined")
- lines[i] = m[3];
- else
- lines[i] = "";
- */
- if (typeof m[3] !== 'undefined') {
- lines[i] = m[0].substr(0, m[0].length - m[3].length)
- }
- }
- }
-
- return lines.join('\n')
-}
-
-function load(str) {
- errors = []
- reference_blocks = []
- processing_time = new Date().getTime()
- var pre = preProcess(str)
- var doc = parser(pre)
- var res = semanticAnalysis(doc)
- processing_time = new Date().getTime() - processing_time
-
- return res
-}
-
-export default load
diff --git a/src/plugins/ga.js b/src/plugins/ga.js
index 2d6419b..40c455f 100644
--- a/src/plugins/ga.js
+++ b/src/plugins/ga.js
@@ -1,38 +1,42 @@
// From https://github.com/egoist/vue-ga/blob/master/src/index.js
-function appendScript() {
+
+function appendScript () {
const script = document.createElement('script')
script.async = true
script.src = 'https://www.google-analytics.com/analytics.js'
document.body.appendChild(script)
}
-function init(id) {
- appendScript()
- window.ga =
- window.ga ||
- function () {
+function init (id) {
+ if (!window.ga) {
+ appendScript()
+ window.ga = window.ga || function () {
(window.ga.q = window.ga.q || []).push(arguments)
}
- window.ga.l = Number(new Date())
- window.ga('create', id, 'auto')
+ window.ga.l = Number(new Date())
+ window.ga('create', id, 'auto')
+ }
}
-function collect() {
- if (!window.ga) {
- init($docsify.ga)
- }
-
- window.ga('set', 'page', location.hash)
+function collect () {
+ init(window.$docsify.ga)
+ window.ga('set', 'page', location.href)
window.ga('send', 'pageview')
}
-const install = function (hook) {
- if (!$docsify.ga) {
+const install = function () {
+ if (install.installed) return
+ install.installed = true
+
+ if (!window.$docsify.ga) {
console.error('[Docsify] ga is required.')
return
}
- hook.beforeEach(collect)
+ window.$docsify.plugins = [].concat(function (hook) {
+ hook.init(collect)
+ hook.beforeEach(collect)
+ }, window.$docsify.plugins)
}
-$docsify.plugins = [].concat(install, $docsify.plugins)
+export default install()
diff --git a/src/plugins/gitalk.js b/src/plugins/gitalk.js
deleted file mode 100644
index 8ba9ace..0000000
--- a/src/plugins/gitalk.js
+++ /dev/null
@@ -1,23 +0,0 @@
-function install(hook) {
- const dom = Docsify.dom
-
- hook.mounted(_ => {
- const div = dom.create('div')
- div.id = 'gitalk-container'
- const main = dom.getNode('#main')
- div.style = `width: ${main.clientWidth}px; margin: 0 auto 20px;`
- dom.appendTo(dom.find('.content'), div)
- })
-
- hook.doneEach(_ => {
- const el = document.getElementById('gitalk-container')
- while (el.hasChildNodes()) {
- el.removeChild(el.firstChild)
- }
-
- // eslint-disable-next-line
- gitalk.render('gitalk-container')
- })
-}
-
-$docsify.plugins = [].concat(install, $docsify.plugins)
diff --git a/src/plugins/matomo.js b/src/plugins/matomo.js
deleted file mode 100644
index 7b61cba..0000000
--- a/src/plugins/matomo.js
+++ /dev/null
@@ -1,37 +0,0 @@
-function appendScript(options) {
- const script = document.createElement('script')
- script.async = true
- script.src = options.host + '/matomo.js'
- document.body.appendChild(script)
-}
-
-function init(options) {
- window._paq = window._paq || []
- window._paq.push(['trackPageView'])
- window._paq.push(['enableLinkTracking'])
- setTimeout(function() {
- appendScript(options)
- window._paq.push(['setTrackerUrl', options.host + '/matomo.php'])
- window._paq.push(['setSiteId', options.id + ''])
- }, 0)
-}
-
-function collect() {
- if (!window._paq) {
- init($docsify.matomo)
- }
- window._paq.push(['setCustomUrl', window.location.hash.substr(1)])
- window._paq.push(['setDocumentTitle', document.title])
- window._paq.push(['trackPageView'])
-}
-
-const install = function (hook) {
- if (!$docsify.matomo) {
- console.error('[Docsify] matomo is required.')
- return
- }
-
- hook.beforeEach(collect)
-}
-
-$docsify.plugins = [].concat(install, $docsify.plugins)
diff --git a/src/plugins/search.js b/src/plugins/search.js
new file mode 100644
index 0000000..0f0e762
--- /dev/null
+++ b/src/plugins/search.js
@@ -0,0 +1,349 @@
+let INDEXS = {}
+const CONFIG = {
+ placeholder: 'Type to search',
+ paths: 'auto',
+ maxAge: 86400000 // 1 day
+}
+
+const isObj = function (obj) {
+ return Object.prototype.toString.call(obj) === '[object Object]'
+}
+
+const escapeHtml = function (string) {
+ const entityMap = {
+ '&': '&',
+ '<': '<',
+ '>': '>',
+ '"': '"',
+ "'": ''',
+ '/': '/'
+ }
+
+ return String(string).replace(/[&<>"'\/]/g, s => entityMap[s])
+}
+
+/**
+ * find all filepath from A tag
+ */
+const getAllPaths = function () {
+ const paths = []
+
+ ;[].slice.call(document.querySelectorAll('a'))
+ .map(node => {
+ const href = node.href
+ if (/#\/[^#]*?$/.test(href)) {
+ const path = href.replace(/^[^#]+#/, '')
+
+ if (paths.indexOf(path) <= 0) paths.push(path)
+ }
+ })
+
+ return paths
+}
+
+/**
+ * return file path
+ */
+const genFilePath = function (path, basePath = window.$docsify.basePath) {
+ let filePath = /\/$/.test(path) ? `${path}README.md` : `${path}.md`
+
+ filePath = basePath + filePath
+
+ return filePath.replace(/\/+/g, '/')
+}
+
+/**
+ * generate index
+ */
+const genIndex = function (path, content = '') {
+ INDEXS[path] = { slug: '', title: '', body: '' }
+ let slug
+
+ content
+ // remove PRE and TEMPLATE tag
+ .replace(/]*?>[\s\S]+?<\/template>/g, '')
+ // find all html tag
+ .replace(/<(\w+)([^>]*?)>([\s\S]+?)<\//g, (match, tag, attr, html) => {
+ // remove all html tag
+ const text = html.replace(/<[^>]+>/g, '')
+
+ // tag is headline
+ if (/^h\d$/.test(tag)) {
+ //
+ const id = attr.match(/id="(\S+)"/)[1]
+
+ slug = `#/${path}#${id}`.replace(/\/+/, '/')
+ INDEXS[slug] = { slug, title: text, body: '' }
+ } else {
+ if (!slug) return
+ // other html tag
+ if (!INDEXS[slug]) {
+ INDEXS[slug] = {}
+ } else {
+ if (INDEXS[slug].body && INDEXS[slug].body.length) {
+ INDEXS[slug].body += '\n' + text
+ } else {
+ INDEXS[slug].body = text
+ }
+ }
+ }
+ })
+}
+
+/**
+ * component
+ */
+class SearchComponent {
+ constructor () {
+ if (this.rendered) return
+
+ this.style()
+
+ const el = document.createElement('div')
+ const aside = document.querySelector('aside')
+
+ el.classList.add('search')
+ aside.insertBefore(el, aside.children[0])
+ this.render(el)
+ this.rendered = true
+ this.bindEvent()
+ }
+
+ style () {
+ const code = `
+ .sidebar {
+ padding-top: 0;
+ }
+
+ .search {
+ margin-bottom: 20px;
+ padding: 6px;
+ border-bottom: 1px solid #eee;
+ }
+
+ .search .results-panel {
+ display: none;
+ }
+
+ .search .results-panel.show {
+ display: block;
+ }
+
+ .search input {
+ outline: none;
+ border: none;
+ width: 100%;
+ padding: 7px;
+ line-height: 22px;
+ font-size: 14px;
+ }
+
+ .search h2 {
+ font-size: 17px;
+ margin: 10px 0;
+ }
+
+ .search a {
+ text-decoration: none;
+ color: inherit;
+ }
+
+ .search .matching-post {
+ border-bottom: 1px solid #eee;
+ }
+
+ .search .matching-post:last-child {
+ border-bottom: 0;
+ }
+
+ .search p {
+ font-size: 14px;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ display: -webkit-box;
+ -webkit-line-clamp: 2;
+ -webkit-box-orient: vertical;
+ }
+
+ .search p.empty {
+ text-align: center;
+ }
+ `
+ const style = document.createElement('style')
+
+ style.innerHTML = code
+ document.head.appendChild(style)
+ }
+
+ render (dom) {
+ dom.innerHTML = `
`
+ }
+
+ bindEvent () {
+ const search = document.querySelector('.search')
+ const input = search.querySelector('.search input')
+ const panel = search.querySelector('.results-panel')
+
+ search.addEventListener('click', e => e.target.tagName !== 'A' && e.stopPropagation())
+ input.addEventListener('input', e => {
+ const target = e.target
+
+ if (target.value.trim() !== '') {
+ const matchingPosts = this.search(target.value)
+ let html = ''
+
+ matchingPosts.forEach(function (post, index) {
+ html += `
+
+ `
+ })
+ if (panel.classList.contains('results-panel')) {
+ panel.classList.add('show')
+ panel.innerHTML = html || 'No Results!
'
+ }
+ } else {
+ if (panel.classList.contains('results-panel')) {
+ panel.classList.remove('show')
+ panel.innerHTML = ''
+ }
+ }
+ })
+ }
+
+ // From [weex website] https://weex-project.io/js/common.js
+ search (keywords) {
+ const matchingResults = []
+ const data = Object.keys(INDEXS).map(key => INDEXS[key])
+
+ keywords = keywords.trim().split(/[\s\-\,\\/]+/)
+
+ for (let i = 0; i < data.length; i++) {
+ const post = data[i]
+ let isMatch = false
+ let resultStr = ''
+ const postTitle = post.title && post.title.trim()
+ const postContent = post.body && post.body.trim()
+ const postUrl = post.slug || ''
+
+ if (postTitle !== '' && postContent !== '') {
+ keywords.forEach((keyword, i) => {
+ const regEx = new RegExp(keyword, 'gi')
+ let indexTitle = -1
+ let indexContent = -1
+
+ indexTitle = postTitle.search(regEx)
+ indexContent = postContent.search(regEx)
+
+ if (indexTitle < 0 && indexContent < 0) {
+ isMatch = false
+ } else {
+ isMatch = true
+ if (indexContent < 0) indexContent = 0
+
+ let start = 0
+ let end = 0
+
+ start = indexContent < 11 ? 0 : indexContent - 10
+ end = start === 0 ? 70 : indexContent + keyword.length + 60
+
+ if (end > postContent.length) end = postContent.length
+
+ const matchContent = '...' +
+ postContent
+ .substring(start, end)
+ .replace(regEx, `${keyword} `) +
+ '...'
+
+ resultStr += matchContent
+ }
+ })
+
+ if (isMatch) {
+ const matchingPost = {
+ title: escapeHtml(postTitle),
+ content: resultStr,
+ url: postUrl
+ }
+
+ matchingResults.push(matchingPost)
+ }
+ }
+ }
+
+ return matchingResults
+ }
+}
+
+const searchPlugin = function () {
+ const isAuto = CONFIG.paths === 'auto'
+ const isExpired = localStorage.getItem('docsify.search.expires') < Date.now()
+
+ INDEXS = JSON.parse(localStorage.getItem('docsify.search.index'))
+
+ if (isExpired) {
+ INDEXS = {}
+ } else if (!isAuto) {
+ return
+ }
+
+ let count = 0
+ const paths = isAuto ? getAllPaths() : CONFIG.paths
+ const len = paths.length
+ const { load, marked, slugify } = window.Docsify.utils
+ const alias = window.$docsify.alias
+ const done = () => {
+ localStorage.setItem('docsify.search.expires', Date.now() + CONFIG.maxAge)
+ localStorage.setItem('docsify.search.index', JSON.stringify(INDEXS))
+ }
+
+ paths.forEach(path => {
+ if (INDEXS[path]) return count++
+ let route
+
+ // replace route
+ if (alias && alias[path]) {
+ route = genFilePath(alias[path] || path, '')
+ } else {
+ route = genFilePath(path)
+ }
+
+ load(route).then(content => {
+ genIndex(path, marked(content))
+ slugify.clear()
+ count++
+
+ if (len === count) done()
+ })
+ })
+}
+
+const install = function () {
+ if (install.installed) return
+ install.installed = true
+
+ const userConfig = window.$docsify.search
+ const isNil = window.Docsify.utils.isNil
+
+ if (Array.isArray(userConfig)) {
+ CONFIG.paths = userConfig
+ } else if (isObj(userConfig)) {
+ CONFIG.paths = Array.isArray(userConfig.paths) ? userConfig.paths : 'auto'
+ CONFIG.maxAge = isNil(userConfig.maxAge) ? CONFIG.maxAge : userConfig.maxAge
+ CONFIG.placeholder = userConfig.placeholder || CONFIG.placeholder
+ }
+
+ window.$docsify.plugins = [].concat(hook => {
+ const isAuto = CONFIG.paths === 'auto'
+
+ hook.ready(() => {
+ new SearchComponent()
+ !isAuto && searchPlugin()
+ })
+ isAuto && hook.doneEach(searchPlugin)
+ }, window.$docsify.plugins)
+}
+
+export default install()
diff --git a/src/plugins/search/component.js b/src/plugins/search/component.js
deleted file mode 100644
index 42b0d19..0000000
--- a/src/plugins/search/component.js
+++ /dev/null
@@ -1,225 +0,0 @@
-import {search} from './search'
-
-let NO_DATA_TEXT = ''
-let options
-
-function style() {
- const code = `
-.sidebar {
- padding-top: 0;
-}
-
-.search {
- margin-bottom: 20px;
- padding: 6px;
- border-bottom: 1px solid #eee;
-}
-
-.search .input-wrap {
- display: flex;
- align-items: center;
-}
-
-.search .results-panel {
- display: none;
-}
-
-.search .results-panel.show {
- display: block;
-}
-
-.search input {
- outline: none;
- border: none;
- width: 100%;
- padding: 0 7px;
- line-height: 36px;
- font-size: 14px;
-}
-
-.search input::-webkit-search-decoration,
-.search input::-webkit-search-cancel-button,
-.search input {
- -webkit-appearance: none;
- -moz-appearance: none;
- appearance: none;
-}
-.search .clear-button {
- width: 36px;
- text-align: right;
- display: none;
-}
-
-.search .clear-button.show {
- display: block;
-}
-
-.search .clear-button svg {
- transform: scale(.5);
-}
-
-.search h2 {
- font-size: 17px;
- margin: 10px 0;
-}
-
-.search a {
- text-decoration: none;
- color: inherit;
-}
-
-.search .matching-post {
- border-bottom: 1px solid #eee;
-}
-
-.search .matching-post:last-child {
- border-bottom: 0;
-}
-
-.search p {
- font-size: 14px;
- overflow: hidden;
- text-overflow: ellipsis;
- display: -webkit-box;
- -webkit-line-clamp: 2;
- -webkit-box-orient: vertical;
-}
-
-.search p.empty {
- text-align: center;
-}
-
-.app-name.hide, .sidebar-nav.hide {
- display: none;
-}`
-
- Docsify.dom.style(code)
-}
-
-function tpl(defaultValue = '') {
- const html =
- `
-
- `
- const el = Docsify.dom.create('div', html)
- const aside = Docsify.dom.find('aside')
-
- Docsify.dom.toggleClass(el, 'search')
- Docsify.dom.before(aside, el)
-}
-
-function doSearch(value) {
- const $search = Docsify.dom.find('div.search')
- const $panel = Docsify.dom.find($search, '.results-panel')
- const $clearBtn = Docsify.dom.find($search, '.clear-button')
- const $sidebarNav = Docsify.dom.find('.sidebar-nav')
- const $appName = Docsify.dom.find('.app-name')
-
- if (!value) {
- $panel.classList.remove('show')
- $clearBtn.classList.remove('show')
- $panel.innerHTML = ''
-
- if (options.hideOtherSidebarContent) {
- $sidebarNav.classList.remove('hide')
- $appName.classList.remove('hide')
- }
- return
- }
- const matchs = search(value)
-
- let html = ''
- matchs.forEach(post => {
- html += ``
- })
-
- $panel.classList.add('show')
- $clearBtn.classList.add('show')
- $panel.innerHTML = html || `${NO_DATA_TEXT}
`
- if (options.hideOtherSidebarContent) {
- $sidebarNav.classList.add('hide')
- $appName.classList.add('hide')
- }
-}
-
-function bindEvents() {
- const $search = Docsify.dom.find('div.search')
- const $input = Docsify.dom.find($search, 'input')
- const $inputWrap = Docsify.dom.find($search, '.input-wrap')
-
- let timeId
- // Prevent to Fold sidebar
- Docsify.dom.on(
- $search,
- 'click',
- e => e.target.tagName !== 'A' && e.stopPropagation()
- )
- Docsify.dom.on($input, 'input', e => {
- clearTimeout(timeId)
- timeId = setTimeout(_ => doSearch(e.target.value.trim()), 100)
- })
- Docsify.dom.on($inputWrap, 'click', e => {
- // Click input outside
- if (e.target.tagName !== 'INPUT') {
- $input.value = ''
- doSearch()
- }
- })
-}
-
-function updatePlaceholder(text, path) {
- const $input = Docsify.dom.getNode('.search input[type="search"]')
-
- if (!$input) {
- return
- }
- if (typeof text === 'string') {
- $input.placeholder = text
- } else {
- const match = Object.keys(text).filter(key => path.indexOf(key) > -1)[0]
- $input.placeholder = text[match]
- }
-}
-
-function updateNoData(text, path) {
- if (typeof text === 'string') {
- NO_DATA_TEXT = text
- } else {
- const match = Object.keys(text).filter(key => path.indexOf(key) > -1)[0]
- NO_DATA_TEXT = text[match]
- }
-}
-
-function updateOptions(opts) {
- options = opts
-}
-
-export function init(opts, vm) {
- const keywords = vm.router.parse().query.s
-
- updateOptions(opts)
- style()
- tpl(keywords)
- bindEvents()
- keywords && setTimeout(_ => doSearch(keywords), 500)
-}
-
-export function update(opts, vm) {
- updateOptions(opts)
- updatePlaceholder(opts.placeholder, vm.route.path)
- updateNoData(opts.noData, vm.route.path)
-}
diff --git a/src/plugins/search/index.js b/src/plugins/search/index.js
deleted file mode 100644
index bbd3af6..0000000
--- a/src/plugins/search/index.js
+++ /dev/null
@@ -1,42 +0,0 @@
-import {init as initComponet, update as updateComponent} from './component'
-import {init as initSearch} from './search'
-
-const CONFIG = {
- placeholder: 'Type to search',
- noData: 'No Results!',
- paths: 'auto',
- depth: 2,
- maxAge: 86400000, // 1 day
- hideOtherSidebarContent: false,
- namespace: undefined
-}
-
-const install = function (hook, vm) {
- const {util} = Docsify
- const opts = vm.config.search || CONFIG
-
- if (Array.isArray(opts)) {
- CONFIG.paths = opts
- } else if (typeof opts === 'object') {
- CONFIG.paths = Array.isArray(opts.paths) ? opts.paths : 'auto'
- CONFIG.maxAge = util.isPrimitive(opts.maxAge) ? opts.maxAge : CONFIG.maxAge
- CONFIG.placeholder = opts.placeholder || CONFIG.placeholder
- CONFIG.noData = opts.noData || CONFIG.noData
- CONFIG.depth = opts.depth || CONFIG.depth
- CONFIG.hideOtherSidebarContent = opts.hideOtherSidebarContent || CONFIG.hideOtherSidebarContent
- CONFIG.namespace = opts.namespace || CONFIG.namespace
- }
-
- const isAuto = CONFIG.paths === 'auto'
-
- hook.mounted(_ => {
- initComponet(CONFIG, vm)
- !isAuto && initSearch(CONFIG, vm)
- })
- hook.doneEach(_ => {
- updateComponent(CONFIG, vm)
- isAuto && initSearch(CONFIG, vm)
- })
-}
-
-$docsify.plugins = [].concat(install, $docsify.plugins)
diff --git a/src/plugins/search/search.js b/src/plugins/search/search.js
deleted file mode 100644
index 2c9febf..0000000
--- a/src/plugins/search/search.js
+++ /dev/null
@@ -1,193 +0,0 @@
-let INDEXS = {}
-
-const LOCAL_STORAGE = {
- EXPIRE_KEY: 'docsify.search.expires',
- INDEX_KEY: 'docsify.search.index'
-}
-
-function resolveExpireKey(namespace) {
- return namespace ? `${LOCAL_STORAGE.EXPIRE_KEY}/${namespace}` : LOCAL_STORAGE.EXPIRE_KEY
-}
-function resolveIndexKey(namespace) {
- return namespace ? `${LOCAL_STORAGE.INDEX_KEY}/${namespace}` : LOCAL_STORAGE.INDEX_KEY
-}
-
-function escapeHtml(string) {
- const entityMap = {
- '&': '&',
- '<': '<',
- '>': '>',
- '"': '"',
- '\'': ''',
- '/': '/'
- }
-
- return String(string).replace(/[&<>"'/]/g, s => entityMap[s])
-}
-
-function getAllPaths(router) {
- const paths = []
-
- Docsify.dom.findAll('.sidebar-nav a:not(.section-link):not([data-nosearch])').forEach(node => {
- const href = node.href
- const originHref = node.getAttribute('href')
- const path = router.parse(href).path
-
- if (
- path &&
- paths.indexOf(path) === -1 &&
- !Docsify.util.isAbsolutePath(originHref)
- ) {
- paths.push(path)
- }
- })
-
- return paths
-}
-
-function saveData(maxAge, expireKey, indexKey) {
- localStorage.setItem(expireKey, Date.now() + maxAge)
- localStorage.setItem(indexKey, JSON.stringify(INDEXS))
-}
-
-export function genIndex(path, content = '', router, depth) {
- const tokens = window.marked.lexer(content)
- const slugify = window.Docsify.slugify
- const index = {}
- let slug
-
- tokens.forEach(token => {
- if (token.type === 'heading' && token.depth <= depth) {
- slug = router.toURL(path, {id: slugify(token.text)})
- index[slug] = {slug, title: token.text, body: ''}
- } else {
- if (!slug) {
- return
- }
- if (!index[slug]) {
- index[slug] = {slug, title: '', body: ''}
- } else if (index[slug].body) {
- index[slug].body += '\n' + (token.text || '')
- } else {
- index[slug].body = token.text
- }
- }
- })
- slugify.clear()
- return index
-}
-
-/**
- * @param {String} query
- * @returns {Array}
- */
-export function search(query) {
- const matchingResults = []
- let data = []
- Object.keys(INDEXS).forEach(key => {
- data = data.concat(Object.keys(INDEXS[key]).map(page => INDEXS[key][page]))
- })
-
- query = query.trim()
- let keywords = query.split(/[\s\-,\\/]+/)
- if (keywords.length !== 1) {
- keywords = [].concat(query, keywords)
- }
-
- for (let i = 0; i < data.length; i++) {
- const post = data[i]
- let matchesScore = 0
- let resultStr = ''
- const postTitle = post.title && post.title.trim()
- const postContent = post.body && post.body.trim()
- const postUrl = post.slug || ''
-
- if (postTitle) {
- keywords.forEach( keyword => {
- // From https://github.com/sindresorhus/escape-string-regexp
- const regEx = new RegExp(
- keyword.replace(/[|\\{}()[\]^$+*?.]/g, '\\$&'),
- 'gi'
- );
- let indexTitle = -1
- let indexContent = -1
-
- indexTitle = postTitle ? postTitle.search(regEx) : -1
- indexContent = postContent ? postContent.search(regEx) : -1
-
- if (indexTitle >= 0 || indexContent >= 0) {
- matchesScore += indexTitle >= 0 ? 3 : indexContent >= 0 ? 2 : 0;
- if (indexContent < 0) {
- indexContent = 0
- }
-
- let start = 0
- let end = 0
-
- start = indexContent < 11 ? 0 : indexContent - 10
- end = start === 0 ? 70 : indexContent + keyword.length + 60
-
- if (end > postContent.length) {
- end = postContent.length
- }
-
- const matchContent =
- '...' +
- escapeHtml(postContent)
- .substring(start, end)
- .replace(regEx, `${keyword} `) +
- '...'
-
- resultStr += matchContent
- }
- })
-
- if (matchesScore > 0) {
- const matchingPost = {
- title: escapeHtml(postTitle),
- content: postContent ? resultStr : '',
- url: postUrl,
- score: matchesScore
- }
-
- matchingResults.push(matchingPost)
- }
- }
- }
-
- return matchingResults.sort((r1, r2) => r2.score - r1.score);
-}
-
-export function init(config, vm) {
- const isAuto = config.paths === 'auto'
-
- const expireKey = resolveExpireKey(config.namespace)
- const indexKey = resolveIndexKey(config.namespace)
-
- const isExpired = localStorage.getItem(expireKey) < Date.now()
-
- INDEXS = JSON.parse(localStorage.getItem(indexKey))
-
- if (isExpired) {
- INDEXS = {}
- } else if (!isAuto) {
- return
- }
-
- const paths = isAuto ? getAllPaths(vm.router) : config.paths
- const len = paths.length
- let count = 0
-
- paths.forEach(path => {
- if (INDEXS[path]) {
- return count++
- }
-
- Docsify
- .get(vm.router.getFile(path), false, vm.config.requestHeaders)
- .then(result => {
- INDEXS[path] = genIndex(path, result, vm.router, config.depth)
- len === ++count && saveData(config.maxAge, expireKey, indexKey)
- })
- })
-}
diff --git a/src/plugins/zoom-image.js b/src/plugins/zoom-image.js
deleted file mode 100644
index faf92e1..0000000
--- a/src/plugins/zoom-image.js
+++ /dev/null
@@ -1,21 +0,0 @@
-import mediumZoom from 'medium-zoom'
-
-const matchesSelector = Element.prototype.matches || Element.prototype.webkitMatchesSelector || Element.prototype.msMatchesSelector
-
-function install(hook) {
- let zoom
-
- hook.doneEach(_ => {
- let elms = Array.apply(null, document.querySelectorAll('.markdown-section img:not(.emoji):not([data-no-zoom])'))
-
- elms = elms.filter(elm => matchesSelector.call(elm, 'a img') === false)
-
- if (zoom) {
- zoom.detach()
- }
-
- zoom = mediumZoom(elms)
- })
-}
-
-$docsify.plugins = [].concat(install, $docsify.plugins)
diff --git a/src/polyfill.js b/src/polyfill.js
new file mode 100644
index 0000000..f3a032b
--- /dev/null
+++ b/src/polyfill.js
@@ -0,0 +1,30 @@
+import { load } from './util'
+
+function replaceVar (block) {
+ block.innerHTML = block.innerHTML.replace(/var\(\s*--theme-color.*?\)/g, $docsify.themeColor)
+}
+
+export function cssVars () {
+ // variable support
+ if (window.CSS && window.CSS.supports && window.CSS.supports('(--foo: red)')) return
+
+ const styleBlocks = document.querySelectorAll('style:not(.inserted),link')
+
+ ;[].forEach.call(styleBlocks, block => {
+ if (block.nodeName === 'STYLE') {
+ replaceVar(block)
+ } else if (block.nodeName === 'LINK') {
+ const href = block.getAttribute('href')
+
+ if (!/\.css$/.test(href)) return
+
+ load(href).then(res => {
+ const style = document.createElement('style')
+
+ style.innerHTML = res
+ document.head.appendChild(style)
+ replaceVar(style)
+ })
+ }
+ })
+}
diff --git a/src/render.js b/src/render.js
new file mode 100644
index 0000000..26a5d53
--- /dev/null
+++ b/src/render.js
@@ -0,0 +1,270 @@
+import marked from 'marked'
+import Prism from 'prismjs'
+import * as tpl from './tpl'
+import * as event from './event'
+import * as polyfill from './polyfill'
+import { genTree, getRoute, isMobile, slugify, merge, emojify } from './util'
+
+let markdown = marked
+let toc = []
+const CACHE = {}
+const originTitle = document.title
+
+const renderTo = function (dom, content) {
+ dom = typeof dom === 'object' ? dom : document.querySelector(dom)
+ dom.innerHTML = content
+ slugify.clear()
+
+ return dom
+}
+
+/**
+ * init render
+ */
+export function init () {
+ const renderer = new marked.Renderer()
+ /**
+ * render anchor tag
+ * @link https://github.com/chjj/marked#overriding-renderer-methods
+ */
+ renderer.heading = function (text, level) {
+ const slug = slugify(text)
+ let route = ''
+
+ route = `#/${getRoute()}`
+ toc.push({ level, slug: `${route}#${encodeURIComponent(slug)}`, title: text })
+
+ return `${text} `
+ }
+ // highlight code
+ renderer.code = function (code, lang = '') {
+ const hl = Prism.highlight(code, Prism.languages[lang] || Prism.languages.markup)
+
+ return `${hl} `
+ }
+ renderer.link = function (href, title, text) {
+ if (!/:|(\/{2})/.test(href)) {
+ href = `#/${href}`.replace(/\/+/g, '/')
+ }
+ return `${text} `
+ }
+ renderer.paragraph = function (text) {
+ if (/^!>/.test(text)) {
+ return tpl.helper('tip', text)
+ } else if (/^\?>/.test(text)) {
+ return tpl.helper('warn', text)
+ }
+ return `${text}
`
+ }
+ renderer.image = function (href, title, text) {
+ const url = /:|(\/{2})/.test(href) ? href : ($docsify.basePath + href).replace(/\/+/g, '/')
+ const titleHTML = title ? ` title="${title}"` : ''
+
+ return ` `
+ }
+
+ if (typeof $docsify.markdown === 'function') {
+ markdown = $docsify.markdown.call(this, markdown, renderer)
+ } else {
+ if ($docsify.markdown && $docsify.markdown.renderer) {
+ $docsify.markdown.renderer = merge(renderer, $docsify.markdown.renderer)
+ }
+ markdown.setOptions(merge({ renderer }, $docsify.markdown))
+ }
+
+ const md = markdown
+
+ markdown = text => emojify(md(text))
+
+ window.Docsify.utils.marked = text => {
+ const result = markdown(text)
+ toc = []
+ return result
+ }
+}
+
+/**
+ * App
+ */
+export function renderApp (dom, replace) {
+ const nav = document.querySelector('nav') || document.createElement('nav')
+ const body = document.body
+ const head = document.head
+
+ if (!$docsify.repo) nav.classList.add('no-badge')
+
+ dom[replace ? 'outerHTML' : 'innerHTML'] = tpl.corner($docsify.repo) +
+ ($docsify.coverpage ? tpl.cover() : '') +
+ tpl.main()
+ body.insertBefore(nav, body.children[0])
+
+ // theme color
+ if ($docsify.themeColor) {
+ head.innerHTML += tpl.theme($docsify.themeColor)
+ polyfill.cssVars()
+ }
+
+ // render name
+ if ($docsify.name) {
+ const aside = document.querySelector('.sidebar')
+ aside.innerHTML = `` + aside.innerHTML
+ }
+
+ // bind toggle
+ event.bindToggle('button.sidebar-toggle')
+ // bind sticky effect
+ if ($docsify.coverpage) {
+ !isMobile() && window.addEventListener('scroll', event.sticky)
+ } else {
+ body.classList.add('sticky')
+ }
+}
+
+/**
+ * article
+ */
+export function renderArticle (content) {
+ const hook = window.Docsify.hook
+ const renderFn = function (data) {
+ renderTo('article', data)
+ if (!$docsify.loadSidebar) renderSidebar()
+
+ if (data && typeof Vue !== 'undefined') {
+ CACHE.vm && CACHE.vm.$destroy()
+
+ const script = [].slice.call(
+ document.body.querySelectorAll('article>script'))
+ .filter(script => !/template/.test(script.type)
+ )[0]
+ const code = script ? script.innerText.trim() : null
+
+ script && script.remove()
+ CACHE.vm = code
+ ? new Function(`return ${code}`)()
+ : new Vue({ el: 'main' }) // eslint-disable-line
+ CACHE.vm && CACHE.vm.$nextTick(_ => event.scrollActiveSidebar())
+ }
+ if ($docsify.auto2top) setTimeout(() => event.scroll2Top($docsify.auto2top), 0)
+ }
+
+ hook.emit('before', content, result => {
+ const html = result ? markdown(result) : ''
+
+ hook.emit('after', html, result => renderFn(result || 'not found'))
+ })
+}
+
+/**
+ * navbar
+ */
+export function renderNavbar (content) {
+ if (CACHE.navbar && CACHE.navbar === content) return
+ CACHE.navbar = content
+
+ if (content) renderTo('nav', markdown(content))
+ event.activeLink('nav')
+}
+
+/**
+ * sidebar
+ */
+export function renderSidebar (content) {
+ let html
+
+ if (content) {
+ html = markdown(content)
+ // find url tag
+ html = html.match(/