diff --git a/.eslintignore b/.eslintignore
index 07dc46e..a3b8548 100644
--- a/.eslintignore
+++ b/.eslintignore
@@ -1,3 +1,5 @@
-.git/
+.git
packages/docsify-server-renderer/build.js
-node_modules
\ No newline at end of file
+node_modules
+build
+server.js
\ No newline at end of file
diff --git a/.eslintrc b/.eslintrc
index 3a6f901..a8f7cd0 100644
--- a/.eslintrc
+++ b/.eslintrc
@@ -1,15 +1,20 @@
{
- "extends": [
- "vue"
- ],
- "parserOptions": {
- "ecmaVersion": 8
- },
- "env": {
- "browser": true
+ "extends": "xo-space/browser",
+ "rules": {
+ "semi": [2, "never"],
+ "no-return-assign": "off",
+ "no-unused-expressions": "off",
+ "no-new-func": "off",
+ "no-multi-assign": "off",
+ "no-mixed-operators": "off",
+ "max-params": "off",
+ "no-script-url": "off",
+ "camelcase": "off",
+ "no-warning-comments": "off"
},
"globals": {
"Docsify": true,
- "$docsify": true
+ "$docsify": true,
+ "process": true
}
}
diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md
new file mode 100644
index 0000000..35d6b90
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/bug_report.md
@@ -0,0 +1,38 @@
+---
+name: Bug report
+about: Create a report to help us improve
+
+---
+
+
+
+
+
+## Bug Report
+
+#### Steps to reproduce
+
+
+
+#### What is current behaviour
+
+
+
+#### What is the expected behaviour
+
+
+
+#### Other relevant information
+
+
+- [ ] Bug does still occur when all/other plugins are disabled?
+
+- Your OS:
+- Node.js version:
+- npm/yarn version:
+- Browser version:
+- Docsify version:
+- Docsify plugins:
+
+
diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md
new file mode 100644
index 0000000..501e4de
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/feature_request.md
@@ -0,0 +1,25 @@
+---
+name: Feature request
+about: Suggest an idea for this project
+
+---
+
+
+
+
+
+## Feature request
+
+#### What problem does this feature solve?
+
+
+
+#### What does the proposed API look like?
+
+
+
+#### How should this be implemented in your opinion?
+
+
+
+#### Are you willing to work on this yourself?
diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md
index 191718b..bb31bd4 100644
--- a/.github/PULL_REQUEST_TEMPLATE.md
+++ b/.github/PULL_REQUEST_TEMPLATE.md
@@ -1,5 +1,54 @@
-Please makes sure these boxes are checked before submitting your PR, thank you!
+
+
+
+
+
+
+**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.
-* [ ] Make sure you are merging your commits to `master` branch.
-* [ ] Add some descriptions and refer relative issues for you PR.
-* [ ] DO NOT include files inside lib directory.
diff --git a/.gitignore b/.gitignore
index aac765d..ea4b5b8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,5 +1,9 @@
*.log
.DS_Store
-/themes/
+.idea
node_modules
-/lib/
+themes/
+lib/
+
+# exceptions
+!.gitkeep
\ No newline at end of file
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 85d7dc0..267d402 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,591 +1,753 @@
+
+## [4.9.4](https://github.com/docsifyjs/docsify/compare/v4.9.2...v4.9.4) (2019-05-05)
+
+
+
+
+## [4.9.2](https://github.com/docsifyjs/docsify/compare/v4.9.1...v4.9.2) (2019-04-21)
+
+
+### Bug Fixes
+
+* re-render gitalk when router changed ([11ea1f8](https://github.com/docsifyjs/docsify/commit/11ea1f8))
+
+
+### Features
+
+* allows relative path, fixed [#590](https://github.com/docsifyjs/docsify/issues/590) ([31654f1](https://github.com/docsifyjs/docsify/commit/31654f1))
+
+
+
+
+## [4.9.1](https://github.com/docsifyjs/docsify/compare/v4.9.0...v4.9.1) (2019-02-21)
+
+
+### Bug Fixes
+
+* github assets url ([#774](https://github.com/docsifyjs/docsify/issues/774)) ([140bf10](https://github.com/docsifyjs/docsify/commit/140bf10))
+
+
+
+
+# [4.9.0](https://github.com/docsifyjs/docsify/compare/v4.8.6...v4.9.0) (2019-02-19)
+
+
+### Bug Fixes
+
+* task list rendering (Fix [#749](https://github.com/docsifyjs/docsify/issues/749)) ([#757](https://github.com/docsifyjs/docsify/issues/757)) ([69ef489](https://github.com/docsifyjs/docsify/commit/69ef489))
+* upgrade npm-run-all ([049726e](https://github.com/docsifyjs/docsify/commit/049726e))
+
+
+### Features
+
+* **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))
+
+
+
+
+## [4.8.6](https://github.com/docsifyjs/docsify/compare/v4.8.5...v4.8.6) (2018-11-12)
+
+
+### Bug Fixes
+
+* IE10 compatibility ([#691](https://github.com/docsifyjs/docsify/issues/691)) ([4db8cd6](https://github.com/docsifyjs/docsify/commit/4db8cd6))
+
+
+
+
+## [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))
-
-
-### Features
-
-* add navigation plugin, closed [#180](https://github.com/QingWei-Li/docsify/issues/180) ([f78be4c](https://github.com/QingWei-Li/docsify/commit/f78be4c))
-
-
+- 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))
-
-
+- 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))
-
-
+- **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)
-
-
+- 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))
-
+- **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))
-
-
+- 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))
-
-
+- 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))
-
-
+- 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))
-
-
+- 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))
-
-
+- 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))
-
-
+- {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))
-
+- 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))
-
-
+- 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))
-
-
+- 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))
-
-
+- 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))
-
+- 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))
-
-
+- 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))
-
-
+- 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))
-
-
+- 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))
-
-
+- 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))
-
-
+- 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))
-
-
+- **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))
-
-
+- **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))
-
-
+- 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))
-
+- 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))
-
-
+- **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))
-
-
+- 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))
-
+- **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))
-
-
+- 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))
-
+- 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))
-
-
+- 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))
-
-
+- **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))
-
-
+- **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)
+- 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))
-
-
+- **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))
-
-
+- **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))
-
-
+- **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)
+## [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))
+- **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)
+## [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))
-
-
+- **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)
+## [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))
-
-
+- 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))
-
+- 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))
-
-
+- 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)
-
+- 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))
-
-
+- 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))
-
-
+- **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))
-
-
+- **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))
-
-
+- **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))
-
-
+- 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))
-
+- 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))
-
-
+- 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))
-
-
+- **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))
-
-
+- **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))
-
-
+- **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))
-
-
+- **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))
-
-
+- 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))
-
-
+- 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))
-
-
+- 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))
-
-
+- 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))
-
-
+- **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)
+# [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))
-
+- **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))
-
-
+- finish ssr ([3444884](https://github.com/QingWei-Li/docsify/commit/3444884))
+- init ocsify-server-renderer ([6dea685](https://github.com/QingWei-Li/docsify/commit/6dea685))
+- support history mode ([f095eb8](https://github.com/QingWei-Li/docsify/commit/f095eb8))
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
new file mode 100644
index 0000000..77d2ce7
--- /dev/null
+++ b/CONTRIBUTING.md
@@ -0,0 +1,67 @@
+# Contribute
+
+## Introduction
+
+First, thank you for considering contributing to docsify! It's people like you that make the open source community such a great community! 😊
+
+We welcome any type of contribution, not only code. You can help with
+- **QA**: file bug reports, the more details you can give the better (e.g. screenshots with the console open)
+- **Marketing**: writing blog posts, howto's, printing stickers, ...
+- **Community**: presenting the project at meetups, organizing a dedicated meetup for the local community, ...
+- **Code**: take a look at the [open issues](issues). Even if you can't write code, commenting on them, showing that you care about a given issue matters. It helps us triage them.
+- **Money**: we welcome financial contributions in full transparency on our [open collective](https://opencollective.com/docsify).
+
+## Your First Contribution
+
+Working on your first Pull Request? You can learn how from this *free* series, [How to Contribute to an Open Source Project on GitHub](https://egghead.io/series/how-to-contribute-to-an-open-source-project-on-github).
+
+## Submitting code
+
+Any code change should be submitted as a pull request. The description should explain what the code does and give steps to execute it. The pull request should also contain tests.
+
+## Code review process
+
+The bigger the pull request, the longer it will take to review and merge. Try to break down large pull requests in smaller chunks that are easier to review and merge.
+It is also always helpful to have some context for your pull request. What was the purpose? Why does it matter to you?
+
+## Financial contributions
+
+We also welcome financial contributions in full transparency on our [open collective](https://opencollective.com/docsify).
+Anyone can file an expense. If the expense makes sense for the development of the community, it will be "merged" in the ledger of our open collective by the core contributors and the person who filed the expense will be reimbursed.
+
+## Questions
+
+If you have any questions, create an [issue](issue) (protip: do a quick search first to see if someone else didn't ask the same question before!).
+You can also reach us at hello@docsify.opencollective.com.
+
+## Credits
+
+### Contributors
+
+Thank you to all the people who have already contributed to docsify!
+
+
+
+### Backers
+
+Thank you to all our backers! [[Become a backer](https://opencollective.com/docsify#backer)]
+
+
+
+
+### Sponsors
+
+Thank you to all our sponsors! (please ask your company to also support this open source project by [becoming a sponsor](https://opencollective.com/docsify#sponsor))
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/README.md b/README.md
index 79124e1..b8da0d8 100644
--- a/README.md
+++ b/README.md
@@ -9,45 +9,53 @@
Glod Sponsor via Open Collective
+Gold Sponsor via Open Collective
+ ## Links -* [Documentation](https://docsify.js.org) -* [CLI](https://github.com/QingWei-Li/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/QingWei-Li/awesome-docsify) +- [`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) ## Features -* No statically built html files -* Simple and lightweight (~18kB gzipped) -* Smart full-text search plugin -* Multiple themes -* Useful plugin API -* Compatible with IE10+ -* Support SSR ([example](https://github.com/QingWei-Li/docsify-ssr-demo)) +- No statically built html files +- Simple and lightweight (~21kB 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 ## Quick start -Look at [this tutorial](https://docsify.js.org/#/quickstart) or [online demo](https://jsfiddle.net/7ztb8qsr/1/). +Look at [this tutorial](https://docsify.js.org/#/quickstart) + +[](https://codesandbox.io/s/307qqv236) ## Showcase These projects are using docsify to generate their sites. Pull requests welcome :blush: -Move to [awesome-docsify](https://github.com/QingWei-Li/awesome-docsify) +Move to [awesome-docsify](https://github.com/docsifyjs/awesome-docsify#showcase) ## Similar projects @@ -58,17 +66,16 @@ Move to [awesome-docsify](https://github.com/QingWei-Li/awesome-docsify) ## Contributing -* Fork it! -* 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 +- Fork it! +- Create your feature branch: `git checkout -b my-new-feature` +- Commit your changes: `git commit -am 'Add some feature'` +- Push to the branch: `git push origin my-new-feature` +- Submit a pull request ## Development ```bash npm run bootstrap && npm run dev -open http://localhost:3000 ``` ## Backers @@ -92,8 +99,13 @@ Support this project by becoming a sponsor. Your logo will show up here with a l" + (content.slice(5).trim()) + "
") -} - -function theme (color) { - return ("") -} - -var barEl; -var timeId; - -/** - * Init progress component - */ -function init () { - var div = create('div'); - - div.classList.add('progress'); - appendTo(body, div); - barEl = div; -} -/** - * Render progress bar - */ -var progressbar = function (ref) { - var loaded = ref.loaded; - var total = ref.total; - var step = ref.step; - - var num; - - !barEl && init(); - - if (step) { - num = parseInt(barEl.style.width || 0, 10) + step; - num = num > 80 ? 80 : num; - } else { - num = Math.floor(loaded / total * 100); - } - - barEl.style.opacity = 1; - barEl.style.width = num >= 95 ? '100%' : num + '%'; - - if (num >= 95) { - clearTimeout(timeId); - timeId = setTimeout(function (_) { - barEl.style.opacity = 0; - barEl.style.width = '0%'; - }, 200); - } -}; - -var cache = {}; - -/** - * Simple ajax get - * @param {string} url - * @param {boolean} [hasBar=false] has progress bar - * @return { then(resolve, reject), abort } - */ -function get (url, hasBar) { - if ( hasBar === void 0 ) hasBar = false; - - var xhr = new XMLHttpRequest(); - var on = function () { - xhr.addEventListener.apply(xhr, arguments); - }; - var cached$$1 = cache[url]; - - if (cached$$1) { - return { then: function (cb) { return cb(cached$$1.content, cached$$1.opt); }, abort: noop } - } - - xhr.open('GET', url); - xhr.send(); - - return { - then: function (success, error) { - if ( error === void 0 ) error = noop; - - if (hasBar) { - var id = setInterval( - function (_) { return progressbar({ - step: Math.floor(Math.random() * 5 + 1) - }); }, - 500 - ); - - on('progress', progressbar); - on('loadend', function (evt) { - progressbar(evt); - clearInterval(id); - }); - } - - on('error', error); - on('load', function (ref) { - var target = ref.target; - - if (target.status >= 400) { - error(target); - } else { - var result = (cache[url] = { - content: target.response, - opt: { - updatedAt: xhr.getResponseHeader('last-modified') - } - }); - - success(result.content, result.opt); - } - }); - }, - abort: function (_) { return xhr.readyState !== 4 && xhr.abort(); } - } -} - -function replaceVar (block, color) { - block.innerHTML = block.innerHTML.replace( - /var\(\s*--theme-color.*?\)/g, - color - ); -} - -var cssVars = function (color) { - // Variable support - if (window.CSS && window.CSS.supports && window.CSS.supports('(--v:red)')) { return } - - var styleBlocks = findAll('style:not(.inserted),link');[].forEach.call(styleBlocks, function (block) { - if (block.nodeName === 'STYLE') { - replaceVar(block, color); - } else if (block.nodeName === 'LINK') { - var href = block.getAttribute('href'); - - if (!/\.css$/.test(href)) { return } - - get(href).then(function (res) { - var style$$1 = create('style', res); - - head.appendChild(style$$1); - replaceVar(style$$1, color); - }); - } - }); -}; - -var RGX = /([^{]*?)\w(?=\})/g; - -var dict = { - YYYY: 'getFullYear', - YY: 'getYear', - MM: function (d) { - return d.getMonth() + 1; - }, - DD: 'getDate', - HH: 'getHours', - mm: 'getMinutes', - ss: 'getSeconds' -}; - -var tinydate = function (str) { - var parts=[], offset=0; - str.replace(RGX, function (key, _, idx) { - // save preceding string - parts.push(str.substring(offset, idx - 1)); - offset = idx += key.length + 1; - // save function - parts.push(function(d){ - return ('00' + (typeof dict[key]==='string' ? d[dict[key]]() : dict[key](d))).slice(-key.length); - }); - }); - - if (offset !== str.length) { - parts.push(str.substring(offset)); - } - - return function (arg) { - var out='', i=0, d=arg||new Date(); - for (; i'
- + (escaped ? code : escape(code, true))
- + '\n';
- }
-
- return ''
- + (escaped ? code : escape(code, true))
- + '\n\n';
-};
-
-Renderer.prototype.blockquote = function(quote) {
- return '\n' + quote + '\n'; -}; - -Renderer.prototype.html = function(html) { - return html; -}; - -Renderer.prototype.heading = function(text, level, raw) { - return '
' + text + '
\n'; -}; - -Renderer.prototype.table = function(header, body) { - return '' + text + '';
-};
-
-Renderer.prototype.br = function() {
- return this.options.xhtml ? '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, - baseUrl: null -}; - -/** - * 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 x(){var e=c("div");e.classList.add("progress"),u(me,e),pe=e}function _(e,t){void 0===t&&(t=!1);var r=new XMLHttpRequest,i=function(){r.addEventListener.apply(r,arguments)},o=_e[e];return o?{then:function(e){return e(o.content,o.opt)},abort:n}:(r.open("GET",e),r.send(),{then:function(o,a){if(void 0===a&&(a=n),t){var s=setInterval(function(e){return xe({step:Math.floor(5*Math.random()+1)})},500);i("progress",xe),i("loadend",function(e){xe(e),clearInterval(s)})}i("error",a),i("load",function(t){var n=t.target;if(n.status>=400)a(n);else{var i=_e[e]={content:n.response,opt:{updatedAt:r.getResponseHeader("last-modified")}};o(i.content,i.opt)}})},abort:function(e){return 4!==r.readyState&&r.abort()}})}function S(e,t){e.innerHTML=e.innerHTML.replace(/var\(\s*--theme-color.*?\)/g,t)}function C(e,t){return t={exports:{}},e(t,t.exports),t.exports}function L(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||[]).concat(e):n.push(e),r[i]=e)}),n}function E(e){return e.toLowerCase()}function $(e){if("string"!=typeof e)return"";var t=e.trim().replace(/[A-Z]+/g,E).replace(/<[^>\d]+>/g,"").replace(Oe,"").replace(/\s/g,"-").replace(/-+/g,"-").replace(/^(\d)/,"_$1"),n=Pe[t];return n=Pe.hasOwnProperty(t)?n+1:0,Pe[t]=n,n&&(t=t+"-"+n),t}function T(e,t){return'
u){t||(t=d);break}t=d}if(t){var f=Be[I(e,t.getAttribute("data-id"))];if(f&&f!==o&&(o&&o.classList.remove("active"),f.classList.add("active"),o=f,!De&&me.classList.contains("sticky"))){var g=n.clientHeight,m=o.offsetTop+o.clientHeight+40,v=o.offsetTop>=i.scrollTop&&m<=i.scrollTop+g,b=m-0
"+o(e.message+"",!0)+"";throw e}}var p={newline:/^\n+/,code:/^( {4}[^\n]+\n*)+/,fences:c,hr:/^( *[-*_]){3,} *(?:\n+|$)/,heading:/^ *(#{1,6}) *([^\n]+?) *#* *(?:\n+|$)/,nptable:c,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:c,paragraph:/^((?:[^\n]+\n?(?!hr|heading|lheading|blockquote|tag|def))+)\n*/,text:/^[^\n]+/};p.bullet=/(?:[*+-]|\d+\.)/,p.item=/^( *)(bull) [^\n]*(?:\n(?!\1bull )[^\n]*)*/,p.item=s(p.item,"gm")(/bull/g,p.bullet)(),p.list=s(p.list)(/bull/g,p.bullet)("hr","\\n+(?=\\1?(?:[-*_] *){3,}(?:\\n+|$))")("def","\\n+(?="+p.def.source+")")(),p._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",p.html=s(p.html)("comment",//)("closed",/<(tag)[\s\S]+?<\/\1>/)("closing",/
'+(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"
"+e+"
\n"},r.prototype.table=function(e,t){return""+e+""},r.prototype.br=function(){return this.options.xhtml?"${post.content}
@@ -102,12 +148,18 @@ function doSearch (value) { }) $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 () { +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 @@ -120,12 +172,21 @@ function bindEvents () { 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) { +function updatePlaceholder(text, path) { const $input = Docsify.dom.getNode('.search input[type="search"]') - if (!$input) return + if (!$input) { + return + } if (typeof text === 'string') { $input.placeholder = text } else { @@ -134,7 +195,7 @@ function updatePlaceholder (text, path) { } } -function updateNoData (text, path) { +function updateNoData(text, path) { if (typeof text === 'string') { NO_DATA_TEXT = text } else { @@ -143,16 +204,22 @@ function updateNoData (text, path) { } } -export function init (opts, vm) { +function updateOptions(opts) { + options = opts +} + +export function init(opts, vm) { const keywords = vm.router.parse().query.s + updateOptions(opts) style() - tpl(opts, keywords) + tpl(keywords) bindEvents() keywords && setTimeout(_ => doSearch(keywords), 500) } -export function update (opts, vm) { +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 index 66e5fba..bbd3af6 100644 --- a/src/plugins/search/index.js +++ b/src/plugins/search/index.js @@ -1,16 +1,18 @@ -import { init as initComponet, update as updateComponent } from './component' -import { init as initSearch } from './search' +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 + maxAge: 86400000, // 1 day + hideOtherSidebarContent: false, + namespace: undefined } const install = function (hook, vm) { - const { util } = Docsify + const {util} = Docsify const opts = vm.config.search || CONFIG if (Array.isArray(opts)) { @@ -21,6 +23,8 @@ const install = function (hook, vm) { 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' diff --git a/src/plugins/search/search.js b/src/plugins/search/search.js index 7ecf21a..2c9febf 100644 --- a/src/plugins/search/search.js +++ b/src/plugins/search/search.js @@ -1,7 +1,18 @@ let INDEXS = {} -let helper -function escapeHtml (string) { +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 = { '&': '&', '<': '<', @@ -11,34 +22,35 @@ function escapeHtml (string) { '/': '/' } - return String(string).replace(/[&<>"'\/]/g, s => entityMap[s]) + return String(string).replace(/[&<>"'/]/g, s => entityMap[s]) } -function getAllPaths (router) { +function getAllPaths(router) { const paths = [] - helper.dom.findAll('a:not([data-nosearch])') - .map(node => { - const href = node.href - const originHref = node.getAttribute('href') - const path = router.parse(href).path + 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) - } - }) + if ( + path && + paths.indexOf(path) === -1 && + !Docsify.util.isAbsolutePath(originHref) + ) { + paths.push(path) + } + }) return paths } -function saveData (maxAge) { - localStorage.setItem('docsify.search.expires', Date.now() + maxAge) - localStorage.setItem('docsify.search.index', JSON.stringify(INDEXS)) +function saveData(maxAge, expireKey, indexKey) { + localStorage.setItem(expireKey, Date.now() + maxAge) + localStorage.setItem(indexKey, JSON.stringify(INDEXS)) } -export function genIndex (path, content = '', router, depth) { +export function genIndex(path, content = '', router, depth) { const tokens = window.marked.lexer(content) const slugify = window.Docsify.slugify const index = {} @@ -46,18 +58,18 @@ export function genIndex (path, content = '', router, depth) { 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: '' } + slug = router.toURL(path, {id: slugify(token.text)}) + index[slug] = {slug, title: token.text, body: ''} } else { - if (!slug) return + if (!slug) { + return + } if (!index[slug]) { - index[slug] = { slug, title: '', body: '' } + index[slug] = {slug, title: '', body: ''} + } else if (index[slug].body) { + index[slug].body += '\n' + (token.text || '') } else { - if (index[slug].body) { - index[slug].body += '\n' + (token.text || '') - } else { - index[slug].body = token.text - } + index[slug].body = token.text } } }) @@ -69,7 +81,7 @@ export function genIndex (path, content = '', router, depth) { * @param {String} query * @returns {Array} */ -export function search (query) { +export function search(query) { const matchingResults = [] let data = [] Object.keys(INDEXS).forEach(key => { @@ -77,33 +89,37 @@ export function search (query) { }) query = query.trim() - let keywords = query.split(/[\s\-\,\\/]+/) + 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 isMatch = false + 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 && postContent) { - keywords.forEach((keyword, i) => { - const regEx = new RegExp(keyword, 'gi') + 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) - indexContent = postContent && postContent.search(regEx) + indexTitle = postTitle ? postTitle.search(regEx) : -1 + indexContent = postContent ? postContent.search(regEx) : -1 - if (indexTitle < 0 && indexContent < 0) { - isMatch = false - } else { - isMatch = true - if (indexContent < 0) indexContent = 0 + if (indexTitle >= 0 || indexContent >= 0) { + matchesScore += indexTitle >= 0 ? 3 : indexContent >= 0 ? 2 : 0; + if (indexContent < 0) { + indexContent = 0 + } let start = 0 let end = 0 @@ -111,23 +127,27 @@ export function search (query) { start = indexContent < 11 ? 0 : indexContent - 10 end = start === 0 ? 70 : indexContent + keyword.length + 60 - if (end > postContent.length) end = postContent.length + if (end > postContent.length) { + end = postContent.length + } - const matchContent = '...' + + const matchContent = + '...' + escapeHtml(postContent) .substring(start, end) .replace(regEx, `${keyword}`) + - '...' + '...' resultStr += matchContent } }) - if (isMatch) { + if (matchesScore > 0) { const matchingPost = { title: escapeHtml(postTitle), - content: resultStr, - url: postUrl + content: postContent ? resultStr : '', + url: postUrl, + score: matchesScore } matchingResults.push(matchingPost) @@ -135,16 +155,18 @@ export function search (query) { } } - return matchingResults + return matchingResults.sort((r1, r2) => r2.score - r1.score); } -export function init (config, vm) { - helper = Docsify - +export function init(config, vm) { const isAuto = config.paths === 'auto' - const isExpired = localStorage.getItem('docsify.search.expires') < Date.now() - INDEXS = JSON.parse(localStorage.getItem('docsify.search.index')) + const expireKey = resolveExpireKey(config.namespace) + const indexKey = resolveIndexKey(config.namespace) + + const isExpired = localStorage.getItem(expireKey) < Date.now() + + INDEXS = JSON.parse(localStorage.getItem(indexKey)) if (isExpired) { INDEXS = {} @@ -157,14 +179,15 @@ export function init (config, vm) { let count = 0 paths.forEach(path => { - if (INDEXS[path]) return count++ + if (INDEXS[path]) { + return count++ + } - helper - .get(vm.router.getFile(path)) + 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) + len === ++count && saveData(config.maxAge, expireKey, indexKey) }) }) } - diff --git a/src/plugins/zoom-image.js b/src/plugins/zoom-image.js index 6f3b94c..faf92e1 100644 --- a/src/plugins/zoom-image.js +++ b/src/plugins/zoom-image.js @@ -1,14 +1,20 @@ import mediumZoom from 'medium-zoom' -function install (hook) { +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('img:not(.emoji):not([data-no-zoom])') + zoom = mediumZoom(elms) }) } diff --git a/src/themes/basic/_coverpage.css b/src/themes/basic/_coverpage.css deleted file mode 100644 index c4d3dac..0000000 --- a/src/themes/basic/_coverpage.css +++ /dev/null @@ -1,113 +0,0 @@ -section.cover { - align-items: center; - background-position: center center; - background-repeat: no-repeat; - background-size: cover; - height: 100vh; - display: none; - - &.show { - display: flex; - } - - &.has-mask .mask { - background-color: $color-bg; - opacity: 0.8; - position: absolute; - top: 0; - size: 100%; - } - - .cover-main { - flex: 1; - margin: -20px 16px 0; - text-align: center; - z-index: 1; - } - - a { - color: inherit; - text-decoration: none; - - &:hover { - text-decoration: none; - } - } - - p { - line-height: 1.5rem; - margin: 1em 0; - } - - h1 { - color: inherit; - font-size: 2.5rem; - font-weight: 300; - margin: 0.625rem 0 2.5rem; - position: relative; - text-align: center; - - a { - display: block; - } - - small { - bottom: -.4375rem; - font-size: 1rem; - position: absolute; - } - } - - blockquote { - font-size: 1.5rem; - text-align: center; - } - - ul { - line-height: 1.8; - list-style-type: none; - margin: 1em auto; - max-width: 500px; - padding: 0; - } - - .cover-main > p:last-child a { - border-color: var(--theme-color, $color-primary); - border-radius: 2rem; - border-style: solid; - border-width: 1px; - box-sizing: border-box; - color: var(--theme-color, $color-primary); - display: inline-block; - font-size: 1.05rem; - letter-spacing: 0.1rem; - margin-right: 1rem; - padding: 0.75em 2rem; - text-decoration: none; - transition: all 0.15s ease; - - &:last-child { - background-color: var(--theme-color, $color-primary); - color: #fff; - margin-right: 0; - - &:hover { - color: inherit; - opacity: 0.8; - } - } - - &:hover { - color: inherit; - } - } - - blockquote > p > a { - border-bottom: 2px solid var(--theme-color, $color-primary); - transition: color 0.3s; - - &:hover { - color: var(--theme-color, $color-primary); - } - } -} diff --git a/src/themes/basic/_coverpage.styl b/src/themes/basic/_coverpage.styl new file mode 100644 index 0000000..0014932 --- /dev/null +++ b/src/themes/basic/_coverpage.styl @@ -0,0 +1,95 @@ +section.cover + align-items center + background-position center center + background-repeat no-repeat + background-size cover + height 100vh + display none + + &.show + display flex + + &.has-mask .mask + background-color $color-bg + opacity 0.8 + position absolute + top 0 + height 100% + width 100% + + .cover-main + flex 1 + margin -20px 16px 0 + text-align center + z-index 1 + + a + color inherit + text-decoration none + + &:hover + text-decoration none + + p + line-height 1.5rem + margin 1em 0 + + h1 + color inherit + font-size 2.5rem + font-weight 300 + margin 0.625rem 0 2.5rem + position relative + text-align center + + a + display block + + small + bottom -0.4375rem + font-size 1rem + position absolute + + blockquote + font-size 1.5rem + text-align center + + ul + line-height 1.8 + list-style-type none + margin 1em auto + max-width 500px + padding 0 + + .cover-main > p:last-child a + border-color var(--theme-color, $color-primary) + border-radius 2rem + border-style solid + border-width 1px + box-sizing border-box + color var(--theme-color, $color-primary) + display inline-block + font-size 1.05rem + letter-spacing 0.1rem + margin 0.5rem 1rem + padding 0.75em 2rem + text-decoration none + transition all 0.15s ease + + &:last-child + background-color var(--theme-color, $color-primary) + color #fff + + &:hover + color inherit + opacity 0.8 + + &:hover + color inherit + + blockquote > p > a + border-bottom 2px solid var(--theme-color, $color-primary) + transition color 0.3s + + &:hover + color var(--theme-color, $color-primary) diff --git a/src/themes/basic/_layout.css b/src/themes/basic/_layout.css deleted file mode 100644 index dec39eb..0000000 --- a/src/themes/basic/_layout.css +++ /dev/null @@ -1,558 +0,0 @@ -* { - -webkit-font-smoothing: antialiased; - -webkit-overflow-scrolling: touch; - -webkit-tap-highlight-color: rgba(0, 0, 0, 0); - -webkit-text-size-adjust: none; - -webkit-touch-callout: none; - box-sizing: border-box; -} - -body:not(.ready) { - overflow: hidden; - - [data-cloak], - .app-nav, - > nav { - display: none; - } -} - -div#app { - font-size: 30px; - font-weight: lighter; - margin: 40vh auto; - text-align: center; - - &:empty::before { - content: 'Loading...'; - } -} - -.emoji { - height: 1.2rem; - vertical-align: middle; -} - -.progress { - background-color: var(--theme-color, $color-primary); - height: 2px; - left: 0px; - position: fixed; - right: 0px; - top: 0px; - transition: width 0.2s, opacity 0.4s; - width: 0%; - z-index: 999999; -} - -.search a:hover { - color: var(--theme-color, $color-primary); -} - -.search .search-keyword { - color: var(--theme-color, $color-primary); - font-style: normal; - font-weight: bold; -} - -html, -body { - height: 100%; -} - -body { - -moz-osx-font-smoothing: grayscale; - -webkit-font-smoothing: antialiased; - color: $color-text; - font-family: 'Source Sans Pro', 'Helvetica Neue', Arial, sans-serif; - font-size: 15px; - letter-spacing: 0; - margin: 0; - overflow-x: hidden; -} - -img { - max-width: 100%; -} - -a[disabled] { - cursor: not-allowed; - opacity: 0.6; -} - -kbd { - border: solid 1px #ccc; - border-radius: 3px; - display: inline-block; - font-size: 12px !important; - line-height: 12px; - margin-bottom: 3px; - padding: 3px 5px; - vertical-align: middle; -} - -.task-list-item { - list-style-type: none; -} - -li input[type=checkbox] { - margin: 0 0.2em 0.25em -1.6em; - vertical-align: middle; -} - -/* navbar */ -.app-nav { - left: 0; - margin: 25px 60px 0 0; - position: absolute; - right: 0; - text-align: right; - z-index: 10; - - &.no-badge { - margin-right: 25px; - } - - p { - margin: 0; - } - - > a { - margin: 0 1rem; - padding: 5px 0; - } - - ul, - li { - display: inline-block; - list-style: none; - margin: 0; - } - - a { - color: inherit; - font-size: 16px; - text-decoration: none; - transition: color 0.3s; - - &:hover { - color: var(--theme-color, $color-primary); - } - - &.active { - border-bottom: 2px solid var(--theme-color, $color-primary); - color: var(--theme-color, $color-primary); - } - } - - /* navbar dropdown */ - li { - display: inline-block; - margin: 0 1rem; - padding: 5px 0; - position: relative; - - ul { - background-color: #fff; - border: 1px solid #ddd; - border-bottom-color: #ccc; - border-radius: 4px; - box-sizing: border-box; - display: none; - max-height: calc(100vh - 61px); - overflow-y: scroll; - padding: 10px 0; - position: absolute; - right: -15px; - text-align: left; - top: 100%; - white-space: nowrap; - - li { - display: block; - font-size: 14px; - line-height: 1rem; - margin: 0; - margin: 8px 14px; - white-space: nowrap; - } - - a { - display: block; - font-size: inherit; - margin: 0; - padding: 0; - - &.active { - border-bottom: 0; - } - } - } - - &:hover ul { - display: block; - } - } -} - -/* github corner */ -.github-corner { - border-bottom: 0; - position: fixed; - right: 0; - text-decoration: none; - top: 0; - z-index: 1; - - &:hover .octo-arm { - animation: octocat-wave 560ms ease-in-out; - } - - svg { - color: $color-bg; - fill: var(--theme-color, $color-primary); - height: 80px; - width: 80px; - } -} - -/* main */ -main { - display: block; - position: relative; - size: 100vw 100%; - z-index: 0; -} - -.anchor { - display: inline-block; - text-decoration: none; - transition: all 0.3s; - - span { - color: $color-text; - } - - &:hover { - text-decoration: underline; - } -} - -/* sidebar */ -.sidebar { - border-right: 1px solid rgba(0, 0, 0, 0.07); - overflow-y: auto; - padding: 40px 0 0; - position: absolute 0 * 0 0; - transition: transform 250ms ease-out; - width: $sidebar-width; - z-index: 20; - - > h1 { - margin: 0 auto 1rem; - font-size: 1.5rem; - font-weight: 300; - text-align: center; - - a { - color: inherit; - text-decoration: none; - } - - .app-nav { - display: block; - position: static; - } - } - - .sidebar-nav { - line-height: 2em; - padding-bottom: 40px; - } - - ul { - margin: 0; - padding: 0; - } - - li > p { - font-weight: 700; - margin: 0; - } - - ul, - ul li { - list-style: none; - } - - ul li a { - border-bottom: none; - display: block; - } - - ul li ul { - padding-left: 20px; - } - - &::-webkit-scrollbar { - width: 4px; - } - - &::-webkit-scrollbar-thumb { - background: transparent; - border-radius: 4px; - } - - &:hover::-webkit-scrollbar-thumb { - background: rgba(136, 136, 136, 0.4); - } - - &:hover::-webkit-scrollbar-track { - background: rgba(136, 136, 136, 0.1); - } -} - -/* sidebar toggle */ -.sidebar-toggle { - background-color: transparent; - background-color: rgba($color-bg, 0.8); - border: 0; - outline: none; - outline: none; - padding: 10px; - position: absolute * * 0 0; - text-align: center; - transition: opacity 0.3s; - width: 30px; - width: calc($sidebar-width - 16px); - z-index: 30; - - .sidebar-toggle-button:hover { - opacity: 0.4; - } - - span { - background-color: var(--theme-color, $color-primary); - display: block; - margin-bottom: 4px; - size: 16px 2px; - } -} - -body.sticky { - .sidebar, - .sidebar-toggle { - position: fixed; - } -} - -/* main content */ -.content { - padding-top: 60px; - position: absolute 0 0 0 $sidebar-width; - transition: left 250ms ease; -} - -/* markdown content found on pages */ -.markdown-section { - margin: 0 auto; - max-width: 800px; - padding: 30px 15px 40px 15px; - position: relative; - - > * { - box-sizing: border-box; - font-size: inherit; - } - - > :first-child { - margin-top: 0 !important; - } -} - -.markdown-section hr { - border: none; - border-bottom: 1px solid #eee; - margin: 2em 0; -} - -.markdown-section table { - border-collapse: collapse; - border-spacing: 0; - display: block; - margin-bottom: 1rem; - overflow: auto; - width: 100%; -} - -.markdown-section th { - border: 1px solid #ddd; - font-weight: bold; - padding: 6px 13px; -} - -.markdown-section td { - border: 1px solid #ddd; - padding: 6px 13px; -} - -.markdown-section tr { - border-top: 1px solid #ccc; - &:nth-child(2n) { - background-color: #f8f8f8; - } -} - -.markdown-section p.tip { - background-color: #f8f8f8; - border-bottom-right-radius: 2px; - border-left: 4px solid #f66; - border-top-right-radius: 2px; - margin: 2em 0; - padding: 12px 24px 12px 30px; - position: relative; - - &:before { - background-color: #f66; - border-radius: 100%; - color: $color-bg; - content: '!'; - font-family: 'Dosis', 'Source Sans Pro', 'Helvetica Neue', Arial, sans-serif; - font-size: 14px; - font-weight: bold; - left: -12px; - line-height: 20px; - position: absolute; - size: 20px; - text-align: center; - top: 14px; - } - - code { - background-color: #efefef; - } - - em { - color: $color-text; - } -} - -.markdown-section p.warn { - background: rgba($color-primary, 0.1); - border-radius: 2px; - padding: 1rem; -} - -body.close { - .sidebar { - transform: translateX(-$sidebar-width); - } - - .sidebar-toggle { - width: auto; - } - - .content { - left: 0; - } -} - -@media print { - .github-corner, - .sidebar-toggle, - .sidebar, - .app-nav { - display: none; - } -} - -@media screen and (max-width: 768px) { - .github-corner, - .sidebar-toggle, - .sidebar { - position: fixed; - } - - .app-nav { - margin-top: 16px; - } - - .app-nav li ul { - top: 30px; - } - - main { - height: auto; - overflow-x: hidden; - } - - .sidebar { - left: -$sidebar-width; - transition: transform 250ms ease-out; - } - - .content { - left: 0; - max-width: 100vw; - position: static; - padding-top: 20px; - transition: transform 250ms ease; - } - - .app-nav, - .github-corner { - transition: transform 250ms ease-out; - } - - .sidebar-toggle { - background-color: transparent; - width: auto; - padding: 30px 30px 10px 10px; - } - - body.close { - .sidebar { - transform: translateX($sidebar-width); - } - - .sidebar-toggle { - background-color: rgba($color-bg, 0.8); - transition: 1s background-color; - width: calc($sidebar-width - 16px); - padding: 10px; - } - - .content { - transform: translateX($sidebar-width); - } - - .app-nav, - .github-corner { - display: none; - } - } - - .github-corner { - &:hover .octo-arm { - animation: none; - } - .octo-arm { - animation: octocat-wave 560ms ease-in-out; - } - } -} - -@keyframes octocat-wave { - 0%, - 100% { - transform: rotate(0); - } - 20%, - 60% { - transform: rotate(-25deg); - } - 40%, - 80% { - transform: rotate(10deg); - } -} diff --git a/src/themes/basic/_layout.styl b/src/themes/basic/_layout.styl new file mode 100644 index 0000000..387fd79 --- /dev/null +++ b/src/themes/basic/_layout.styl @@ -0,0 +1,470 @@ +* + -webkit-font-smoothing antialiased + -webkit-overflow-scrolling touch + -webkit-tap-highlight-color rgba(0, 0, 0, 0) + -webkit-text-size-adjust none + -webkit-touch-callout none + box-sizing border-box + +body:not(.ready) + overflow hidden + + [data-cloak], .app-nav, > nav + display none + +div#app + font-size 30px + font-weight lighter + margin 40vh auto + text-align center + + &:empty::before + content 'Loading...' + +.emoji + height 1.2rem + vertical-align middle + +.progress + background-color var(--theme-color, $color-primary) + height 2px + left 0px + position fixed + right 0px + top 0px + transition width 0.2s, opacity 0.4s + width 0% + z-index 999999 + +.search a:hover + color var(--theme-color, $color-primary) + +.search .search-keyword + color var(--theme-color, $color-primary) + font-style normal + font-weight bold + +html, body + height 100% + +body + -moz-osx-font-smoothing grayscale + -webkit-font-smoothing antialiased + color $color-text + font-family 'Source Sans Pro', 'Helvetica Neue', Arial, sans-serif + font-size 15px + letter-spacing 0 + margin 0 + overflow-x hidden + +img + max-width 100% + +a[disabled] + cursor not-allowed + opacity 0.6 + +kbd + border solid 1px #ccc + border-radius 3px + display inline-block + font-size 12px !important + line-height 12px + margin-bottom 3px + padding 3px 5px + vertical-align middle + +li input[type='checkbox'] + margin 0 0.2em 0.25em 0 + vertical-align middle + +/* navbar */ +.app-nav + margin 25px 60px 0 0 + position absolute + right 0 + text-align right + z-index 10 + + &.no-badge + margin-right 25px + + p + margin 0 + + > a + margin 0 1rem + padding 5px 0 + + ul, li + display inline-block + list-style none + margin 0 + + a + color inherit + font-size 16px + text-decoration none + transition color 0.3s + + &:hover + color var(--theme-color, $color-primary) + + &.active + border-bottom 2px solid var(--theme-color, $color-primary) + color var(--theme-color, $color-primary) + + /* navbar dropdown */ + li + display inline-block + margin 0 1rem + padding 5px 0 + position relative + + ul + background-color #fff + border 1px solid #ddd + border-bottom-color #ccc + border-radius 4px + box-sizing border-box + display none + max-height calc(100vh - 61px) + overflow-y auto + padding 10px 0 + position absolute + right -15px + text-align left + top 100% + white-space nowrap + + li + display block + font-size 14px + line-height 1rem + margin 0 + margin 8px 14px + white-space nowrap + + a + display block + font-size inherit + margin 0 + padding 0 + + &.active + border-bottom 0 + + &:hover ul + display block + +/* github corner */ +.github-corner + border-bottom 0 + position fixed + right 0 + text-decoration none + top 0 + z-index 1 + + &:hover .octo-arm + animation octocat-wave 560ms ease-in-out + + svg + color $color-bg + fill var(--theme-color, $color-primary) + height 80px + width 80px + +/* main */ +main + display block + position relative + width 100vw + height 100% + z-index 0 + +main.hidden + display none + +.anchor + display inline-block + text-decoration none + transition all 0.3s + + span + color $color-text + + &:hover + text-decoration underline + +/* sidebar */ +.sidebar + border-right 1px solid rgba(0, 0, 0, 0.07) + overflow-y auto + padding 40px 0 0 + position absolute + top 0 + bottom 0 + left 0 + transition transform 250ms ease-out + width $sidebar-width + z-index 20 + + > h1 + margin 0 auto 1rem + font-size 1.5rem + font-weight 300 + text-align center + + a + color inherit + text-decoration none + + .app-nav + display block + position static + + .sidebar-nav + line-height 2em + padding-bottom 40px + + li.collapse + .app-sub-sidebar + display none + + ul + margin 0 0 0 15px + padding 0 + + li > p + font-weight 700 + margin 0 + + ul, ul li + list-style none + + ul li a + border-bottom none + display block + + ul li ul + padding-left 20px + + &::-webkit-scrollbar + width 4px + + &::-webkit-scrollbar-thumb + background transparent + border-radius 4px + + &:hover::-webkit-scrollbar-thumb + background rgba(136, 136, 136, 0.4) + + &:hover::-webkit-scrollbar-track + background rgba(136, 136, 136, 0.1) + +/* sidebar toggle */ +.sidebar-toggle + background-color transparent + background-color rgba($color-bg, 0.8) + border 0 + outline none + padding 10px + position absolute + bottom 0 + left 0 + text-align center + transition opacity 0.3s + width $sidebar-width - 16px + z-index 30 + + .sidebar-toggle-button:hover + opacity 0.4 + + span + background-color var(--theme-color, $color-primary) + display block + margin-bottom 4px + width 16px + height 2px + +body.sticky + .sidebar, .sidebar-toggle + position fixed + +/* main content */ +.content + padding-top 60px + position absolute + top 0 + right 0 + bottom 0 + left $sidebar-width + transition left 250ms ease + +/* markdown content found on pages */ +.markdown-section + margin 0 auto + max-width 800px + padding 30px 15px 40px 15px + position relative + + > * + box-sizing border-box + font-size inherit + + > :first-child + margin-top 0 !important + +.markdown-section hr + border none + border-bottom 1px solid #eee + margin 2em 0 + +.markdown-section iframe + border 1px solid #eee + /* fix horizontal overflow on iOS Safari */ + width 1px + min-width 100% + +.markdown-section table + border-collapse collapse + border-spacing 0 + display block + margin-bottom 1rem + overflow auto + width 100% + +.markdown-section th + border 1px solid #ddd + font-weight bold + padding 6px 13px + +.markdown-section td + border 1px solid #ddd + padding 6px 13px + +.markdown-section tr + border-top 1px solid #ccc + + &:nth-child(2n) + background-color #f8f8f8 + +.markdown-section p.tip + background-color #f8f8f8 + border-bottom-right-radius 2px + border-left 4px solid #f66 + border-top-right-radius 2px + margin 2em 0 + padding 12px 24px 12px 30px + position relative + + &:before + background-color #f66 + border-radius 100% + color $color-bg + content '!' + font-family 'Dosis', 'Source Sans Pro', 'Helvetica Neue', Arial, sans-serif + font-size 14px + font-weight bold + left -12px + line-height 20px + position absolute + height 20px + width 20px + text-align center + top 14px + + code + background-color #efefef + + em + color $color-text + +.markdown-section p.warn + background rgba($color-primary, 0.1) + border-radius 2px + padding 1rem + +.markdown-section ul.task-list > li + list-style-type none + +body.close + .sidebar + transform translateX(- $sidebar-width) + + .sidebar-toggle + width auto + + .content + left 0 + +@media print + .github-corner, .sidebar-toggle, .sidebar, .app-nav + display none + +@media screen and (max-width: 768px) + .github-corner, .sidebar-toggle, .sidebar + position fixed + + .app-nav + margin-top 16px + + .app-nav li ul + top 30px + + main + height auto + overflow-x hidden + + .sidebar + left - $sidebar-width + transition transform 250ms ease-out + + .content + left 0 + max-width 100vw + position static + padding-top 20px + transition transform 250ms ease + + .app-nav, .github-corner + transition transform 250ms ease-out + + .sidebar-toggle + background-color transparent + width auto + padding 30px 30px 10px 10px + + body.close + .sidebar + transform translateX($sidebar-width) + + .sidebar-toggle + background-color rgba($color-bg, 0.8) + transition 1s background-color + width $sidebar-width - 16px + padding 10px + + .content + transform translateX($sidebar-width) + + .app-nav, .github-corner + display none + + .github-corner + &:hover .octo-arm + animation none + + .octo-arm + animation octocat-wave 560ms ease-in-out + +@keyframes octocat-wave + 0%, 100% + transform rotate(0) + + 20%, 60% + transform rotate(-25deg) + + 40%, 80% + transform rotate(10deg) diff --git a/src/themes/buble.css b/src/themes/buble.css deleted file mode 100644 index c27c094..0000000 --- a/src/themes/buble.css +++ /dev/null @@ -1,241 +0,0 @@ -@import url('https://fonts.googleapis.com/css?family=Inconsolata|Inconsolata-Bold'); - -$color-primary: #0074d9; -$color-bg: #fff; -$color-text: #34495e; -$sidebar-width: 16rem; - -@import 'basic/layout'; -@import 'basic/coverpage'; - -/* sidebar */ -.sidebar { - color: #364149; - background-color: $color-bg; - - a { - color: #666; - text-decoration: none; - } - - li { - list-style: none; - margin: 0; - padding: 0.2em 0 0.2em 1rem; - } - - ul li ul { - padding: 0; - } - - li.active { - a { - color: #333; - } - - background-color: #eee; - } -} - -.markdown-section h1, -.markdown-section h2, -.markdown-section h3, -.markdown-section h4, -.markdown-section strong { - color: #333; - font-weight: 400; -} - -.markdown-section a { - color: var(--theme-color, $color-primary); - font-weight: 400; -} - -.markdown-section p, -.markdown-section ul, -.markdown-section ol { - line-height: 1.6rem; - margin: 0 0 1em 0; - word-spacing: 0.05rem; -} - -.markdown-section h1 { - font-size: 2rem; - font-weight: 500; - margin: 0 0 1rem; -} - -.markdown-section h2 { - font-size: 1.8rem; - font-weight: 400; - margin: 0 0 1rem 0; - padding: 1rem 0 0 0; -} - -.markdown-section h3 { - font-size: 1.5rem; - margin: 52px 0 1.2rem; -} - -.markdown-section h4 { - font-size: 1.25rem; -} - -.markdown-section h5 { - font-size: 1rem; -} - -.markdown-section h6 { - color: #777; - font-size: 1rem; -} - -.markdown-section figure, -.markdown-section p, -.markdown-section ul, -.markdown-section ol { - margin: 1.2em 0; -} - -.markdown-section ul, -.markdown-section ol { - padding-left: 1.5rem; -} - -.markdown-section li { - line-height: 1.5; - margin: 0; -} - -.markdown-section blockquote { - border-left: 4px solid var(--theme-color, $color-primary); - color: #858585; - margin: 2em 0; - padding-left: 20px; -} - -.markdown-section blockquote p { - font-weight: 600; - margin-left: 0; -} - -.markdown-section iframe { - margin: 1em 0; -} - -.markdown-section em { - color: #7f8c8d; -} - -.markdown-section code { - background-color: #f9f9f9; - border-radius: 3px; - font-family: Inconsolata; - padding: 0.2em 0.4rem; - white-space: nowrap; -} - -.markdown-section pre { - background-color: #f9f9f9; - border-left: 2px solid #eee; - font-family: Inconsolata; - font-size: 16px; - margin: 0 0 1em 0; - padding: 8px; - padding: 0 10px 12px 0; - overflow: auto; - word-wrap: normal; -} - -/* code highlight */ -.token.cdata, -.token.comment, -.token.doctype, -.token.prolog { - color: #93a1a1; /* base1 */ -} - -.token.punctuation { - color: #586e75; /* base01 */ -} - -.namespace { - opacity: 0.7; -} - -.token.property, -.token.tag, -.token.boolean, -.token.number, -.token.constant, -.token.symbol, -.token.deleted { - color: #268bd2; /* blue */ -} - -.token.selector, -.token.attr-name, -.token.string, -.token.char, -.token.builtin, -.token.url, -.token.inserted { - color: #2aa198; /* cyan */ -} - -.token.entity { - color: #657b83; /* base00 */ - background: #eee8d5; /* base2 */ -} - -.token.atrule, -.token.attr-value, -.token.keyword { - color: #a11; /* green */ -} - -.token.function { - color: #b58900; /* yellow */ -} - -.token.regex, -.token.important, -.token.variable { - color: #cb4b16; /* orange */ -} - -.token.important, -.token.bold { - font-weight: bold; -} -.token.italic { - font-style: italic; -} - -.token.entity { - cursor: help; -} - -.markdown-section pre > code { - background-color: #f8f8f8; - border-radius: 2px; - display: block; - font-family: Inconsolata; - line-height: 1.1rem; - max-width: inherit; - overflow: inherit; - padding: 20px 0.8em 20px; - position: relative; - white-space: inherit; -} - -.markdown-section code::after, -.markdown-section code::before { - letter-spacing: 0.05rem; -} - -code .token { - -webkit-font-smoothing: initial; - -moz-osx-font-smoothing: initial; - min-height: 1.5rem; -} diff --git a/src/themes/buble.styl b/src/themes/buble.styl new file mode 100644 index 0000000..53fbc15 --- /dev/null +++ b/src/themes/buble.styl @@ -0,0 +1,173 @@ +@import url('https://fonts.googleapis.com/css?family=Inconsolata|Inconsolata-Bold') + +$color-primary = #0074d9 +$color-bg = #fff +$color-text = #34495e +$sidebar-width = 16rem + +@import 'basic/_layout' +@import 'basic/_coverpage' + +/* sidebar */ +.sidebar + color #364149 + background-color $color-bg + + a + color #666 + text-decoration none + + li + list-style none + margin 0 + padding 0.2em 0 0.2em 0 + + ul li ul + padding 0 + + li.active + a + color #333 + + background-color #eee + +.markdown-section h1, .markdown-section h2, .markdown-section h3, .markdown-section h4, .markdown-section strong + color #333 + font-weight 400 + +.markdown-section a + color var(--theme-color, $color-primary) + font-weight 400 + +.markdown-section p, .markdown-section ul, .markdown-section ol + line-height 1.6rem + margin 0 0 1em 0 + word-spacing 0.05rem + +.markdown-section h1 + font-size 2rem + font-weight 500 + margin 0 0 1rem + +.markdown-section h2 + font-size 1.8rem + font-weight 400 + margin 0 0 1rem 0 + padding 1rem 0 0 0 + +.markdown-section h3 + font-size 1.5rem + margin 52px 0 1.2rem + +.markdown-section h4 + font-size 1.25rem + +.markdown-section h5 + font-size 1rem + +.markdown-section h6 + color #777 + font-size 1rem + +.markdown-section figure, .markdown-section p, .markdown-section ul, .markdown-section ol + margin 1.2em 0 + +.markdown-section ul, .markdown-section ol + padding-left 1.5rem + +.markdown-section li + line-height 1.5 + margin 0 + +.markdown-section blockquote + border-left 4px solid var(--theme-color, $color-primary) + color #858585 + margin 2em 0 + padding-left 20px + +.markdown-section blockquote p + font-weight 600 + margin-left 0 + +.markdown-section iframe + margin 1em 0 + +.markdown-section em + color #7f8c8d + +.markdown-section code + background-color #f9f9f9 + border-radius 3px + font-family Inconsolata + padding 0.2em 0.4rem + white-space nowrap + +.markdown-section pre + background-color #f9f9f9 + border-left 2px solid #eee + font-family Inconsolata + font-size 16px + margin 0 0 1em 0 + padding 8px + padding 0 10px 12px 0 + overflow auto + word-wrap normal + position relative + +/* code highlight */ +.token.cdata, .token.comment, .token.doctype, .token.prolog + color #93a1a1 /* base1 */ + +.token.punctuation + color #586e75 /* base01 */ + +.namespace + opacity 0.7 + +.token.property, .token.tag, .token.boolean, .token.number, .token.constant, .token.symbol, .token.deleted + color #268bd2 /* blue */ + +.token.selector, .token.attr-name, .token.string, .token.char, .token.builtin, .token.url, .token.inserted + color #2aa198 /* cyan */ + +.token.entity + color #657b83 /* base00 */ + background #eee8d5 /* base2 */ + +.token.atrule, .token.attr-value, .token.keyword + color #a11 /* green */ + +.token.function + color #b58900 /* yellow */ + +.token.regex, .token.important, .token.variable + color #cb4b16 /* orange */ + +.token.important, .token.bold + font-weight bold + +.token.italic + font-style italic + +.token.entity + cursor help + +.markdown-section pre > code + background-color #f8f8f8 + border-radius 2px + display block + font-family Inconsolata + line-height 1.1rem + max-width inherit + overflow inherit + padding 20px 0.8em 20px + position relative + white-space inherit + +.markdown-section code::after, .markdown-section code::before + letter-spacing 0.05rem + +code .token + -webkit-font-smoothing initial + -moz-osx-font-smoothing initial + min-height 1.5rem diff --git a/src/themes/dark.css b/src/themes/dark.css deleted file mode 100644 index 0301271..0000000 --- a/src/themes/dark.css +++ /dev/null @@ -1,300 +0,0 @@ -@import url('https://fonts.googleapis.com/css?family=Roboto+Mono|Source+Sans+Pro:300,400,600'); - -$color-primary: #ea6f5a; -$color-bg: #3f3f3f; -$color-text: #c8c8c8; -$sidebar-width: 300px; - -@import 'basic/layout'; -@import 'basic/coverpage'; - -body { - background-color: $color-bg; -} - -/* sidebar */ -.sidebar { - background-color: $color-bg; - color: #c8c8c8; - - li { - margin: 6px 15px; - } - - ul li a { - color: #c8c8c8; - font-size: 14px; - overflow: hidden; - text-decoration: none; - text-overflow: ellipsis; - white-space: nowrap; - - &:hover { - text-decoration: underline; - } - } - - ul li ul { - padding: 0; - } - - ul li.active > a { - color: var(--theme-color, $color-primary); - font-weight: 600; - } -} - -/* markdown content found on pages */ -.markdown-section h1, -.markdown-section h2, -.markdown-section h3, -.markdown-section h4, -.markdown-section strong { - color: #657b83; - font-weight: 600; -} - -.markdown-section a { - color: var(--theme-color, $color-primary); - font-weight: 600; -} - -.markdown-section h1 { - font-size: 2rem; - margin: 0 0 1rem; -} - -.markdown-section h2 { - font-size: 1.75rem; - margin: 45px 0 0.8rem; -} - -.markdown-section h3 { - font-size: 1.5rem; - margin: 40px 0 0.6rem; -} - -.markdown-section h4 { - font-size: 1.25rem; -} - -.markdown-section h5 { - font-size: 1rem; -} - -.markdown-section h6 { - color: #777; - font-size: 1rem; -} - -.markdown-section figure, -.markdown-section p, -.markdown-section ul, -.markdown-section ol { - margin: 1.2em 0; -} - -.markdown-section p, -.markdown-section ul, -.markdown-section ol { - line-height: 1.6rem; - word-spacing: 0.05rem; -} - -.markdown-section ul, -.markdown-section ol { - padding-left: 1.5rem; -} - -.markdown-section blockquote { - border-left: 4px solid var(--theme-color, $color-primary); - color: #858585; - margin: 2em 0; - padding-left: 20px; -} - -.markdown-section blockquote p { - font-weight: 600; - margin-left: 0; -} - -.markdown-section iframe { - margin: 1em 0; -} - -.markdown-section em { - color: #7f8c8d; -} - -.markdown-section code { - background-color: #282828; - border-radius: 2px; - color: #657b83; - font-family: 'Roboto Mono', Monaco, courier, monospace; - font-size: 0.8rem; - margin: 0 2px; - padding: 3px 5px; - white-space: pre-wrap; -} - -.markdown-section pre { - -moz-osx-font-smoothing: initial; - -webkit-font-smoothing: initial; - background-color: #282828; - font-family: 'Roboto Mono', Monaco, courier, monospace; - line-height: 1.5rem; - margin: 1.2em 0; - overflow: auto; - padding: 0 1.4rem; - position: relative; - word-wrap: normal; -} - -/* code highlight */ -.token.comment, -.token.prolog, -.token.doctype, -.token.cdata { - color: #8e908c; -} - -.token.namespace { - opacity: 0.7; -} - -.token.boolean, -.token.number { - color: #c76b29; -} - -.token.punctuation { - color: #525252; -} - -.token.property { - color: #c08b30; -} - -.token.tag { - color: #2973b7; -} - -.token.string { - color: var(--theme-color, $color-primary); -} - -.token.selector { - color: #6679cc; -} - -.token.attr-name { - color: #2973b7; -} - -.token.entity, -.token.url, -.language-css .token.string, -.style .token.string { - color: #22a2c9; -} - -.token.attr-value, -.token.control, -.token.directive, -.token.unit { - color: var(--theme-color, $color-primary); -} - -.token.keyword { - color: #e96900; -} - -.token.statement, -.token.regex, -.token.atrule { - color: #22a2c9; -} - -.token.placeholder, -.token.variable { - color: #3d8fd1; -} - -.token.deleted { - text-decoration: line-through; -} - -.token.inserted { - border-bottom: 1px dotted #202746; - text-decoration: none; -} - -.token.italic { - font-style: italic; -} - -.token.important, -.token.bold { - font-weight: bold; -} - -.token.important { - color: #c94922; -} - -.token.entity { - cursor: help; -} - -.markdown-section pre > code { - -moz-osx-font-smoothing: initial; - -webkit-font-smoothing: initial; - background-color: #282828; - border-radius: 2px; - color: #657b83; - display: block; - font-family: 'Roboto Mono', Monaco, courier, monospace; - font-size: 0.8rem; - line-height: inherit; - margin: 0 2px; - max-width: inherit; - overflow: inherit; - padding: 2.2em 5px; - white-space: inherit; -} - -.markdown-section code::after, -.markdown-section code::before { - letter-spacing: 0.05rem; -} - -code .token { - -moz-osx-font-smoothing: initial; - -webkit-font-smoothing: initial; - min-height: 1.5rem; -} - -pre::after { - color: #ccc; - content: attr(data-lang); - font-size: 0.6rem; - font-weight: 600; - height: 15px; - line-height: 15px; - padding: 5px 10px 0; - position: absolute; - right: 0; - text-align: right; - top: 0; -} - -.markdown-section p.tip { - background-color: #282828; - color: #657b83; -} - -input[type='search'] { - background: #4f4f4f; - border-color: #4f4f4f; - color: #c8c8c8; -} diff --git a/src/themes/dark.styl b/src/themes/dark.styl new file mode 100644 index 0000000..02ca630 --- /dev/null +++ b/src/themes/dark.styl @@ -0,0 +1,225 @@ +@import url('https://fonts.googleapis.com/css?family=Roboto+Mono|Source+Sans+Pro:300,400,600') + +$color-primary = #ea6f5a +$color-bg = #3f3f3f +$color-text = #c8c8c8 +$sidebar-width = 300px + +@import 'basic/_layout' +@import 'basic/_coverpage' + +body + background-color $color-bg + +/* sidebar */ +.sidebar + background-color $color-bg + color #c8c8c8 + + li + margin 6px 15px 6px 0 + + ul li a + color #c8c8c8 + font-size 14px + overflow hidden + text-decoration none + text-overflow ellipsis + white-space nowrap + + &:hover + text-decoration underline + + ul li ul + padding 0 + + ul li.active > a + color var(--theme-color, $color-primary) + font-weight 600 + +/* markdown content found on pages */ +.markdown-section h1, .markdown-section h2, .markdown-section h3, .markdown-section h4, .markdown-section strong + color #657b83 + font-weight 600 + +.markdown-section a + color var(--theme-color, $color-primary) + font-weight 600 + +.markdown-section h1 + font-size 2rem + margin 0 0 1rem + +.markdown-section h2 + font-size 1.75rem + margin 45px 0 0.8rem + +.markdown-section h3 + font-size 1.5rem + margin 40px 0 0.6rem + +.markdown-section h4 + font-size 1.25rem + +.markdown-section h5 + font-size 1rem + +.markdown-section h6 + color #777 + font-size 1rem + +.markdown-section figure, .markdown-section p, .markdown-section ul, .markdown-section ol + margin 1.2em 0 + +.markdown-section p, .markdown-section ul, .markdown-section ol + line-height 1.6rem + word-spacing 0.05rem + +.markdown-section ul, .markdown-section ol + padding-left 1.5rem + +.markdown-section blockquote + border-left 4px solid var(--theme-color, $color-primary) + color #858585 + margin 2em 0 + padding-left 20px + +.markdown-section blockquote p + font-weight 600 + margin-left 0 + +.markdown-section iframe + margin 1em 0 + +.markdown-section em + color #7f8c8d + +.markdown-section code + background-color #282828 + border-radius 2px + color #657b83 + font-family 'Roboto Mono', Monaco, courier, monospace + font-size 0.8rem + margin 0 2px + padding 3px 5px + white-space pre-wrap + +.markdown-section pre + -moz-osx-font-smoothing initial + -webkit-font-smoothing initial + background-color #282828 + font-family 'Roboto Mono', Monaco, courier, monospace + line-height 1.5rem + margin 1.2em 0 + overflow auto + padding 0 1.4rem + position relative + word-wrap normal + +/* code highlight */ +.token.comment, .token.prolog, .token.doctype, .token.cdata + color #8e908c + +.token.namespace + opacity 0.7 + +.token.boolean, .token.number + color #c76b29 + +.token.punctuation + color #525252 + +.token.property + color #c08b30 + +.token.tag + color #2973b7 + +.token.string + color var(--theme-color, $color-primary) + +.token.selector + color #6679cc + +.token.attr-name + color #2973b7 + +.token.entity, .token.url, .language-css .token.string, .style .token.string + color #22a2c9 + +.token.attr-value, .token.control, .token.directive, .token.unit + color var(--theme-color, $color-primary) + +.token.keyword + color #e96900 + +.token.statement, .token.regex, .token.atrule + color #22a2c9 + +.token.placeholder, .token.variable + color #3d8fd1 + +.token.deleted + text-decoration line-through + +.token.inserted + border-bottom 1px dotted #202746 + text-decoration none + +.token.italic + font-style italic + +.token.important, .token.bold + font-weight bold + +.token.important + color #c94922 + +.token.entity + cursor help + +.markdown-section pre > code + -moz-osx-font-smoothing initial + -webkit-font-smoothing initial + background-color #282828 + border-radius 2px + color #657b83 + display block + font-family 'Roboto Mono', Monaco, courier, monospace + font-size 0.8rem + line-height inherit + margin 0 2px + max-width inherit + overflow inherit + padding 2.2em 5px + white-space inherit + +.markdown-section code::after, .markdown-section code::before + letter-spacing 0.05rem + +code .token + -moz-osx-font-smoothing initial + -webkit-font-smoothing initial + min-height 1.5rem + +pre::after + color #ccc + content attr(data-lang) + font-size 0.6rem + font-weight 600 + height 15px + line-height 15px + padding 5px 10px 0 + position absolute + right 0 + text-align right + top 0 + +.markdown-section p.tip + background-color #282828 + color #657b83 + +input[type='search'] + background #4f4f4f + border-color #4f4f4f + color #c8c8c8 diff --git a/src/themes/dolphin.styl b/src/themes/dolphin.styl new file mode 100644 index 0000000..f5ea286 --- /dev/null +++ b/src/themes/dolphin.styl @@ -0,0 +1,228 @@ +@import url('https://fonts.googleapis.com/css?family=Thasadith:400,400i,700') + +$color-primary = #00ffff +$color-bg = #f0ffff +$color-text = #34495e +$sidebar-width = 300px + +@import 'basic/_layout' +@import 'basic/_coverpage' + +body + background-color $color-bg + +/* sidebar */ +.sidebar + background-color $color-bg + color #364149 + + li + margin 6px 0 6px 0 + + ul li a + color #505d6b + font-size 14px + font-weight normal + overflow hidden + text-decoration none + text-overflow ellipsis + white-space nowrap + + &:hover + text-decoration underline + + ul li ul + padding 0 + + ul li.active > a + border-right 2px solid + color var(--theme-color, $color-primary) + font-weight 600 + +.app-sub-sidebar + li + &::before + content '-' + padding-right 4px + float left + +/* markdown content found on pages */ +.markdown-section h1, .markdown-section h2, .markdown-section h3, .markdown-section h4, .markdown-section strong + color #2c3e50 + font-weight 600 + +.markdown-section a + color var(--theme-color, $color-primary) + font-weight 600 + + &:hover + text-decoration underline + +.markdown-section h1 + font-size 2rem + margin 0 0 1rem + +.markdown-section h2 + font-size 1.75rem + margin 45px 0 0.8rem + +.markdown-section h3 + font-size 1.5rem + margin 40px 0 0.6rem + +.markdown-section h4 + font-size 1.25rem + +.markdown-section h5 + font-size 1rem + +.markdown-section h6 + color #777 + font-size 1rem + +.markdown-section figure, .markdown-section p + margin 1.2em 0 + +.markdown-section p, .markdown-section ul, .markdown-section ol + line-height 1.6rem + word-spacing 0.05rem + +.markdown-section ul, .markdown-section ol + padding-left 1.5rem + +.markdown-section blockquote + border-left 4px solid var(--theme-color, $color-primary) + color #858585 + margin 2em 0 + padding-left 20px + +.markdown-section blockquote p + font-weight 600 + margin-left 0 + +.markdown-section iframe + margin 1em 0 + +.markdown-section em + color #7f8c8d + +.markdown-section code + background-color #f8f8f8 + border-radius 2px + color #e96900 + font-family 'Roboto Mono', Monaco, courier, monospace + font-size 0.8rem + margin 0 2px + padding 3px 5px + white-space pre-wrap + +.markdown-section pre + -moz-osx-font-smoothing initial + -webkit-font-smoothing initial + background-color #f8f8f8 + font-family 'Roboto Mono', Monaco, courier, monospace + line-height 1.5rem + margin 1.2em 0 + overflow auto + padding 0 1.4rem + position relative + word-wrap normal + +/* code highlight */ +.token.comment, .token.prolog, .token.doctype, .token.cdata + color #8e908c + +.token.namespace + opacity 0.7 + +.token.boolean, .token.number + color #c76b29 + +.token.punctuation + color #525252 + +.token.property + color #c08b30 + +.token.tag + color #2973b7 + +.token.string + color var(--theme-color, $color-primary) + +.token.selector + color #6679cc + +.token.attr-name + color #2973b7 + +.token.entity, .token.url, .language-css .token.string, .style .token.string + color #22a2c9 + +.token.attr-value, .token.control, .token.directive, .token.unit + color var(--theme-color, $color-primary) + +.token.keyword, .token.function + color #e96900 + +.token.statement, .token.regex, .token.atrule + color #22a2c9 + +.token.placeholder, .token.variable + color #3d8fd1 + +.token.deleted + text-decoration line-through + +.token.inserted + border-bottom 1px dotted #202746 + text-decoration none + +.token.italic + font-style italic + +.token.important, .token.bold + font-weight bold + +.token.important + color #c94922 + +.token.entity + cursor help + +.markdown-section pre > code + -moz-osx-font-smoothing initial + -webkit-font-smoothing initial + background-color #f8f8f8 + border-radius 2px + color #525252 + display block + font-family 'Roboto Mono', Monaco, courier, monospace + font-size 0.8rem + line-height inherit + margin 0 2px + max-width inherit + overflow inherit + padding 2.2em 5px + white-space inherit + +.markdown-section code::after, .markdown-section code::before + letter-spacing 0.05rem + +code .token + -moz-osx-font-smoothing initial + -webkit-font-smoothing initial + min-height 1.5rem + +pre::after + color #ccc + content attr(data-lang) + font-size 0.6rem + font-weight 600 + height 15px + line-height 15px + padding 5px 10px 0 + position absolute + right 0 + text-align right + top 0 diff --git a/src/themes/pure.css b/src/themes/pure.css deleted file mode 100644 index 503b412..0000000 --- a/src/themes/pure.css +++ /dev/null @@ -1,6 +0,0 @@ -$color-primary: #000; -$color-bg: #fff; -$color-text: #000; -$sidebar-width: 300px; -@import 'basic/layout'; -@import 'basic/coverpage'; diff --git a/src/themes/pure.styl b/src/themes/pure.styl new file mode 100644 index 0000000..37d0b76 --- /dev/null +++ b/src/themes/pure.styl @@ -0,0 +1,7 @@ +$color-primary = #000 +$color-bg = #fff +$color-text = #000 +$sidebar-width = 300px + +@import 'basic/_layout' +@import 'basic/_coverpage' diff --git a/src/themes/vue.css b/src/themes/vue.css deleted file mode 100644 index e7ce2eb..0000000 --- a/src/themes/vue.css +++ /dev/null @@ -1,299 +0,0 @@ -@import url('https://fonts.googleapis.com/css?family=Roboto+Mono|Source+Sans+Pro:300,400,600'); - -$color-primary: #42b983; -$color-bg: #fff; -$color-text: #34495e; -$sidebar-width: 300px; - -@import 'basic/layout'; -@import 'basic/coverpage'; - -body { - background-color: $color-bg; -} - -/* sidebar */ -.sidebar { - background-color: $color-bg; - color: #364149; - - li { - margin: 6px 0 6px 15px; - } - - ul li a { - color: #505d6b; - font-size: 14px; - font-weight: normal; - overflow: hidden; - text-decoration: none; - text-overflow: ellipsis; - white-space: nowrap; - - &:hover { - text-decoration: underline; - } - } - - ul li ul { - padding: 0; - } - - ul li.active > a { - border-right: 2px solid; - color: var(--theme-color, $color-primary); - font-weight: 600; - } -} - -.app-sub-sidebar { - li { - &::before { - content: '-'; - padding-right: 4px; - float: left; - } - } -} - -/* markdown content found on pages */ -.markdown-section h1, -.markdown-section h2, -.markdown-section h3, -.markdown-section h4, -.markdown-section strong { - color: #2c3e50; - font-weight: 600; -} - -.markdown-section a { - color: var(--theme-color, $color-primary); - font-weight: 600; -} - -.markdown-section h1 { - font-size: 2rem; - margin: 0 0 1rem; -} - -.markdown-section h2 { - font-size: 1.75rem; - margin: 45px 0 0.8rem; -} - -.markdown-section h3 { - font-size: 1.5rem; - margin: 40px 0 0.6rem; -} - -.markdown-section h4 { - font-size: 1.25rem; -} - -.markdown-section h5 { - font-size: 1rem; -} - -.markdown-section h6 { - color: #777; - font-size: 1rem; -} - -.markdown-section figure, -.markdown-section p { - margin: 1.2em 0; -} - -.markdown-section p, -.markdown-section ul, -.markdown-section ol { - line-height: 1.6rem; - word-spacing: 0.05rem; -} - -.markdown-section ul, -.markdown-section ol { - padding-left: 1.5rem; -} - -.markdown-section blockquote { - border-left: 4px solid var(--theme-color, $color-primary); - color: #858585; - margin: 2em 0; - padding-left: 20px; -} - -.markdown-section blockquote p { - font-weight: 600; - margin-left: 0; -} - -.markdown-section iframe { - margin: 1em 0; -} - -.markdown-section em { - color: #7f8c8d; -} - -.markdown-section code { - background-color: #f8f8f8; - border-radius: 2px; - color: #e96900; - font-family: 'Roboto Mono', Monaco, courier, monospace; - font-size: 0.8rem; - margin: 0 2px; - padding: 3px 5px; - white-space: pre-wrap; -} - -.markdown-section pre { - -moz-osx-font-smoothing: initial; - -webkit-font-smoothing: initial; - background-color: #f8f8f8; - font-family: 'Roboto Mono', Monaco, courier, monospace; - line-height: 1.5rem; - margin: 1.2em 0; - overflow: auto; - padding: 0 1.4rem; - position: relative; - word-wrap: normal; -} - -/* code highlight */ -.token.comment, -.token.prolog, -.token.doctype, -.token.cdata { - color: #8e908c; -} - -.token.namespace { - opacity: 0.7; -} - -.token.boolean, -.token.number { - color: #c76b29; -} - -.token.punctuation { - color: #525252; -} - -.token.property { - color: #c08b30; -} - -.token.tag { - color: #2973b7; -} - -.token.string { - color: var(--theme-color, $color-primary); -} - -.token.selector { - color: #6679cc; -} - -.token.attr-name { - color: #2973b7; -} - -.token.entity, -.token.url, -.language-css .token.string, -.style .token.string { - color: #22a2c9; -} - -.token.attr-value, -.token.control, -.token.directive, -.token.unit { - color: var(--theme-color, $color-primary); -} - -.token.keyword { - color: #e96900; -} - -.token.statement, -.token.regex, -.token.atrule { - color: #22a2c9; -} - -.token.placeholder, -.token.variable { - color: #3d8fd1; -} - -.token.deleted { - text-decoration: line-through; -} - -.token.inserted { - border-bottom: 1px dotted #202746; - text-decoration: none; -} - -.token.italic { - font-style: italic; -} - -.token.important, -.token.bold { - font-weight: bold; -} - -.token.important { - color: #c94922; -} - -.token.entity { - cursor: help; -} - -.markdown-section pre > code { - -moz-osx-font-smoothing: initial; - -webkit-font-smoothing: initial; - background-color: #f8f8f8; - border-radius: 2px; - color: #525252; - display: block; - font-family: 'Roboto Mono', Monaco, courier, monospace; - font-size: 0.8rem; - line-height: inherit; - margin: 0 2px; - max-width: inherit; - overflow: inherit; - padding: 2.2em 5px; - white-space: inherit; -} - -.markdown-section code::after, -.markdown-section code::before { - letter-spacing: 0.05rem; -} - -code .token { - -moz-osx-font-smoothing: initial; - -webkit-font-smoothing: initial; - min-height: 1.5rem; -} - -pre::after { - color: #ccc; - content: attr(data-lang); - font-size: 0.6rem; - font-weight: 600; - height: 15px; - line-height: 15px; - padding: 5px 10px 0; - position: absolute; - right: 0; - text-align: right; - top: 0; -} diff --git a/src/themes/vue.styl b/src/themes/vue.styl new file mode 100644 index 0000000..98c416e --- /dev/null +++ b/src/themes/vue.styl @@ -0,0 +1,225 @@ +@import url('https://fonts.googleapis.com/css?family=Roboto+Mono|Source+Sans+Pro:300,400,600') + +$color-primary = #42b983 +$color-bg = #fff +$color-text = #34495e +$sidebar-width = 300px + +@import 'basic/_layout' +@import 'basic/_coverpage' + +body + background-color $color-bg + +/* sidebar */ +.sidebar + background-color $color-bg + color #364149 + + li + margin 6px 0 6px 0 + + ul li a + color #505d6b + font-size 14px + font-weight normal + overflow hidden + text-decoration none + text-overflow ellipsis + white-space nowrap + + &:hover + text-decoration underline + + ul li ul + padding 0 + + ul li.active > a + border-right 2px solid + color var(--theme-color, $color-primary) + font-weight 600 + +.app-sub-sidebar + li + &::before + content '-' + padding-right 4px + float left + +/* markdown content found on pages */ +.markdown-section h1, .markdown-section h2, .markdown-section h3, .markdown-section h4, .markdown-section strong + color #2c3e50 + font-weight 600 + +.markdown-section a + color var(--theme-color, $color-primary) + font-weight 600 + +.markdown-section h1 + font-size 2rem + margin 0 0 1rem + +.markdown-section h2 + font-size 1.75rem + margin 45px 0 0.8rem + +.markdown-section h3 + font-size 1.5rem + margin 40px 0 0.6rem + +.markdown-section h4 + font-size 1.25rem + +.markdown-section h5 + font-size 1rem + +.markdown-section h6 + color #777 + font-size 1rem + +.markdown-section figure, .markdown-section p + margin 1.2em 0 + +.markdown-section p, .markdown-section ul, .markdown-section ol + line-height 1.6rem + word-spacing 0.05rem + +.markdown-section ul, .markdown-section ol + padding-left 1.5rem + +.markdown-section blockquote + border-left 4px solid var(--theme-color, $color-primary) + color #858585 + margin 2em 0 + padding-left 20px + +.markdown-section blockquote p + font-weight 600 + margin-left 0 + +.markdown-section iframe + margin 1em 0 + +.markdown-section em + color #7f8c8d + +.markdown-section code + background-color #f8f8f8 + border-radius 2px + color #e96900 + font-family 'Roboto Mono', Monaco, courier, monospace + font-size 0.8rem + margin 0 2px + padding 3px 5px + white-space pre-wrap + +.markdown-section pre + -moz-osx-font-smoothing initial + -webkit-font-smoothing initial + background-color #f8f8f8 + font-family 'Roboto Mono', Monaco, courier, monospace + line-height 1.5rem + margin 1.2em 0 + overflow auto + padding 0 1.4rem + position relative + word-wrap normal + +/* code highlight */ +.token.comment, .token.prolog, .token.doctype, .token.cdata + color #8e908c + +.token.namespace + opacity 0.7 + +.token.boolean, .token.number + color #c76b29 + +.token.punctuation + color #525252 + +.token.property + color #c08b30 + +.token.tag + color #2973b7 + +.token.string + color var(--theme-color, $color-primary) + +.token.selector + color #6679cc + +.token.attr-name + color #2973b7 + +.token.entity, .token.url, .language-css .token.string, .style .token.string + color #22a2c9 + +.token.attr-value, .token.control, .token.directive, .token.unit + color var(--theme-color, $color-primary) + +.token.keyword, .token.function + color #e96900 + +.token.statement, .token.regex, .token.atrule + color #22a2c9 + +.token.placeholder, .token.variable + color #3d8fd1 + +.token.deleted + text-decoration line-through + +.token.inserted + border-bottom 1px dotted #202746 + text-decoration none + +.token.italic + font-style italic + +.token.important, .token.bold + font-weight bold + +.token.important + color #c94922 + +.token.entity + cursor help + +.markdown-section pre > code + -moz-osx-font-smoothing initial + -webkit-font-smoothing initial + background-color #f8f8f8 + border-radius 2px + color #525252 + display block + font-family 'Roboto Mono', Monaco, courier, monospace + font-size 0.8rem + line-height inherit + margin 0 2px + max-width inherit + overflow inherit + padding 2.2em 5px + white-space inherit + +.markdown-section code::after, .markdown-section code::before + letter-spacing 0.05rem + +code .token + -moz-osx-font-smoothing initial + -webkit-font-smoothing initial + min-height 1.5rem + +pre::after + color #ccc + content attr(data-lang) + font-size 0.6rem + font-weight 600 + height 15px + line-height 15px + padding 5px 10px 0 + position absolute + right 0 + text-align right + top 0 diff --git a/test/_helper.js b/test/_helper.js new file mode 100644 index 0000000..4b4abce --- /dev/null +++ b/test/_helper.js @@ -0,0 +1,87 @@ +// load ES6 modules in Node.js on the fly +require = require('esm')(module/*, options*/) + +const path = require('path') +const {expect} = require('chai') + +const {JSDOM} = require('jsdom') + +function ready(callback) { + const state = document.readyState + + if (state === 'complete' || state === 'interactive') { + return setTimeout(callback, 0) + } + + document.addEventListener('DOMContentLoaded', callback) +} +module.exports.init = function(fixture = 'default', config = {}, markup) { + if (markup == null) { + markup = ` + + + + + + + ` + } + const rootPath = path.join(__dirname, 'fixtures', fixture) + + const dom = new JSDOM(markup) + dom.reconfigure({ url: 'file:///' + rootPath }) + + global.window = dom.window + global.document = dom.window.document + global.navigator = dom.window.navigator + global.location = dom.window.location + global.XMLHttpRequest = dom.window.XMLHttpRequest + + // mimic src/core/index.js but for Node.js + function Docsify() { + this._init() + } + + const proto = Docsify.prototype + + const {initMixin} = require('../src/core/init') + const {routerMixin} = require('../src/core//router') + const {renderMixin} = require('../src/core//render') + const {fetchMixin} = require('../src/core/fetch') + const {eventMixin} = require('../src/core//event') + + initMixin(proto) + routerMixin(proto) + renderMixin(proto) + fetchMixin(proto) + eventMixin(proto) + + const NOT_INIT_PATTERN = '' + + return new Promise((resolve, reject) => { + ready(() => { + const docsify = new Docsify() + // NOTE: I was not able to get it working with a callback, but polling works usually at the first time + const id = setInterval(() => { + if (dom.window.document.body.innerHTML.indexOf(NOT_INIT_PATTERN) == -1) { + clearInterval(id) + return resolve({ + docsify: docsify, + dom: dom + }) + } + }, 10) + }) + + }) +} +module.exports.expectSameDom = function(actual, expected) { + const WHITESPACES_BETWEEN_TAGS = />(\s\s+) diff --git a/test/fixtures/simple/README.md b/test/fixtures/simple/README.md new file mode 100644 index 0000000..0f3fd46 --- /dev/null +++ b/test/fixtures/simple/README.md @@ -0,0 +1,18 @@ +# Heading + +[another page](other.md) + +## II 1 + +### III 1 + +#### IV 1 + +##### V 1 + + +## II 2 + +### III 2 + +#### IV 2 diff --git a/test/fixtures/simple/other-page.md b/test/fixtures/simple/other-page.md new file mode 100644 index 0000000..4bc6e98 --- /dev/null +++ b/test/fixtures/simple/other-page.md @@ -0,0 +1,16 @@ +# Other + +## two 1 + +### three 1 + +#### four 1 + +##### five 1 + + +## two 2 + +### three 2 + +#### four 2 diff --git a/test/integration/render.js b/test/integration/render.js new file mode 100644 index 0000000..7b2b253 --- /dev/null +++ b/test/integration/render.js @@ -0,0 +1,14 @@ +const path = require('path') + +const {expect} = require('chai') + +const {init, expectSameDom} = require('../_helper') + +describe('full docsify initialization', function() { + it('TODO: check generated markup', async function() { + const {docsify, dom} = await init('simple', {loadSidebar: true}) + console.log(dom.window.document.body.innerHTML) + // TODO: add some expectations + }) + +}) diff --git a/test/integration/router.js b/test/integration/router.js new file mode 100644 index 0000000..b87e802 --- /dev/null +++ b/test/integration/router.js @@ -0,0 +1,14 @@ +const path = require('path') + +const {expect} = require('chai') + +const {init, expectSameDom} = require('../_helper') + +describe('router', function() { + it('TODO: trigger to load another page', async function() { + const {docsify} = await init() + window.location = '/?foo=bar' + // TODO: add some expectations + }) + +}) diff --git a/test/unit/base.js b/test/unit/base.js new file mode 100644 index 0000000..036700b --- /dev/null +++ b/test/unit/base.js @@ -0,0 +1,62 @@ +/* eslint-env node, chai, mocha */ +require = require('esm')(module/*, options*/) +const {expect} = require('chai') +const {History} = require('../../src/core/router/history/base') + +class MockHistory extends History { + parse(path) { + return {path} + } +} + +describe('router/history/base', function () { + describe('relativePath true', function () { + var history + + beforeEach(function () { + history = new MockHistory({relativePath: true}) + }) + + it('toURL', function () { + // WHEN + const url = history.toURL('guide.md', {}, '/zh-ch/') + + // THEN + expect(url).equal('/zh-ch/guide') + }) + + it('toURL with double dot', function () { + // WHEN + const url = history.toURL('../README.md', {}, '/zh-ch/') + + // THEN + expect(url).equal('/README') + }) + + it('toURL child path', function () { + // WHEN + const url = history.toURL('config/example.md', {}, '/zh-ch/') + + // THEN + expect(url).equal('/zh-ch/config/example') + }) + + it('toURL absolute path', function () { + // WHEN + const url = history.toURL('/README', {}, '/zh-ch/') + + // THEN + expect(url).equal('/README') + }) + }) + + it('toURL without relative path', function () { + const history = new MockHistory({relativePath: false}) + + // WHEN + const url = history.toURL('README', {}, '/zh-ch/') + + // THEN + expect(url).equal('/README') + }) +}) diff --git a/test/unit/render.js b/test/unit/render.js new file mode 100644 index 0000000..25043cf --- /dev/null +++ b/test/unit/render.js @@ -0,0 +1,89 @@ +const path = require('path') + +const {expect} = require('chai') + +const {init, expectSameDom} = require('../_helper') + +describe('render', function() { + it('important content (tips)', async function() { + const {docsify, dom} = await init() + const output = docsify.compiler.compile('!> **Time** is money, my friend!') + expect(output).equal('Time is money, my friend!
') + }) + + describe('lists', function() { + it('as unordered task list', async function() { + const {docsify, dom} = await init() + const output = docsify.compiler.compile(` +- [x] Task 1 +- [ ] Task 2 +- [ ] Task 3`) + expect(output, `text
+