mirror of
https://github.com/wahyd4/docsify.git
synced 2026-08-09 21:36:10 +10:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
178ba64157 | ||
|
|
93a995f5bc | ||
|
|
888f217356 | ||
|
|
6bfc81147f | ||
|
|
3af1641874 | ||
|
|
66c8fd501a | ||
|
|
d60f6f0d03 | ||
|
|
2002cb8b22 | ||
|
|
572ab1afae | ||
|
|
d3dc8bcfb7 | ||
|
|
0e693fcda2 | ||
|
|
041b33e967 | ||
|
|
b34a9375c3 | ||
|
|
a1d2a1f1e3 | ||
|
|
e43ded4ea7 | ||
|
|
88df107c70 | ||
|
|
bc3ef52bbe | ||
|
|
9bed441a0c | ||
|
|
af38fc70fd | ||
|
|
4f164e995e | ||
|
|
b77f46a8e3 | ||
|
|
9208e64939 | ||
|
|
405349102f | ||
|
|
9d6595d04b | ||
|
|
d486eef6cc | ||
|
|
b3c3180bab | ||
|
|
c30af850a1 | ||
|
|
2a2ed96eb8 | ||
|
|
0d54c0cf83 | ||
|
|
f27ce7d2b2 | ||
|
|
2e1a7367a8 | ||
|
|
7510f75968 | ||
|
|
fd7d4e0e4e | ||
|
|
025bc5cddf | ||
|
|
8f1066a035 | ||
|
|
800c0c503a | ||
|
|
d5194b4f6b | ||
|
|
fa772cfa94 | ||
|
|
cc98f56cdd | ||
|
|
752f68e5f8 | ||
|
|
bde17e1f10 | ||
|
|
2db197f6dc | ||
|
|
e8b5b09f2c | ||
|
|
36bfc9d91d | ||
|
|
4ad96f3d12 | ||
|
|
1f04912a8f | ||
|
|
65f17b4753 | ||
|
|
b3419f3842 | ||
|
|
0bb7e18018 | ||
|
|
86583e19ab | ||
|
|
0bef31951c | ||
|
|
a2b8eae8c4 | ||
|
|
63d08369f6 | ||
|
|
142623e87e | ||
|
|
ab682684ca | ||
|
|
e16c89e539 | ||
|
|
f1272a2f1c | ||
|
|
1b912272df | ||
|
|
3476f6ff1f | ||
|
|
fac7ce693f | ||
|
|
470ee474d4 |
+2
-1
@@ -1,4 +1,5 @@
|
||||
*.log
|
||||
.DS_Store
|
||||
/themes
|
||||
/themes/
|
||||
node_modules
|
||||
/lib/
|
||||
|
||||
+139
@@ -1,3 +1,142 @@
|
||||
<a name="4.5.6"></a>
|
||||
## [4.5.6](https://github.com/QingWei-Li/docsify/compare/v4.5.3...v4.5.6) (2017-12-14)
|
||||
|
||||
|
||||
### 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))
|
||||
* 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)
|
||||
* remove codesponsor ([66c8fd5](https://github.com/QingWei-Li/docsify/commit/66c8fd5))
|
||||
* **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))
|
||||
|
||||
|
||||
|
||||
<a name="4.5.5"></a>
|
||||
## [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)
|
||||
|
||||
|
||||
|
||||
<a name="4.5.4"></a>
|
||||
## [4.5.4](https://github.com/QingWei-Li/docsify/compare/v4.5.2...v4.5.4) (2017-11-29)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **compiler:** task lists style, fixed [#215](https://github.com/QingWei-Li/docsify/issues/215) ([e43ded4](https://github.com/QingWei-Li/docsify/commit/e43ded4))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* add gitalk plugin ([#306](https://github.com/QingWei-Li/docsify/issues/306)) ([9208e64](https://github.com/QingWei-Li/docsify/commit/9208e64))
|
||||
|
||||
|
||||
|
||||
<a name="4.5.3"></a>
|
||||
## [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))
|
||||
|
||||
|
||||
|
||||
<a name="4.5.2"></a>
|
||||
## [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))
|
||||
|
||||
|
||||
|
||||
<a name="4.5.1"></a>
|
||||
## [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))
|
||||
|
||||
|
||||
|
||||
<a name="4.5.0"></a>
|
||||
# [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))
|
||||
|
||||
|
||||
|
||||
<a name="4.4.1"></a>
|
||||
## [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))
|
||||
|
||||
|
||||
|
||||
<a name="4.4.0"></a>
|
||||
# [4.4.0](https://github.com/QingWei-Li/docsify/compare/v4.3.15...v4.4.0) (2017-10-30)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* sidebar style issue on firefox, fixed [#184](https://github.com/QingWei-Li/docsify/issues/184) ([#297](https://github.com/QingWei-Li/docsify/issues/297)) ([36bfc9d](https://github.com/QingWei-Li/docsify/commit/36bfc9d))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* add helper for disabled link, fixed [#295](https://github.com/QingWei-Li/docsify/issues/295) ([#296](https://github.com/QingWei-Li/docsify/issues/296)) ([4ad96f3](https://github.com/QingWei-Li/docsify/commit/4ad96f3))
|
||||
|
||||
|
||||
|
||||
<a name="4.3.15"></a>
|
||||
## [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))
|
||||
|
||||
|
||||
|
||||
<a name="4.3.14"></a>
|
||||
## [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))
|
||||
|
||||
|
||||
|
||||
<a name="4.3.13"></a>
|
||||
## [4.3.13](https://github.com/QingWei-Li/docsify/compare/v4.3.12...v4.3.13) (2017-10-17)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* duplicate results in search fixed [#257](https://github.com/QingWei-Li/docsify/issues/257) ([#284](https://github.com/QingWei-Li/docsify/issues/284)) ([3476f6f](https://github.com/QingWei-Li/docsify/commit/3476f6f))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* make whole search result clickable ([#285](https://github.com/QingWei-Li/docsify/issues/285)) ([1b91227](https://github.com/QingWei-Li/docsify/commit/1b91227))
|
||||
|
||||
|
||||
|
||||
<a name="4.3.12"></a>
|
||||
## [4.3.12](https://github.com/QingWei-Li/docsify/compare/v4.3.11...v4.3.12) (2017-10-15)
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<p align="center">
|
||||
<a href="https://docsify.js.org">
|
||||
<img alt="docsify" src="./media/docsify.png">
|
||||
<img alt="docsify" src="./docs/_media/icon.svg">
|
||||
</a>
|
||||
</p>
|
||||
|
||||
@@ -11,19 +11,15 @@
|
||||
<p align="center">
|
||||
<a href="https://travis-ci.org/QingWei-Li/docsify"><img alt="Travis Status" src="https://img.shields.io/travis/QingWei-Li/docsify/master.svg?style=flat-square"></a>
|
||||
<a href="https://www.npmjs.com/package/docsify"><img alt="npm" src="https://img.shields.io/npm/v/docsify.svg?style=flat-square"></a>
|
||||
<a href="https://cdnjs.com/libraries/docsify"><img alt="cdnjs" src="https://img.shields.io/cdnjs/v/docsify.svg?style=flat-square"></a>
|
||||
<a href="https://github.com/QingWei-Li/donate"><img alt="donate" src="https://img.shields.io/badge/%24-donate-ff69b4.svg?style=flat-square"></a>
|
||||
</p>
|
||||
|
||||
|
||||
<a target='_blank' rel='nofollow' href='https://app.codesponsor.io/link/YdWAqnN2kHQmLtFQhEddaaPT/QingWei-Li/docsify'> <img alt='Sponsor' width='888' height='68' src='https://app.codesponsor.io/embed/YdWAqnN2kHQmLtFQhEddaaPT/QingWei-Li/docsify.svg' /></a>
|
||||
|
||||
|
||||
## 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/)
|
||||
- CDN: [UNPKG](https://unpkg.com/docsify/) | [jsDelivr](https://cdn.jsdelivr.net/npm/docsify/) | [cdnjs](https://cdnjs.com/libraries/docsify)
|
||||
|
||||
## Features
|
||||
|
||||
@@ -46,6 +42,7 @@ Create an `index.html`.
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
<meta charset="UTF-8">
|
||||
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/docsify/lib/themes/vue.css">
|
||||
</head>
|
||||
@@ -83,6 +80,13 @@ These projects are using docsify to generate their sites. Pull requests welcome
|
||||
| [xTeko](https://docs.xteko.com/) | Addins framework for Pin 3.0 |
|
||||
| [vue2-datatable-component](https://github.com/OneWayTech/vue2-datatable) | The best Datatable for Vue.js 2.x which never sucks |
|
||||
| [Solidarity](https://infinitered.github.io/solidarity/) | Environment enforcer for your projects across machines. |
|
||||
| [rnback](https://rnback.com/) | Backend service for react-native applications. |
|
||||
| [IT-films](https://greybax.github.com/IT-films/) | A curated list of awesome movies, documentaries and TV series about hackers, geeks and IT in common, sorted by IMDB rating. |
|
||||
| [zooming](http://desmonding.me/zooming/docs) | Image zoom that makes sense. |
|
||||
| [vue-sticker](https://kamilocean.github.io/vue-sticker/#/) | Vue component, that helps to make sticky effects |
|
||||
| [Ts.ED](https://romakita.github.io/ts-express-decorators/#/) | A TypeScript Framework on top of Express |
|
||||
| [Ts.LogDebug](https://romakita.github.io/ts-log-debug/#/) | A multi channel logger written in TypeScript |
|
||||
| [vue-orgchart](https://spiritree.github.io/vue-orgchart) | Vue.js wrapper for OrgChart.js |
|
||||
|
||||
## Similar projects
|
||||
|
||||
|
||||
+2
-1
@@ -48,7 +48,8 @@ var plugins = [
|
||||
{ name: 'external-script', entry: 'external-script.js' },
|
||||
{ name: 'front-matter', entry: 'front-matter/index.js' },
|
||||
{ name: 'zoom-image', entry: 'zoom-image.js' },
|
||||
{ name: 'codesponsor', entry: 'codesponsor.js' }
|
||||
{ name: 'disqus', entry: 'disqus.js' },
|
||||
{ name: 'gitalk', entry: 'gitalk.js' }
|
||||
]
|
||||
|
||||
plugins.forEach(item => {
|
||||
|
||||
@@ -29,6 +29,7 @@ if [[ $REPLY =~ ^[Yy]$ ]]; then
|
||||
|
||||
# commit
|
||||
git add -A
|
||||
git add -f lib/ -A
|
||||
git commit -m "[build] $VERSION $RELEASE_TAG"
|
||||
npm --no-git-tag-version version $VERSION --message "[release] $VERSION $RELEASE_TAG"
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<meta charset="UTF-8">
|
||||
<title>docsify</title>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
<link rel="stylesheet" href="/themes/vue.css" title="vue">
|
||||
<link rel="stylesheet" href="/themes/dark.css" title="dark" disabled>
|
||||
<link rel="stylesheet" href="/themes/buble.css" title="buble" disabled>
|
||||
@@ -16,38 +16,38 @@
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
<script>
|
||||
window.$docsify = {
|
||||
alias: {
|
||||
'.*?/changelog': 'https://raw.githubusercontent.com/QingWei-Li/docsify/master/CHANGELOG',
|
||||
'/.*/_navbar.md': '/_navbar.md'
|
||||
},
|
||||
auto2top: true,
|
||||
basePath: '/docs/',
|
||||
executeScript: true,
|
||||
loadNavbar: true,
|
||||
loadSidebar: true,
|
||||
coverpage: true,
|
||||
name: 'docsify',
|
||||
subMaxLevel: 2,
|
||||
mergeNavbar: true,
|
||||
formatUpdated: '{MM}/{DD} {HH}:{mm}',
|
||||
plugins: [
|
||||
function(hook, vm) {
|
||||
hook.beforeEach(function (html) {
|
||||
var url = 'https://github.com/QingWei-Li/docsify/blob/master/' + vm.route.file
|
||||
var editHtml = '[:memo: Edit Document](' + url + ')\n'
|
||||
|
||||
return editHtml
|
||||
+ html
|
||||
+ '\n----\n'
|
||||
+ 'Last modified {docsify-updated} '
|
||||
+ editHtml
|
||||
})
|
||||
}
|
||||
]
|
||||
}
|
||||
</script>
|
||||
<script src="/lib/docsify.js"></script>
|
||||
</body>
|
||||
<script>
|
||||
window.$docsify = {
|
||||
alias: {
|
||||
'.*?/changelog': 'https://raw.githubusercontent.com/QingWei-Li/docsify/master/CHANGELOG',
|
||||
'/.*/_navbar.md': '/_navbar.md'
|
||||
},
|
||||
auto2top: true,
|
||||
basePath: '/docs/',
|
||||
executeScript: true,
|
||||
loadNavbar: true,
|
||||
loadSidebar: true,
|
||||
coverpage: true,
|
||||
name: 'docsify',
|
||||
subMaxLevel: 2,
|
||||
mergeNavbar: true,
|
||||
formatUpdated: '{MM}/{DD} {HH}:{mm}',
|
||||
plugins: [
|
||||
function(hook, vm) {
|
||||
hook.beforeEach(function (html) {
|
||||
var url = 'https://github.com/QingWei-Li/docsify/blob/master/' + vm.route.file
|
||||
var editHtml = '[:memo: Edit Document](' + url + ')\n'
|
||||
|
||||
return editHtml
|
||||
+ html
|
||||
+ '\n----\n'
|
||||
+ 'Last modified {docsify-updated} '
|
||||
+ editHtml
|
||||
})
|
||||
}
|
||||
]
|
||||
}
|
||||
</script>
|
||||
<script src="/lib/docsify.js"></script>
|
||||
</html>
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||

|
||||
|
||||
# docsify <small>4.3.12</small>
|
||||
# docsify <small>4.5.6</small>
|
||||
|
||||
> A magical documentation site generator.
|
||||
|
||||
|
||||
@@ -257,7 +257,8 @@ window.$docsify = {
|
||||
alias: {
|
||||
'/foo/(+*)': '/bar/$1', // supports regexp
|
||||
'/zh-cn/changelog': '/changelog',
|
||||
'/changelog': 'https://raw.githubusercontent.com/QingWei-Li/docsify/master/CHANGELOG'
|
||||
'/changelog': 'https://raw.githubusercontent.com/QingWei-Li/docsify/master/CHANGELOG',
|
||||
'/.*/_sidebar.md': '/_sidebar.md' // See #301
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
@@ -257,7 +257,8 @@ window.$docsify = {
|
||||
alias: {
|
||||
'/foo/(+*)': '/bar/$1', // supports regexp
|
||||
'/zh-cn/changelog': '/changelog',
|
||||
'/changelog': 'https://raw.githubusercontent.com/QingWei-Li/docsify/master/CHANGELOG'
|
||||
'/changelog': 'https://raw.githubusercontent.com/QingWei-Li/docsify/master/CHANGELOG',
|
||||
'/.*/_sidebar.md': '/_sidebar.md' // See #301
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
@@ -56,3 +56,23 @@ You will get `<a href="/demo/">link</a>`html. Do not worry, you can still set ti
|
||||
[link](/demo ":target=_blank")
|
||||
[link](/demo2 ":target=_self")
|
||||
```
|
||||
|
||||
|
||||
## Github Task Lists
|
||||
|
||||
```md
|
||||
|
||||
* [ ] foo
|
||||
* bar
|
||||
* [x] baz
|
||||
* [] bam
|
||||
* [ ] bim
|
||||
* [ ] lim
|
||||
```
|
||||
|
||||
* [ ] foo
|
||||
* bar
|
||||
* [x] baz
|
||||
* [] bam
|
||||
* [ ] bim
|
||||
* [ ] lim
|
||||
|
||||
+7
-17
@@ -91,28 +91,18 @@ Wenn das Skript auf der Seite ein externes ist (eine Javascript Datei über das
|
||||
|
||||
## Bilder zoomen
|
||||
|
||||
Medium's Bilderzoom. Basierend auf [zoom-image](https://github.com/egoist/zoom-image).
|
||||
Medium's Bilderzoom. Basierend auf [medium-zoom](https://github.com/francoischalifour/medium-zoom).
|
||||
|
||||
```html
|
||||
<script src="//unpkg.com/docsify/lib/plugins/zoom-image.min.js"></script>
|
||||
```
|
||||
|
||||
Exclude the special image
|
||||
|
||||
```markdown
|
||||

|
||||
```
|
||||
|
||||
## Edit on github
|
||||
|
||||
Add `Edit on github` button on every pages. provided by 3rd party, check [document](https://github.com/njleonzhang/docsify-edit-on-github)
|
||||
|
||||
|
||||
## CodeSponsor
|
||||
|
||||
See https://codesponsor.io
|
||||
|
||||
|
||||
```html
|
||||
<script>
|
||||
window.$docsify = {
|
||||
codesponsor: 'id'
|
||||
}
|
||||
</script>
|
||||
<script src="//unpkg.com/docsify/lib/plugins/codesponsor.min.js"></script>
|
||||
```
|
||||
|
||||
|
||||
@@ -45,6 +45,7 @@ Wenn du `npm` nicht verwenden möchtest, oder Probleme bei der Installation des
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
<meta charset="UTF-8">
|
||||
<link rel="stylesheet" href="//unpkg.com/docsify/themes/vue.css">
|
||||
</head>
|
||||
|
||||
@@ -15,6 +15,7 @@ It is recommended that you save your files to the `./docs` subfolder of the `mas
|
||||

|
||||
|
||||
!> You can also save files in the root directory and select `master branch`.
|
||||
!> You'll need to place a `.nojekyll` file in the deploy location (such as `/docs` or the gh-pages branch
|
||||
|
||||
## GitLab Pages
|
||||
|
||||
|
||||
@@ -57,3 +57,28 @@ You will get `<a href="/demo/">link</a>`html. Do not worry, you can still set ti
|
||||
[link](/demo2 ":target=_self")
|
||||
```
|
||||
|
||||
## Disable link
|
||||
|
||||
```md
|
||||
[link](/demo ":disabled")
|
||||
```
|
||||
|
||||
## Github Task Lists
|
||||
|
||||
```md
|
||||
|
||||
* [ ] foo
|
||||
* bar
|
||||
* [x] baz
|
||||
* [] bam
|
||||
* [ ] bim
|
||||
* [ ] lim
|
||||
```
|
||||
|
||||
* [ ] foo
|
||||
* bar
|
||||
* [x] baz
|
||||
* [] bam
|
||||
* [ ] bim
|
||||
* [ ] lim
|
||||
|
||||
|
||||
+51
-53
@@ -20,59 +20,57 @@
|
||||
</head>
|
||||
<body>
|
||||
<div id="app">Loading ...</div>
|
||||
</body>
|
||||
<script>
|
||||
window.$docsify = {
|
||||
alias: {
|
||||
'.*?/changelog': 'https://raw.githubusercontent.com/QingWei-Li/docsify/master/CHANGELOG',
|
||||
'/.*/_navbar.md': '/_navbar.md'
|
||||
},
|
||||
auto2top: true,
|
||||
coverpage: true,
|
||||
executeScript: true,
|
||||
loadSidebar: true,
|
||||
loadNavbar: true,
|
||||
mergeNavbar: true,
|
||||
maxLevel: 4,
|
||||
subMaxLevel: 2,
|
||||
codesponsor: '7c9Ms7xRs-j_y_8abU03DA',
|
||||
ga: 'UA-106147152-1',
|
||||
name: 'docsify',
|
||||
search: {
|
||||
noData: {
|
||||
'/de-de/': 'Keine Ergebnisse!',
|
||||
'/zh-cn/': '没有结果!',
|
||||
'/': 'No results!'
|
||||
<script>
|
||||
window.$docsify = {
|
||||
alias: {
|
||||
'.*?/changelog': 'https://raw.githubusercontent.com/QingWei-Li/docsify/master/CHANGELOG',
|
||||
'/.*/_navbar.md': '/_navbar.md'
|
||||
},
|
||||
paths: 'auto',
|
||||
placeholder: {
|
||||
'/de-de/': 'Suche',
|
||||
'/zh-cn/': '搜索',
|
||||
'/': 'Search'
|
||||
}
|
||||
},
|
||||
formatUpdated: '{MM}/{DD} {HH}:{mm}',
|
||||
plugins: [
|
||||
function(hook, vm) {
|
||||
hook.beforeEach(function (html) {
|
||||
var url = 'https://github.com/QingWei-Li/docsify/blob/master/docs/' + vm.route.file
|
||||
var editHtml = '[:memo: Edit Document](' + url + ')\n'
|
||||
auto2top: true,
|
||||
coverpage: true,
|
||||
executeScript: true,
|
||||
loadSidebar: true,
|
||||
loadNavbar: true,
|
||||
mergeNavbar: true,
|
||||
maxLevel: 4,
|
||||
subMaxLevel: 2,
|
||||
ga: 'UA-106147152-1',
|
||||
name: 'docsify',
|
||||
search: {
|
||||
noData: {
|
||||
'/de-de/': 'Keine Ergebnisse!',
|
||||
'/zh-cn/': '没有结果!',
|
||||
'/': 'No results!'
|
||||
},
|
||||
paths: 'auto',
|
||||
placeholder: {
|
||||
'/de-de/': 'Suche',
|
||||
'/zh-cn/': '搜索',
|
||||
'/': 'Search'
|
||||
}
|
||||
},
|
||||
formatUpdated: '{MM}/{DD} {HH}:{mm}',
|
||||
plugins: [
|
||||
function(hook, vm) {
|
||||
hook.beforeEach(function (html) {
|
||||
var url = 'https://github.com/QingWei-Li/docsify/blob/master/docs/' + vm.route.file
|
||||
var editHtml = '[:memo: Edit Document](' + url + ')\n'
|
||||
|
||||
return editHtml
|
||||
+ html
|
||||
+ '\n----\n'
|
||||
+ 'Last modified {docsify-updated} '
|
||||
+ editHtml
|
||||
})
|
||||
}
|
||||
]
|
||||
}
|
||||
</script>
|
||||
<script src="//unpkg.com/docsify/lib/docsify.min.js"></script>
|
||||
<script src="//unpkg.com/docsify/lib/plugins/search.min.js"></script>
|
||||
<script src="//unpkg.com/docsify/lib/plugins/codesponsor.min.js"></script>
|
||||
<script src="//unpkg.com/docsify/lib/plugins/ga.min.js"></script>
|
||||
<script src="//unpkg.com/prismjs/components/prism-bash.min.js"></script>
|
||||
<script src="//unpkg.com/prismjs/components/prism-markdown.min.js"></script>
|
||||
<script src="//unpkg.com/prismjs/components/prism-nginx.min.js"></script>
|
||||
return editHtml
|
||||
+ html
|
||||
+ '\n----\n'
|
||||
+ 'Last modified {docsify-updated} '
|
||||
+ editHtml
|
||||
})
|
||||
}
|
||||
]
|
||||
}
|
||||
</script>
|
||||
<script src="//unpkg.com/docsify/lib/docsify.min.js"></script>
|
||||
<script src="//unpkg.com/docsify/lib/plugins/search.min.js"></script>
|
||||
<script src="//unpkg.com/docsify/lib/plugins/ga.min.js"></script>
|
||||
<script src="//unpkg.com/prismjs/components/prism-bash.min.js"></script>
|
||||
<script src="//unpkg.com/prismjs/components/prism-markdown.min.js"></script>
|
||||
<script src="//unpkg.com/prismjs/components/prism-nginx.min.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
+44
-13
@@ -91,12 +91,19 @@ If the script on the page is an external one (imports a js file via `src` attrib
|
||||
|
||||
## Zoom image
|
||||
|
||||
Medium's Image Zoom. Based on [zoom-image](https://github.com/egoist/zoom-image).
|
||||
Medium's image zoom. Based on [medium-zoom](https://github.com/francoischalifour/medium-zoom).
|
||||
|
||||
```html
|
||||
<script src="//unpkg.com/docsify/lib/plugins/zoom-image.min.js"></script>
|
||||
```
|
||||
|
||||
Exclude the special image
|
||||
|
||||
```markdown
|
||||

|
||||
```
|
||||
|
||||
|
||||
## Edit on github
|
||||
|
||||
Add `Edit on github` button on every pages. provided by 3rd party, check [document](https://github.com/njleonzhang/docsify-edit-on-github)
|
||||
@@ -109,18 +116,6 @@ When readers expand the demo box, the source code and description are shown ther
|
||||
|
||||
[Vue](https://njleonzhang.github.io/docsify-demo-box-vue/) and [React](https://njleonzhang.github.io/docsify-demo-box-react/) are both supported.
|
||||
|
||||
## CodeSponsor
|
||||
|
||||
See https://codesponsor.io
|
||||
|
||||
```html
|
||||
<script>
|
||||
window.$docsify = {
|
||||
codesponsor: 'id'
|
||||
}
|
||||
</script>
|
||||
<script src="//unpkg.com/docsify/lib/plugins/codesponsor.min.js"></script>
|
||||
```
|
||||
|
||||
## Copy to Clipboard
|
||||
|
||||
@@ -140,3 +135,39 @@ window.$docsify = {
|
||||
```
|
||||
|
||||
See [here](https://github.com/jperasmus/docsify-copy-code/blob/master/README.md) for more details.
|
||||
|
||||
|
||||
## Disqus
|
||||
|
||||
Disqus comments. https://disqus.com/
|
||||
|
||||
```html
|
||||
<script>
|
||||
window.$docsify = {
|
||||
disqus: 'shortname'
|
||||
}
|
||||
</script>
|
||||
<script src="//unpkg.com/docsify/lib/plugins/disqus.min.js"></script>
|
||||
```
|
||||
|
||||
## Gitalk
|
||||
|
||||
Gitalk is a modern comment component based on Github Issue and Preact. https://github.com/gitalk/gitalk
|
||||
|
||||
```html
|
||||
<link rel="stylesheet" href="//unpkg.com/gitalk/dist/gitalk.css">
|
||||
|
||||
<script src="//unpkg.com/docsify/lib/plugins/gitalk.min.js"></script>
|
||||
<script src="//unpkg.com/gitalk/dist/gitalk.min.js"></script>
|
||||
<script>
|
||||
const gitalk = new Gitalk({
|
||||
clientID: 'Github Application Client ID',
|
||||
clientSecret: 'Github Application Client Secret',
|
||||
repo: 'Github repo',
|
||||
owner: 'Github repo owner',
|
||||
admin: ['Github repo collaborators, only these guys can initialize github issues'],
|
||||
// facebook-like distraction free mode
|
||||
distractionFreeMode: false
|
||||
})
|
||||
</script>
|
||||
```
|
||||
@@ -45,6 +45,7 @@ If you don't like `npm` or have trouble installing the tool, you can manually cr
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
<meta charset="UTF-8">
|
||||
<link rel="stylesheet" href="//unpkg.com/docsify/themes/vue.css">
|
||||
</head>
|
||||
|
||||
+2
-2
@@ -19,7 +19,7 @@ Then you can immediately write Vue code at Markdown file. `new Vue({ el: '#main'
|
||||
|
||||
*README.md*
|
||||
|
||||
```markdown
|
||||
````markdown
|
||||
# Vue guide
|
||||
|
||||
`v-for` usage.
|
||||
@@ -33,7 +33,7 @@ Then you can immediately write Vue code at Markdown file. `new Vue({ el: '#main'
|
||||
<ul>
|
||||
<li v-for="i in 10">{{ i }}</li>
|
||||
</ul>
|
||||
```
|
||||
````
|
||||
|
||||
You can manually initialize a Vue instance.
|
||||
|
||||
|
||||
@@ -266,7 +266,8 @@ window.$docsify = {
|
||||
alias: {
|
||||
'/foo/(+*)': '/bar/$1', // supports regexp
|
||||
'/zh-cn/changelog': '/changelog',
|
||||
'/changelog': 'https://raw.githubusercontent.com/QingWei-Li/docsify/master/CHANGELOG'
|
||||
'/changelog': 'https://raw.githubusercontent.com/QingWei-Li/docsify/master/CHANGELOG',
|
||||
'/.*/_sidebar.md': '/_sidebar.md' // See #301
|
||||
}
|
||||
}
|
||||
```
|
||||
@@ -329,7 +330,7 @@ window.$docsify = {
|
||||
|
||||
## format-updated
|
||||
|
||||
我们可以显示文档更新日期通过 **{docsify-updated<span>}</span>** 变量. 并且格式化日期通过 `formatUpdated`.
|
||||
我们可以显示文档更新日期通过 **{docsify-updated<span>}</span>** 变量. 并且格式化日期通过 `formatUpdated`。
|
||||
参考 https://github.com/lukeed/tinydate#patterns
|
||||
```js
|
||||
window.$docsify = {
|
||||
@@ -345,7 +346,7 @@ window.$docsify = {
|
||||
|
||||
## external-link-target
|
||||
|
||||
Currently it defaults to _blank, would be nice if configurable:
|
||||
当前默认为 _blank, 配置一下就可以:
|
||||
|
||||
```js
|
||||
window.$docsify = {
|
||||
@@ -356,10 +357,10 @@ window.$docsify = {
|
||||
|
||||
## noCompileLinks
|
||||
|
||||
- type: `Array`
|
||||
- 类型: `Array`
|
||||
|
||||
|
||||
Sometimes we do not want docsify to handle our links. See [#203](https://github.com/QingWei-Li/docsify/issues/203)
|
||||
有时我们不希望 docsify 处理我们的链接。 参考 [#203](https://github.com/QingWei-Li/docsify/issues/203)
|
||||
|
||||
|
||||
```js
|
||||
|
||||
@@ -18,9 +18,9 @@ GitHub Pages 支持从三个地方读取文件
|
||||
|
||||
## GitLab Pages
|
||||
|
||||
If you are deploying your master branch, include `.gitlab-ci.yml` with the following script:
|
||||
如果你正在部署你的主分支, 在 `.gitlab-ci.yml` 中包含以下脚本:
|
||||
|
||||
?> The `.public` workaround is so `cp` doesn't also copy `public/` to itself in an infinite loop.
|
||||
?> `.public` 的解决方法是这样的,`cp` 不会无限循环的将 `public/` 复制到自身。
|
||||
|
||||
``` YAML
|
||||
pages:
|
||||
@@ -36,7 +36,7 @@ pages:
|
||||
- master
|
||||
```
|
||||
|
||||
!> You can replace script with `- cp -r docs/. public`, if `./docs` is your Docsify subfolder.
|
||||
!> 你可以用 `- cp -r docs/. public` 替换脚本, 如果 `./docs` 是你的 docsify 子文件夹。
|
||||
|
||||
|
||||
## VPS
|
||||
|
||||
+26
-6
@@ -25,23 +25,23 @@ docsify 扩展了一些 Markdown 语法,可以让文档更易读。
|
||||
?> *TODO* 完善示例
|
||||
|
||||
|
||||
## Ignore to compile link
|
||||
## 忽略编译链接
|
||||
|
||||
Some time we will put some other relative path to the link, you have to need to tell docsify you don't need to compile this link. For example
|
||||
有时候我们会把其他一些相对路径放到链接上,你必须告诉 docsify 你不需要编译这个链接。 例如:
|
||||
|
||||
```md
|
||||
[link](/demo/)
|
||||
```
|
||||
|
||||
|
||||
It will be compiled to `<a href="/#/demo/">link</a>` and will be loaded `/demo/README.md`. Maybe you want to jump to `/demo/index.html`.
|
||||
它将被编译为 `<a href="/#/demo/">link</a>` 并将加载 `/demo/README.md`. 可能你想跳转到 `/demo/index.html`。
|
||||
|
||||
Now you can do that
|
||||
现在你可以做到这一点
|
||||
|
||||
```md
|
||||
[link](/demo/ ":ignore")
|
||||
```
|
||||
You will get `<a href="/demo/">link</a>`html. Do not worry, you can still set title for link.
|
||||
即将会得到 `<a href="/demo/">link</a>` html 代码。不要担心,你仍然可以为链接设置标题。
|
||||
|
||||
```md
|
||||
[link](/demo/ ":ignore title")
|
||||
@@ -50,9 +50,29 @@ You will get `<a href="/demo/">link</a>`html. Do not worry, you can still set ti
|
||||
```
|
||||
|
||||
|
||||
## Set target attribute for link
|
||||
## 设置链接的 target 属性
|
||||
|
||||
```md
|
||||
[link](/demo ":target=_blank")
|
||||
[link](/demo2 ":target=_self")
|
||||
```
|
||||
|
||||
|
||||
## Github 任务列表
|
||||
|
||||
```md
|
||||
|
||||
* [ ] foo
|
||||
* bar
|
||||
* [x] baz
|
||||
* [] bam
|
||||
* [ ] bim
|
||||
* [ ] lim
|
||||
```
|
||||
|
||||
* [ ] foo
|
||||
* bar
|
||||
* [x] baz
|
||||
* [] bam
|
||||
* [ ] bim
|
||||
* [ ] lim
|
||||
|
||||
@@ -30,7 +30,7 @@ window.$docsify = {
|
||||
```
|
||||
|
||||
|
||||
## Supports mermaid
|
||||
## 支持 mermaid
|
||||
|
||||
```js
|
||||
// Import mermaid
|
||||
|
||||
@@ -63,25 +63,25 @@ docs/zh-cn/guide.md => http://domain.com/zh-cn/guide
|
||||
<script src="//unpkg.com/docsify"></script>
|
||||
```
|
||||
|
||||
## Ignoring Subheaders
|
||||
## 忽略副标题
|
||||
|
||||
When `subMaxLevel` is set, each header is automatically added to the table of contents by default. If you want to ignore a specific header, add `{docsify-ignore}` to it.
|
||||
当设置了 `subMaxLevel` 时,默认情况下每个标题都会自动添加到目录中。如果你想忽略特定的标题,可以给它添加 `{docsify-ignore}` 。
|
||||
|
||||
```markdown
|
||||
# Getting Started
|
||||
|
||||
## Header {docsify-ignore}
|
||||
This header won't appear in the sidebar table of contents.
|
||||
该标题不会出现在侧边栏的目录中。
|
||||
```
|
||||
|
||||
To ignore all headers on a specific page, you can use `{docsify-ignore-all}` on the first header of the page.
|
||||
要忽略特定页面上的所有标题,你可以在页面的第一个标题上使用 `{docsify-ignore-all}` 。
|
||||
|
||||
```markdown
|
||||
# Getting Started {docsify-ignore-all}
|
||||
|
||||
## Header
|
||||
This header won't appear in the sidebar table of contents.
|
||||
该标题不会出现在侧边栏的目录中。
|
||||
```
|
||||
|
||||
Both `{docsify-ignore}` and `{docsify-ignore-all}` will not be rendered on the page when used.
|
||||
在使用时, `{docsify-ignore}` 和 `{docsify-ignore-all}` 都不会在页面上呈现。
|
||||
|
||||
|
||||
+9
-17
@@ -85,29 +85,21 @@
|
||||
|
||||
## 图片缩放 - Zoom image
|
||||
|
||||
Medium's 风格的图片缩放插件. 基于 [zoom-image](https://github.com/egoist/zoom-image)。
|
||||
Medium's 风格的图片缩放插件. 基于 [medium-zoom](https://github.com/francoischalifour/medium-zoom)。
|
||||
|
||||
```html
|
||||
<script src="//unpkg.com/docsify/lib/plugins/zoom-image.js"></script>
|
||||
```
|
||||
|
||||
|
||||
## Edit on github
|
||||
忽略某张图片
|
||||
|
||||
Add `Edit on github` button on every pages. provided by 3rd party, check [document](https://github.com/njleonzhang/docsify-edit-on-github)
|
||||
|
||||
|
||||
## CodeSponsor
|
||||
|
||||
See https://codesponsor.io
|
||||
|
||||
|
||||
```html
|
||||
<script>
|
||||
window.$docsify = {
|
||||
codesponsor: 'id'
|
||||
}
|
||||
</script>
|
||||
<script src="//unpkg.com/docsify/lib/plugins/codesponsor.min.js"></script>
|
||||
```markdown
|
||||

|
||||
```
|
||||
|
||||
|
||||
|
||||
## 在 Github 上编辑
|
||||
|
||||
在每一页上添加 `Edit on github` 按钮. 由第三方库提供, 查看 [document](https://github.com/njleonzhang/docsify-edit-on-github)
|
||||
|
||||
@@ -45,6 +45,7 @@ docsify serve docs
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
<meta charset="UTF-8">
|
||||
<link rel="stylesheet" href="//unpkg.com/docsify/themes/vue.css">
|
||||
</head>
|
||||
|
||||
+121
-48
@@ -2758,10 +2758,13 @@ function parseQuery (query) {
|
||||
return res
|
||||
}
|
||||
|
||||
function stringifyQuery (obj) {
|
||||
function stringifyQuery (obj, ignores) {
|
||||
if ( ignores === void 0 ) ignores = [];
|
||||
|
||||
var qs = [];
|
||||
|
||||
for (var key in obj) {
|
||||
if (ignores.indexOf(key) > -1) { continue }
|
||||
qs.push(
|
||||
obj[key]
|
||||
? ((encode(key)) + "=" + (encode(obj[key]))).toLowerCase()
|
||||
@@ -2794,6 +2797,22 @@ var cleanPath = cached(function (path) {
|
||||
});
|
||||
|
||||
var cachedLinks = {};
|
||||
function getAndRemoveConfig (str) {
|
||||
if ( str === void 0 ) str = '';
|
||||
|
||||
var config = {};
|
||||
|
||||
if (str) {
|
||||
str = str
|
||||
.replace(/:([\w-]+)=?([\w-]+)?/g, function (m, key, value) {
|
||||
config[key] = value || true;
|
||||
return ''
|
||||
})
|
||||
.trim();
|
||||
}
|
||||
|
||||
return { str: str, config: config }
|
||||
}
|
||||
|
||||
var Compiler = function Compiler (config, router) {
|
||||
this.config = config;
|
||||
@@ -2810,9 +2829,11 @@ var Compiler = function Compiler (config, router) {
|
||||
if (isFn(mdConf)) {
|
||||
compile = mdConf(marked, renderer);
|
||||
} else {
|
||||
marked.setOptions(merge(mdConf, {
|
||||
renderer: merge(renderer, mdConf.renderer)
|
||||
}));
|
||||
marked.setOptions(
|
||||
merge(mdConf, {
|
||||
renderer: merge(renderer, mdConf.renderer)
|
||||
})
|
||||
);
|
||||
compile = marked;
|
||||
}
|
||||
|
||||
@@ -2881,33 +2902,47 @@ Compiler.prototype._initRenderer = function _initRenderer () {
|
||||
origin.code = renderer.code = function (code, lang) {
|
||||
if ( lang === void 0 ) lang = '';
|
||||
|
||||
var hl = prism.highlight(code, prism.languages[lang] || prism.languages.markup);
|
||||
var hl = prism.highlight(
|
||||
code,
|
||||
prism.languages[lang] || prism.languages.markup
|
||||
);
|
||||
|
||||
return ("<pre v-pre data-lang=\"" + lang + "\"><code class=\"lang-" + lang + "\">" + hl + "</code></pre>")
|
||||
};
|
||||
origin.link = renderer.link = function (href, title, text) {
|
||||
var blank = '';
|
||||
if ( title === void 0 ) title = '';
|
||||
|
||||
if (!/:|(\/{2})/.test(href) &&
|
||||
var attrs = '';
|
||||
|
||||
var ref = getAndRemoveConfig(title);
|
||||
var str = ref.str;
|
||||
var config = ref.config;
|
||||
title = str;
|
||||
|
||||
if (
|
||||
!/:|(\/{2})/.test(href) &&
|
||||
!_self.matchNotCompileLink(href) &&
|
||||
!/(\s?:ignore)(\s\S+)?$/.test(title)) {
|
||||
!config.ignore
|
||||
) {
|
||||
href = router.toURL(href, null, router.getCurrentPath());
|
||||
} else {
|
||||
blank = " target=\"" + linkTarget + "\"";
|
||||
title = title && title.replace(/:ignore/g, '').trim();
|
||||
attrs += " target=\"" + linkTarget + "\"";
|
||||
}
|
||||
|
||||
var target = title && title.match(/:target=\w+/);
|
||||
if (target) {
|
||||
target = target[0];
|
||||
title = title.replace(target, '');
|
||||
blank = ' ' + target.slice(1);
|
||||
if (config.target) {
|
||||
attrs += ' target=' + config.target;
|
||||
}
|
||||
|
||||
if (config.disabled) {
|
||||
attrs += ' disabled';
|
||||
href = 'javascript:void(0)';
|
||||
}
|
||||
|
||||
if (title) {
|
||||
title = " title=\"" + title + "\"";
|
||||
attrs += " title=\"" + title + "\"";
|
||||
}
|
||||
return ("<a href=\"" + href + "\"" + (title || '') + blank + ">" + text + "</a>")
|
||||
|
||||
return ("<a href=\"" + href + "\"" + attrs + ">" + text + "</a>")
|
||||
};
|
||||
origin.paragraph = renderer.paragraph = function (text) {
|
||||
if (/^!>/.test(text)) {
|
||||
@@ -2919,13 +2954,35 @@ Compiler.prototype._initRenderer = function _initRenderer () {
|
||||
};
|
||||
origin.image = renderer.image = function (href, title, text) {
|
||||
var url = href;
|
||||
var titleHTML = title ? (" title=\"" + title + "\"") : '';
|
||||
var attrs = '';
|
||||
|
||||
var ref = getAndRemoveConfig(title);
|
||||
var str = ref.str;
|
||||
var config = ref.config;
|
||||
title = str;
|
||||
|
||||
if (config['no-zoom']) {
|
||||
attrs += ' data-no-zoom';
|
||||
}
|
||||
|
||||
if (title) {
|
||||
attrs += " title=\"" + title + "\"";
|
||||
}
|
||||
|
||||
if (!isAbsolutePath(href)) {
|
||||
url = getPath(contentBase, href);
|
||||
}
|
||||
|
||||
return ("<img src=\"" + url + "\" data-origin=\"" + href + "\" alt=\"" + text + "\"" + titleHTML + ">")
|
||||
return ("<img src=\"" + url + "\"data-origin=\"" + href + "\" alt=\"" + text + "\"" + attrs + ">")
|
||||
};
|
||||
|
||||
var CHECKED_RE = /^\[([ x])\] +/;
|
||||
origin.listitem = renderer.listitem = function (text) {
|
||||
var checked = CHECKED_RE.exec(text);
|
||||
if (checked) {
|
||||
text = text.replace(CHECKED_RE, ("<input type=\"checkbox\" " + (checked[1] === 'x' ? 'checked' : '') + " />"));
|
||||
}
|
||||
return ("<li" + (checked ? " class=\"task-list-item\"" : '') + ">" + text + "</li>\n")
|
||||
};
|
||||
|
||||
renderer.origin = origin;
|
||||
@@ -2965,11 +3022,12 @@ Compiler.prototype.subSidebar = function subSidebar (level) {
|
||||
var cacheTree = ref.cacheTree;
|
||||
var toc = ref.toc;
|
||||
|
||||
toc[0] && toc[0].ignoreAllSubs && (this.toc = []);
|
||||
toc[0] && toc[0].ignoreAllSubs && toc.splice(0);
|
||||
toc[0] && toc[0].level === 1 && toc.shift();
|
||||
toc.forEach(function (node, i) {
|
||||
node.ignoreSubHeading && toc.splice(i, 1);
|
||||
});
|
||||
|
||||
for (var i = 0; i < toc.length; i++) {
|
||||
toc[i].ignoreSubHeading && toc.splice(i, 1) && i--;
|
||||
}
|
||||
|
||||
var tree$$1 = cacheTree[currentPath] || genTree(toc, level);
|
||||
|
||||
@@ -3182,7 +3240,7 @@ function scrollTo (el) {
|
||||
.begin();
|
||||
}
|
||||
|
||||
function highlight () {
|
||||
function highlight (path) {
|
||||
if (!enableScrollEvent) { return }
|
||||
var sidebar = getNode('.sidebar');
|
||||
var anchors = findAll('.anchor');
|
||||
@@ -3203,7 +3261,7 @@ function highlight () {
|
||||
}
|
||||
}
|
||||
if (!last) { return }
|
||||
var li = nav[last.getAttribute('data-id')];
|
||||
var li = nav[getNavKey(path, last.getAttribute('data-id'))];
|
||||
|
||||
if (!li || li === active) { return }
|
||||
|
||||
@@ -3246,17 +3304,17 @@ function scrollActiveSidebar (router) {
|
||||
if (href !== '/') {
|
||||
var ref = router.parse(href);
|
||||
var id = ref.query.id;
|
||||
var path = ref.path;
|
||||
if (id) { href = getNavKey(path, id); }
|
||||
var path$1 = ref.path;
|
||||
if (id) { href = getNavKey(path$1, id); }
|
||||
}
|
||||
|
||||
if (href) { nav[decodeURIComponent(href)] = li; }
|
||||
}
|
||||
|
||||
if (isMobile) { return }
|
||||
|
||||
off('scroll', highlight);
|
||||
on('scroll', highlight);
|
||||
var path = router.getCurrentPath();
|
||||
off('scroll', function () { return highlight(path); });
|
||||
on('scroll', function () { return highlight(path); });
|
||||
on(sidebar, 'mouseover', function () {
|
||||
hoverOver = true;
|
||||
});
|
||||
@@ -3805,14 +3863,14 @@ function initEvent (vm) {
|
||||
}
|
||||
}
|
||||
|
||||
function loadNested (path, file, next, vm, first) {
|
||||
function loadNested (path, qs, file, next, vm, first) {
|
||||
path = first ? path : path.replace(/\/$/, '');
|
||||
path = getParentPath(path);
|
||||
|
||||
if (!path) { return }
|
||||
|
||||
get(vm.router.getFile(path + file))
|
||||
.then(next, function (_) { return loadNested(path, file, next, vm); });
|
||||
get(vm.router.getFile(path + file) + qs).then(next, function (_) { return loadNested(path, qs, file, next, vm); }
|
||||
);
|
||||
}
|
||||
|
||||
function fetchMixin (proto) {
|
||||
@@ -3823,6 +3881,8 @@ function fetchMixin (proto) {
|
||||
|
||||
var ref = this.route;
|
||||
var path = ref.path;
|
||||
var query = ref.query;
|
||||
var qs = stringifyQuery(query, ['id']);
|
||||
var ref$1 = this.config;
|
||||
var loadNavbar = ref$1.loadNavbar;
|
||||
var loadSidebar = ref$1.loadSidebar;
|
||||
@@ -3830,7 +3890,7 @@ function fetchMixin (proto) {
|
||||
// Abort last request
|
||||
last && last.abort && last.abort();
|
||||
|
||||
last = get(this.router.getFile(path), true);
|
||||
last = get(this.router.getFile(path) + qs, true);
|
||||
|
||||
// Current page is html
|
||||
this.isHTML = /\.html$/g.test(path);
|
||||
@@ -3838,25 +3898,37 @@ function fetchMixin (proto) {
|
||||
var loadSideAndNav = function () {
|
||||
if (!loadSidebar) { return cb() }
|
||||
|
||||
var fn = function (result) { this$1._renderSidebar(result); cb(); };
|
||||
var fn = function (result) {
|
||||
this$1._renderSidebar(result);
|
||||
cb();
|
||||
};
|
||||
|
||||
// Load sidebar
|
||||
loadNested(path, loadSidebar, fn, this$1, true);
|
||||
loadNested(path, qs, loadSidebar, fn, this$1, true);
|
||||
};
|
||||
|
||||
// Load main content
|
||||
last.then(function (text, opt) {
|
||||
this$1._renderMain(text, opt);
|
||||
loadSideAndNav();
|
||||
},
|
||||
function (_) {
|
||||
this$1._renderMain(null);
|
||||
loadSideAndNav();
|
||||
});
|
||||
last.then(
|
||||
function (text, opt) {
|
||||
this$1._renderMain(text, opt);
|
||||
loadSideAndNav();
|
||||
},
|
||||
function (_) {
|
||||
this$1._renderMain(null);
|
||||
loadSideAndNav();
|
||||
}
|
||||
);
|
||||
|
||||
// Load nav
|
||||
loadNavbar &&
|
||||
loadNested(path, loadNavbar, function (text) { return this$1._renderNav(text); }, this, true);
|
||||
loadNested(
|
||||
path,
|
||||
qs,
|
||||
loadNavbar,
|
||||
function (text) { return this$1._renderNav(text); },
|
||||
this,
|
||||
true
|
||||
);
|
||||
};
|
||||
|
||||
proto._fetchCover = function () {
|
||||
@@ -3864,6 +3936,7 @@ function fetchMixin (proto) {
|
||||
|
||||
var ref = this.config;
|
||||
var coverpage = ref.coverpage;
|
||||
var query = this.route.query;
|
||||
var root = getParentPath(this.route.path);
|
||||
var path = this.router.getFile(root + coverpage);
|
||||
|
||||
@@ -3873,8 +3946,8 @@ function fetchMixin (proto) {
|
||||
}
|
||||
|
||||
this.coverIsHTML = /\.html$/g.test(path);
|
||||
get(path)
|
||||
.then(function (text) { return this$1._renderCover(text); });
|
||||
get(path + stringifyQuery(query, ['id'])).then(function (text) { return this$1._renderCover(text); }
|
||||
);
|
||||
};
|
||||
|
||||
proto.$fetch = function (cb) {
|
||||
@@ -3990,7 +4063,7 @@ initGlobalAPI();
|
||||
/**
|
||||
* Version
|
||||
*/
|
||||
Docsify.version = '4.3.12';
|
||||
Docsify.version = '4.5.6';
|
||||
|
||||
/**
|
||||
* Run Docsify
|
||||
|
||||
Vendored
+2
-2
File diff suppressed because one or more lines are too long
@@ -1,64 +0,0 @@
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
var DEFAULT_OPTIONS = {
|
||||
theme: 'light',
|
||||
image: 'show'
|
||||
};
|
||||
|
||||
function tpl (id, options) {
|
||||
var qs = [];
|
||||
|
||||
for (var key in options) {
|
||||
qs.push((key + "=" + (options[key])));
|
||||
}
|
||||
|
||||
var div = Docsify.dom.create('div');
|
||||
|
||||
Docsify.dom.toggleClass(div, 'codesponsor');
|
||||
div.innerHTML = "<iframe\n scrolling=0\n frameborder=0\n width=250\n height=250\n id=\"code-sponsor-embed-iframe\"\n src=\"https://app.codesponsor.io/widgets/" + id + "?" + (qs.join('&')) + "\">\n </iframe>";
|
||||
|
||||
return div
|
||||
}
|
||||
|
||||
function appIframe (id, opts) {
|
||||
var html = tpl(id, opts);
|
||||
|
||||
Docsify.dom.before(Docsify.dom.find('section.content'), html);
|
||||
}
|
||||
|
||||
function appendStyle () {
|
||||
Docsify.dom.style("\n .codesponsor {\n position: relative;\n float: right;\n right: 10px;\n top: 10px;\n }\n\n @media screen and (min-width: 1600px) {\n body.sticky .codesponsor {\n position: fixed;\n }\n\n .codesponsor {\n position: absolute;\n bottom: 10px;\n top: auto;\n float: none;\n }\n }\n ");
|
||||
}
|
||||
|
||||
var install = function (hook, vm) {
|
||||
var config = vm.config.codesponsor;
|
||||
var id;
|
||||
|
||||
if (typeof config === 'string') {
|
||||
id = config;
|
||||
config = {};
|
||||
} else {
|
||||
id = config.id;
|
||||
}
|
||||
|
||||
var opts = Docsify.util.merge(DEFAULT_OPTIONS, config);
|
||||
|
||||
if (!id) {
|
||||
throw Error('codesponsor plugin need id')
|
||||
}
|
||||
|
||||
if (Docsify.util.isMobile) {
|
||||
return
|
||||
}
|
||||
|
||||
// Append style
|
||||
hook.ready(function () {
|
||||
appendStyle();
|
||||
appIframe(id, opts);
|
||||
});
|
||||
};
|
||||
|
||||
window.$docsify.plugins = [].concat(install, window.$docsify.plugins);
|
||||
|
||||
}());
|
||||
Vendored
-1
@@ -1 +0,0 @@
|
||||
!function(){"use strict";function o(o,n){var i=[];for(var s in n)i.push(s+"="+n[s]);var e=Docsify.dom.create("div");return Docsify.dom.toggleClass(e,"codesponsor"),e.innerHTML='<iframe\n scrolling=0\n frameborder=0\n width=250\n height=250\n id="code-sponsor-embed-iframe"\n src="https://app.codesponsor.io/widgets/'+o+"?"+i.join("&")+'">\n </iframe>',e}function n(n,i){var s=o(n,i);Docsify.dom.before(Docsify.dom.find("section.content"),s)}function i(){Docsify.dom.style("\n .codesponsor {\n position: relative;\n float: right;\n right: 10px;\n top: 10px;\n }\n\n @media screen and (min-width: 1600px) {\n body.sticky .codesponsor {\n position: fixed;\n }\n\n .codesponsor {\n position: absolute;\n bottom: 10px;\n top: auto;\n float: none;\n }\n }\n ")}var s={theme:"light",image:"show"},e=function(o,e){var t,r=e.config.codesponsor;"string"==typeof r?(t=r,r={}):t=r.id;var c=Docsify.util.merge(s,r);if(!t)throw Error("codesponsor plugin need id");Docsify.util.isMobile||o.ready(function(){i(),n(t,c)})};window.$docsify.plugins=[].concat(e,window.$docsify.plugins)}();
|
||||
@@ -0,0 +1,56 @@
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
var fixedPath = location.href.replace('/-/', '/#/');
|
||||
if (fixedPath !== location.href) {
|
||||
location.href = fixedPath;
|
||||
}
|
||||
|
||||
function install (hook, vm) {
|
||||
var dom = Docsify.dom;
|
||||
var disqus = vm.config.disqus;
|
||||
if (!disqus) {
|
||||
throw Error('$docsify.disqus is required')
|
||||
}
|
||||
|
||||
hook.init(function (_) {
|
||||
var script = dom.create('script');
|
||||
|
||||
script.async = true;
|
||||
script.src = "https://" + disqus + ".disqus.com/embed.js";
|
||||
script.setAttribute('data-timestamp', +new Date());
|
||||
dom.appendTo(dom.body, script);
|
||||
});
|
||||
|
||||
hook.mounted(function (_) {
|
||||
var div = dom.create('div');
|
||||
div.id = 'disqus_thread';
|
||||
var main = dom.getNode('#main');
|
||||
div.style = "width: " + (main.clientWidth) + "px; margin: 0 auto 20px;";
|
||||
dom.appendTo(dom.find('.content'), div);
|
||||
|
||||
// eslint-disable-next-line
|
||||
window.disqus_config = function() {
|
||||
this.page.url = location.origin + '/-' + vm.route.path;
|
||||
this.page.identifier = vm.route.path;
|
||||
this.page.title = document.title;
|
||||
};
|
||||
});
|
||||
|
||||
hook.doneEach(function (_) {
|
||||
if (typeof window.DISQUS !== 'undefined') {
|
||||
window.DISQUS.reset({
|
||||
reload: true,
|
||||
config: function () {
|
||||
this.page.url = location.origin + '/-' + vm.route.path;
|
||||
this.page.identifier = vm.route.path;
|
||||
this.page.title = document.title;
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$docsify.plugins = [].concat(install, $docsify.plugins);
|
||||
|
||||
}());
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
!function(){"use strict";function i(i,t){var e=Docsify.dom,o=t.config.disqus;if(!o)throw Error("$docsify.disqus is required");i.init(function(i){var t=e.create("script");t.async=!0,t.src="https://"+o+".disqus.com/embed.js",t.setAttribute("data-timestamp",+new Date),e.appendTo(e.body,t)}),i.mounted(function(i){var o=e.create("div");o.id="disqus_thread";var n=e.getNode("#main");o.style="width: "+n.clientWidth+"px; margin: 0 auto 20px;",e.appendTo(e.find(".content"),o),window.disqus_config=function(){this.page.url=location.origin+"/-"+t.route.path,this.page.identifier=t.route.path,this.page.title=document.title}}),i.doneEach(function(i){void 0!==window.DISQUS&&window.DISQUS.reset({reload:!0,config:function(){this.page.url=location.origin+"/-"+t.route.path,this.page.identifier=t.route.path,this.page.title=document.title}})})}var t=location.href.replace("/-/","/#/");t!==location.href&&(location.href=t),$docsify.plugins=[].concat(i,$docsify.plugins)}();
|
||||
@@ -0,0 +1,22 @@
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
function install (hook, vm) {
|
||||
var dom = Docsify.dom;
|
||||
|
||||
hook.mounted(function (_) {
|
||||
var div = dom.create('div');
|
||||
div.id = 'gitalk-container';
|
||||
var main = dom.getNode('#main');
|
||||
div.style = "width: " + (main.clientWidth) + "px; margin: 0 auto 20px;";
|
||||
dom.appendTo(dom.find('.content'), div);
|
||||
var script = dom.create('script');
|
||||
var content = "gitalk.render('gitalk-container')";
|
||||
script.textContent = content;
|
||||
dom.appendTo(dom.body, script);
|
||||
});
|
||||
}
|
||||
|
||||
$docsify.plugins = [].concat(install, $docsify.plugins);
|
||||
|
||||
}());
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
!function(){"use strict";function t(t,n){var i=Docsify.dom;t.mounted(function(t){var n=i.create("div");n.id="gitalk-container";var e=i.getNode("#main");n.style="width: "+e.clientWidth+"px; margin: 0 auto 20px;",i.appendTo(i.find(".content"),n);var o=i.create("script");o.textContent="gitalk.render('gitalk-container')",i.appendTo(i.body,o)})}$docsify.plugins=[].concat(t,$docsify.plugins)}();
|
||||
+11
-3
@@ -70,14 +70,22 @@ function genIndex (path, content, router, depth) {
|
||||
return index
|
||||
}
|
||||
|
||||
function search (keywords) {
|
||||
/**
|
||||
* @param {String} query
|
||||
* @returns {Array}
|
||||
*/
|
||||
function search (query) {
|
||||
var matchingResults = [];
|
||||
var data = [];
|
||||
Object.keys(INDEXS).forEach(function (key) {
|
||||
data = data.concat(Object.keys(INDEXS[key]).map(function (page) { return INDEXS[key][page]; }));
|
||||
});
|
||||
|
||||
keywords = [].concat(keywords, keywords.trim().split(/[\s\-\,\\/]+/));
|
||||
query = query.trim();
|
||||
var keywords = query.split(/[\s\-\,\\/]+/);
|
||||
if (keywords.length !== 1) {
|
||||
keywords = [].concat(query, keywords);
|
||||
}
|
||||
|
||||
var loop = function ( i ) {
|
||||
var post = data[i];
|
||||
@@ -202,7 +210,7 @@ function doSearch (value) {
|
||||
|
||||
var html = '';
|
||||
matchs.forEach(function (post) {
|
||||
html += "<div class=\"matching-post\">\n<h2><a href=\"" + (post.url) + "\">" + (post.title) + "</a></h2>\n<p>" + (post.content) + "</p>\n</div>";
|
||||
html += "<div class=\"matching-post\">\n<a href=\"" + (post.url) + "\"> \n<h2>" + (post.title) + "</h2>\n<p>" + (post.content) + "</p>\n</a>\n</div>";
|
||||
});
|
||||
|
||||
$panel.classList.add('show');
|
||||
|
||||
Vendored
+1
-1
@@ -1 +1 @@
|
||||
!function(){"use strict";function e(e){var n={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};return String(e).replace(/[&<>"'\/]/g,function(e){return n[e]})}function n(e){var n=[];return h.dom.findAll("a:not([data-nosearch])").map(function(t){var o=t.href,i=t.getAttribute("href"),r=e.parse(o).path;r&&-1===n.indexOf(r)&&!Docsify.util.isAbsolutePath(i)&&n.push(r)}),n}function t(e){localStorage.setItem("docsify.search.expires",Date.now()+e),localStorage.setItem("docsify.search.index",JSON.stringify(g))}function o(e,n,t,o){void 0===n&&(n="");var i,r=window.marked.lexer(n),a=window.Docsify.slugify,s={};return r.forEach(function(n){if("heading"===n.type&&n.depth<=o)i=t.toURL(e,{id:a(n.text)}),s[i]={slug:i,title:n.text,body:""};else{if(!i)return;s[i]?s[i].body?s[i].body+="\n"+(n.text||""):s[i].body=n.text:s[i]={slug:i,title:"",body:""}}}),a.clear(),s}function i(n){var t=[],o=[];Object.keys(g).forEach(function(e){o=o.concat(Object.keys(g[e]).map(function(n){return g[e][n]}))}),n=[].concat(n,n.trim().split(/[\s\-\,\\\/]+/));for(var i=0;i<o.length;i++)!function(i){var r=o[i],a=!1,s="",c=r.title&&r.title.trim(),l=r.body&&r.body.trim(),f=r.slug||"";if(c&&l&&(n.forEach(function(n,t){var o=new RegExp(n,"gi"),i=-1,r=-1;if(i=c&&c.search(o),r=l&&l.search(o),i<0&&r<0)a=!1;else{a=!0,r<0&&(r=0);var f=0,d=0;f=r<11?0:r-10,d=0===f?70:r+n.length+60,d>l.length&&(d=l.length);var p="..."+e(l).substring(f,d).replace(o,'<em class="search-keyword">'+n+"</em>")+"...";s+=p}}),a)){var d={title:e(c),content:s,url:f};t.push(d)}}(i);return t}function r(e,i){h=Docsify;var r="auto"===e.paths,a=localStorage.getItem("docsify.search.expires")<Date.now();if(g=JSON.parse(localStorage.getItem("docsify.search.index")),a)g={};else if(!r)return;var s=r?n(i.router):e.paths,c=s.length,l=0;s.forEach(function(n){if(g[n])return l++;h.get(i.router.getFile(n)).then(function(r){g[n]=o(n,r,i.router,e.depth),c===++l&&t(e.maxAge)})})}function a(){Docsify.dom.style("\n.sidebar {\n padding-top: 0;\n}\n\n.search {\n margin-bottom: 20px;\n padding: 6px;\n border-bottom: 1px solid #eee;\n}\n\n.search .results-panel {\n display: none;\n}\n\n.search .results-panel.show {\n display: block;\n}\n\n.search input {\n outline: none;\n border: none;\n width: 100%;\n padding: 7px;\n line-height: 22px;\n font-size: 14px;\n -webkit-appearance: none;\n -moz-appearance: none;\n appearance: none;\n}\n\n.search h2 {\n font-size: 17px;\n margin: 10px 0;\n}\n\n.search a {\n text-decoration: none;\n color: inherit;\n}\n\n.search .matching-post {\n border-bottom: 1px solid #eee;\n}\n\n.search .matching-post:last-child {\n border-bottom: 0;\n}\n\n.search p {\n font-size: 14px;\n overflow: hidden;\n text-overflow: ellipsis;\n display: -webkit-box;\n -webkit-line-clamp: 2;\n -webkit-box-orient: vertical;\n}\n\n.search p.empty {\n text-align: center;\n}")}function s(e,n){void 0===n&&(n="");var t='<input type="search" value="'+n+'" /><div class="results-panel"></div></div>',o=Docsify.dom.create("div",t),i=Docsify.dom.find("aside");Docsify.dom.toggleClass(o,"search"),Docsify.dom.before(i,o)}function c(e){var n=Docsify.dom.find("div.search"),t=Docsify.dom.find(n,".results-panel");if(!e)return t.classList.remove("show"),void(t.innerHTML="");var o=i(e),r="";o.forEach(function(e){r+='<div class="matching-post">\n<h2><a href="'+e.url+'">'+e.title+"</a></h2>\n<p>"+e.content+"</p>\n</div>"}),t.classList.add("show"),t.innerHTML=r||'<p class="empty">'+y+"</p>"}function l(){var e,n=Docsify.dom.find("div.search"),t=Docsify.dom.find(n,"input");Docsify.dom.on(n,"click",function(e){return"A"!==e.target.tagName&&e.stopPropagation()}),Docsify.dom.on(t,"input",function(n){clearTimeout(e),e=setTimeout(function(e){return c(n.target.value.trim())},100)})}function f(e,n){var t=Docsify.dom.getNode('.search input[type="search"]');if(t)if("string"==typeof e)t.placeholder=e;else{var o=Object.keys(e).filter(function(e){return n.indexOf(e)>-1})[0];t.placeholder=e[o]}}function d(e,n){if("string"==typeof e)y=e;else{var t=Object.keys(e).filter(function(e){return n.indexOf(e)>-1})[0];y=e[t]}}function p(e,n){var t=n.router.parse().query.s;a(),s(e,t),l(),t&&setTimeout(function(e){return c(t)},500)}function u(e,n){f(e.placeholder,n.route.path),d(e.noData,n.route.path)}var h,g={},y="",m={placeholder:"Type to search",noData:"No Results!",paths:"auto",depth:2,maxAge:864e5},v=function(e,n){var t=Docsify.util,o=n.config.search||m;Array.isArray(o)?m.paths=o:"object"==typeof o&&(m.paths=Array.isArray(o.paths)?o.paths:"auto",m.maxAge=t.isPrimitive(o.maxAge)?o.maxAge:m.maxAge,m.placeholder=o.placeholder||m.placeholder,m.noData=o.noData||m.noData,m.depth=o.depth||m.depth);var i="auto"===m.paths;e.mounted(function(e){p(m,n),!i&&r(m,n)}),e.doneEach(function(e){u(m,n),i&&r(m,n)})};$docsify.plugins=[].concat(v,$docsify.plugins)}();
|
||||
!function(){"use strict";function e(e){var n={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};return String(e).replace(/[&<>"'\/]/g,function(e){return n[e]})}function n(e){var n=[];return h.dom.findAll("a:not([data-nosearch])").map(function(t){var o=t.href,i=t.getAttribute("href"),r=e.parse(o).path;r&&-1===n.indexOf(r)&&!Docsify.util.isAbsolutePath(i)&&n.push(r)}),n}function t(e){localStorage.setItem("docsify.search.expires",Date.now()+e),localStorage.setItem("docsify.search.index",JSON.stringify(g))}function o(e,n,t,o){void 0===n&&(n="");var i,r=window.marked.lexer(n),a=window.Docsify.slugify,s={};return r.forEach(function(n){if("heading"===n.type&&n.depth<=o)i=t.toURL(e,{id:a(n.text)}),s[i]={slug:i,title:n.text,body:""};else{if(!i)return;s[i]?s[i].body?s[i].body+="\n"+(n.text||""):s[i].body=n.text:s[i]={slug:i,title:"",body:""}}}),a.clear(),s}function i(n){var t=[],o=[];Object.keys(g).forEach(function(e){o=o.concat(Object.keys(g[e]).map(function(n){return g[e][n]}))}),n=n.trim();var i=n.split(/[\s\-\,\\\/]+/);1!==i.length&&(i=[].concat(n,i));for(var r=0;r<o.length;r++)!function(n){var r=o[n],a=!1,s="",c=r.title&&r.title.trim(),l=r.body&&r.body.trim(),f=r.slug||"";if(c&&l&&(i.forEach(function(n,t){var o=new RegExp(n,"gi"),i=-1,r=-1;if(i=c&&c.search(o),r=l&&l.search(o),i<0&&r<0)a=!1;else{a=!0,r<0&&(r=0);var f=0,d=0;f=r<11?0:r-10,d=0===f?70:r+n.length+60,d>l.length&&(d=l.length);var p="..."+e(l).substring(f,d).replace(o,'<em class="search-keyword">'+n+"</em>")+"...";s+=p}}),a)){var d={title:e(c),content:s,url:f};t.push(d)}}(r);return t}function r(e,i){h=Docsify;var r="auto"===e.paths,a=localStorage.getItem("docsify.search.expires")<Date.now();if(g=JSON.parse(localStorage.getItem("docsify.search.index")),a)g={};else if(!r)return;var s=r?n(i.router):e.paths,c=s.length,l=0;s.forEach(function(n){if(g[n])return l++;h.get(i.router.getFile(n)).then(function(r){g[n]=o(n,r,i.router,e.depth),c===++l&&t(e.maxAge)})})}function a(){Docsify.dom.style("\n.sidebar {\n padding-top: 0;\n}\n\n.search {\n margin-bottom: 20px;\n padding: 6px;\n border-bottom: 1px solid #eee;\n}\n\n.search .results-panel {\n display: none;\n}\n\n.search .results-panel.show {\n display: block;\n}\n\n.search input {\n outline: none;\n border: none;\n width: 100%;\n padding: 7px;\n line-height: 22px;\n font-size: 14px;\n -webkit-appearance: none;\n -moz-appearance: none;\n appearance: none;\n}\n\n.search h2 {\n font-size: 17px;\n margin: 10px 0;\n}\n\n.search a {\n text-decoration: none;\n color: inherit;\n}\n\n.search .matching-post {\n border-bottom: 1px solid #eee;\n}\n\n.search .matching-post:last-child {\n border-bottom: 0;\n}\n\n.search p {\n font-size: 14px;\n overflow: hidden;\n text-overflow: ellipsis;\n display: -webkit-box;\n -webkit-line-clamp: 2;\n -webkit-box-orient: vertical;\n}\n\n.search p.empty {\n text-align: center;\n}")}function s(e,n){void 0===n&&(n="");var t='<input type="search" value="'+n+'" /><div class="results-panel"></div></div>',o=Docsify.dom.create("div",t),i=Docsify.dom.find("aside");Docsify.dom.toggleClass(o,"search"),Docsify.dom.before(i,o)}function c(e){var n=Docsify.dom.find("div.search"),t=Docsify.dom.find(n,".results-panel");if(!e)return t.classList.remove("show"),void(t.innerHTML="");var o=i(e),r="";o.forEach(function(e){r+='<div class="matching-post">\n<a href="'+e.url+'"> \n<h2>'+e.title+"</h2>\n<p>"+e.content+"</p>\n</a>\n</div>"}),t.classList.add("show"),t.innerHTML=r||'<p class="empty">'+y+"</p>"}function l(){var e,n=Docsify.dom.find("div.search"),t=Docsify.dom.find(n,"input");Docsify.dom.on(n,"click",function(e){return"A"!==e.target.tagName&&e.stopPropagation()}),Docsify.dom.on(t,"input",function(n){clearTimeout(e),e=setTimeout(function(e){return c(n.target.value.trim())},100)})}function f(e,n){var t=Docsify.dom.getNode('.search input[type="search"]');if(t)if("string"==typeof e)t.placeholder=e;else{var o=Object.keys(e).filter(function(e){return n.indexOf(e)>-1})[0];t.placeholder=e[o]}}function d(e,n){if("string"==typeof e)y=e;else{var t=Object.keys(e).filter(function(e){return n.indexOf(e)>-1})[0];y=e[t]}}function p(e,n){var t=n.router.parse().query.s;a(),s(e,t),l(),t&&setTimeout(function(e){return c(t)},500)}function u(e,n){f(e.placeholder,n.route.path),d(e.noData,n.route.path)}var h,g={},y="",m={placeholder:"Type to search",noData:"No Results!",paths:"auto",depth:2,maxAge:864e5},v=function(e,n){var t=Docsify.util,o=n.config.search||m;Array.isArray(o)?m.paths=o:"object"==typeof o&&(m.paths=Array.isArray(o.paths)?o.paths:"auto",m.maxAge=t.isPrimitive(o.maxAge)?o.maxAge:m.maxAge,m.placeholder=o.placeholder||m.placeholder,m.noData=o.noData||m.noData,m.depth=o.depth||m.depth);var i="auto"===m.paths;e.mounted(function(e){p(m,n),!i&&r(m,n)}),e.doneEach(function(e){u(m,n),i&&r(m,n)})};$docsify.plugins=[].concat(v,$docsify.plugins)}();
|
||||
|
||||
+11
-288
File diff suppressed because one or more lines are too long
Vendored
+1
-1
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+1
-1
File diff suppressed because one or more lines are too long
+1
-1
File diff suppressed because one or more lines are too long
+1
-1
File diff suppressed because one or more lines are too long
Generated
+31
-31
@@ -1,9 +1,19 @@
|
||||
{
|
||||
"name": "docsify",
|
||||
"version": "4.3.12",
|
||||
"version": "4.5.6",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
"JSONStream": {
|
||||
"version": "1.3.1",
|
||||
"resolved": "https://registry.npmjs.org/JSONStream/-/JSONStream-1.3.1.tgz",
|
||||
"integrity": "sha1-cH92HgHa6eFvG8+TcDt4xwlmV5o=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"jsonparse": "1.3.1",
|
||||
"through": "2.3.8"
|
||||
}
|
||||
},
|
||||
"abbrev": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.0.tgz",
|
||||
@@ -991,8 +1001,8 @@
|
||||
"integrity": "sha1-4ye1MZThp61dxjR57pCZpSsCSGU=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"is-text-path": "1.0.1",
|
||||
"JSONStream": "1.3.1",
|
||||
"is-text-path": "1.0.1",
|
||||
"lodash": "4.17.4",
|
||||
"meow": "3.7.0",
|
||||
"split2": "2.1.1",
|
||||
@@ -2846,11 +2856,6 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"string_decoder": {
|
||||
"version": "0.10.31",
|
||||
"bundled": true,
|
||||
"dev": true
|
||||
},
|
||||
"string-width": {
|
||||
"version": "1.0.2",
|
||||
"bundled": true,
|
||||
@@ -2861,6 +2866,11 @@
|
||||
"strip-ansi": "3.0.1"
|
||||
}
|
||||
},
|
||||
"string_decoder": {
|
||||
"version": "0.10.31",
|
||||
"bundled": true,
|
||||
"dev": true
|
||||
},
|
||||
"stringstream": {
|
||||
"version": "0.0.5",
|
||||
"bundled": true,
|
||||
@@ -3785,16 +3795,6 @@
|
||||
"integrity": "sha1-T9kss04OnbPInIYi7PUfm5eMbLk=",
|
||||
"dev": true
|
||||
},
|
||||
"JSONStream": {
|
||||
"version": "1.3.1",
|
||||
"resolved": "https://registry.npmjs.org/JSONStream/-/JSONStream-1.3.1.tgz",
|
||||
"integrity": "sha1-cH92HgHa6eFvG8+TcDt4xwlmV5o=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"jsonparse": "1.3.1",
|
||||
"through": "2.3.8"
|
||||
}
|
||||
},
|
||||
"jsx-ast-utils": {
|
||||
"version": "1.4.1",
|
||||
"resolved": "https://registry.npmjs.org/jsx-ast-utils/-/jsx-ast-utils-1.4.1.tgz",
|
||||
@@ -4239,6 +4239,11 @@
|
||||
"integrity": "sha1-3oGf282E3M2PrlnGrreWFbnSZqw=",
|
||||
"dev": true
|
||||
},
|
||||
"medium-zoom": {
|
||||
"version": "0.2.0",
|
||||
"resolved": "https://registry.npmjs.org/medium-zoom/-/medium-zoom-0.2.0.tgz",
|
||||
"integrity": "sha512-2595M4GDwjoyZVDtkw6JWY8JxkhZVumqPjvM8coyRcULPZpoij2bQJ1/syqtx4XiflaqTva0cAch1kzqk0ir9Q=="
|
||||
},
|
||||
"mem": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/mem/-/mem-1.1.0.tgz",
|
||||
@@ -6500,15 +6505,6 @@
|
||||
"integrity": "sha1-J5siXfHVgrH1TmWt3UNS4Y+qBxM=",
|
||||
"dev": true
|
||||
},
|
||||
"string_decoder": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.1.tgz",
|
||||
"integrity": "sha1-YuIA8DmVWmgQ2N8KM//A8BNmLZg=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"safe-buffer": "5.0.1"
|
||||
}
|
||||
},
|
||||
"string-hash": {
|
||||
"version": "1.1.3",
|
||||
"resolved": "https://registry.npmjs.org/string-hash/-/string-hash-1.1.3.tgz",
|
||||
@@ -6535,6 +6531,15 @@
|
||||
"strip-ansi": "3.0.1"
|
||||
}
|
||||
},
|
||||
"string_decoder": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.1.tgz",
|
||||
"integrity": "sha1-YuIA8DmVWmgQ2N8KM//A8BNmLZg=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"safe-buffer": "5.0.1"
|
||||
}
|
||||
},
|
||||
"strip-ansi": {
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz",
|
||||
@@ -7192,11 +7197,6 @@
|
||||
"dev": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"zoom-image": {
|
||||
"version": "0.1.4",
|
||||
"resolved": "https://registry.npmjs.org/zoom-image/-/zoom-image-0.1.4.tgz",
|
||||
"integrity": "sha1-+q8KgFG7Zya+YM891qM17HPx6Wk="
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+4
-4
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "docsify",
|
||||
"version": "4.3.12",
|
||||
"version": "4.5.6",
|
||||
"description": "A magical documentation generator.",
|
||||
"author": {
|
||||
"name": "qingwei-li",
|
||||
@@ -20,7 +20,7 @@
|
||||
"themes"
|
||||
],
|
||||
"scripts": {
|
||||
"bootstrap": "npm i && lerna bootstrap",
|
||||
"bootstrap": "npm i && lerna bootstrap && npm run build:ssr",
|
||||
"build": "rm -rf lib themes && node build/build && mkdir lib/themes && mkdir themes && node build/build-css && npm run build:ssr && node build/build-cover",
|
||||
"dev:build": "rm -rf lib themes && mkdir themes && node build/build --dev && node build/build-css --dev",
|
||||
"dev": "node app & nodemon -w src -e js,css --exec 'npm run dev:build'",
|
||||
@@ -31,10 +31,10 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"marked": "^0.3.6",
|
||||
"medium-zoom": "^0.2.0",
|
||||
"prismjs": "^1.6.0",
|
||||
"tinydate": "^1.0.0",
|
||||
"tweezer.js": "^1.4.0",
|
||||
"zoom-image": "^0.1.4"
|
||||
"tweezer.js": "^1.4.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"conventional-changelog-cli": "^1.3.2",
|
||||
|
||||
+1
-1
@@ -37,5 +37,5 @@
|
||||
"integrity": "sha1-6DWIAbhrg7F1YNTjw4LXrvIQCUQ="
|
||||
}
|
||||
},
|
||||
"version": "4.3.12"
|
||||
"version": "4.5.6"
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "docsify-server-renderer",
|
||||
"version": "4.3.12",
|
||||
"version": "4.5.6",
|
||||
"description": "docsify server renderer",
|
||||
"author": {
|
||||
"name": "qingwei-li",
|
||||
|
||||
@@ -24,7 +24,7 @@ function scrollTo (el) {
|
||||
.begin()
|
||||
}
|
||||
|
||||
function highlight () {
|
||||
function highlight (path) {
|
||||
if (!enableScrollEvent) return
|
||||
const sidebar = dom.getNode('.sidebar')
|
||||
const anchors = dom.findAll('.anchor')
|
||||
@@ -45,7 +45,7 @@ function highlight () {
|
||||
}
|
||||
}
|
||||
if (!last) return
|
||||
const li = nav[last.getAttribute('data-id')]
|
||||
const li = nav[getNavKey(path, last.getAttribute('data-id'))]
|
||||
|
||||
if (!li || li === active) return
|
||||
|
||||
@@ -94,9 +94,9 @@ export function scrollActiveSidebar (router) {
|
||||
}
|
||||
|
||||
if (isMobile) return
|
||||
|
||||
dom.off('scroll', highlight)
|
||||
dom.on('scroll', highlight)
|
||||
const path = router.getCurrentPath()
|
||||
dom.off('scroll', () => highlight(path))
|
||||
dom.on('scroll', () => highlight(path))
|
||||
dom.on(sidebar, 'mouseover', () => {
|
||||
hoverOver = true
|
||||
})
|
||||
|
||||
+35
-19
@@ -1,29 +1,31 @@
|
||||
import { get } from './ajax'
|
||||
import { callHook } from '../init/lifecycle'
|
||||
import { getParentPath } from '../router/util'
|
||||
import { getParentPath, stringifyQuery } from '../router/util'
|
||||
import { noop } from '../util/core'
|
||||
import { getAndActive } from '../event/sidebar'
|
||||
|
||||
function loadNested (path, file, next, vm, first) {
|
||||
function loadNested (path, qs, file, next, vm, first) {
|
||||
path = first ? path : path.replace(/\/$/, '')
|
||||
path = getParentPath(path)
|
||||
|
||||
if (!path) return
|
||||
|
||||
get(vm.router.getFile(path + file))
|
||||
.then(next, _ => loadNested(path, file, next, vm))
|
||||
get(vm.router.getFile(path + file) + qs).then(next, _ =>
|
||||
loadNested(path, qs, file, next, vm)
|
||||
)
|
||||
}
|
||||
|
||||
export function fetchMixin (proto) {
|
||||
let last
|
||||
proto._fetch = function (cb = noop) {
|
||||
const { path } = this.route
|
||||
const { path, query } = this.route
|
||||
const qs = stringifyQuery(query, ['id'])
|
||||
const { loadNavbar, loadSidebar } = this.config
|
||||
|
||||
// Abort last request
|
||||
last && last.abort && last.abort()
|
||||
|
||||
last = get(this.router.getFile(path), true)
|
||||
last = get(this.router.getFile(path) + qs, true)
|
||||
|
||||
// Current page is html
|
||||
this.isHTML = /\.html$/g.test(path)
|
||||
@@ -31,29 +33,42 @@ export function fetchMixin (proto) {
|
||||
const loadSideAndNav = () => {
|
||||
if (!loadSidebar) return cb()
|
||||
|
||||
const fn = result => { this._renderSidebar(result); cb() }
|
||||
const fn = result => {
|
||||
this._renderSidebar(result)
|
||||
cb()
|
||||
}
|
||||
|
||||
// Load sidebar
|
||||
loadNested(path, loadSidebar, fn, this, true)
|
||||
loadNested(path, qs, loadSidebar, fn, this, true)
|
||||
}
|
||||
|
||||
// Load main content
|
||||
last.then((text, opt) => {
|
||||
this._renderMain(text, opt)
|
||||
loadSideAndNav()
|
||||
},
|
||||
_ => {
|
||||
this._renderMain(null)
|
||||
loadSideAndNav()
|
||||
})
|
||||
last.then(
|
||||
(text, opt) => {
|
||||
this._renderMain(text, opt)
|
||||
loadSideAndNav()
|
||||
},
|
||||
_ => {
|
||||
this._renderMain(null)
|
||||
loadSideAndNav()
|
||||
}
|
||||
)
|
||||
|
||||
// Load nav
|
||||
loadNavbar &&
|
||||
loadNested(path, loadNavbar, text => this._renderNav(text), this, true)
|
||||
loadNested(
|
||||
path,
|
||||
qs,
|
||||
loadNavbar,
|
||||
text => this._renderNav(text),
|
||||
this,
|
||||
true
|
||||
)
|
||||
}
|
||||
|
||||
proto._fetchCover = function () {
|
||||
const { coverpage } = this.config
|
||||
const query = this.route.query
|
||||
const root = getParentPath(this.route.path)
|
||||
const path = this.router.getFile(root + coverpage)
|
||||
|
||||
@@ -63,8 +78,9 @@ export function fetchMixin (proto) {
|
||||
}
|
||||
|
||||
this.coverIsHTML = /\.html$/g.test(path)
|
||||
get(path)
|
||||
.then(text => this._renderCover(text))
|
||||
get(path + stringifyQuery(query, ['id'])).then(text =>
|
||||
this._renderCover(text)
|
||||
)
|
||||
}
|
||||
|
||||
proto.$fetch = function (cb = noop) {
|
||||
|
||||
+70
-23
@@ -8,6 +8,20 @@ import { isAbsolutePath, getPath } from '../router/util'
|
||||
import { isFn, merge, cached } from '../util/core'
|
||||
|
||||
const cachedLinks = {}
|
||||
function getAndRemoveConfig (str = '') {
|
||||
const config = {}
|
||||
|
||||
if (str) {
|
||||
str = str
|
||||
.replace(/:([\w-]+)=?([\w-]+)?/g, (m, key, value) => {
|
||||
config[key] = value || true
|
||||
return ''
|
||||
})
|
||||
.trim()
|
||||
}
|
||||
|
||||
return { str, config }
|
||||
}
|
||||
|
||||
export class Compiler {
|
||||
constructor (config, router) {
|
||||
@@ -25,9 +39,11 @@ export class Compiler {
|
||||
if (isFn(mdConf)) {
|
||||
compile = mdConf(marked, renderer)
|
||||
} else {
|
||||
marked.setOptions(merge(mdConf, {
|
||||
renderer: merge(renderer, mdConf.renderer)
|
||||
}))
|
||||
marked.setOptions(
|
||||
merge(mdConf, {
|
||||
renderer: merge(renderer, mdConf.renderer)
|
||||
})
|
||||
)
|
||||
compile = marked
|
||||
}
|
||||
|
||||
@@ -91,33 +107,43 @@ export class Compiler {
|
||||
}
|
||||
// highlight code
|
||||
origin.code = renderer.code = function (code, lang = '') {
|
||||
const hl = Prism.highlight(code, Prism.languages[lang] || Prism.languages.markup)
|
||||
const hl = Prism.highlight(
|
||||
code,
|
||||
Prism.languages[lang] || Prism.languages.markup
|
||||
)
|
||||
|
||||
return `<pre v-pre data-lang="${lang}"><code class="lang-${lang}">${hl}</code></pre>`
|
||||
}
|
||||
origin.link = renderer.link = function (href, title, text) {
|
||||
let blank = ''
|
||||
origin.link = renderer.link = function (href, title = '', text) {
|
||||
let attrs = ''
|
||||
|
||||
if (!/:|(\/{2})/.test(href) &&
|
||||
const { str, config } = getAndRemoveConfig(title)
|
||||
title = str
|
||||
|
||||
if (
|
||||
!/:|(\/{2})/.test(href) &&
|
||||
!_self.matchNotCompileLink(href) &&
|
||||
!/(\s?:ignore)(\s\S+)?$/.test(title)) {
|
||||
!config.ignore
|
||||
) {
|
||||
href = router.toURL(href, null, router.getCurrentPath())
|
||||
} else {
|
||||
blank = ` target="${linkTarget}"`
|
||||
title = title && title.replace(/:ignore/g, '').trim()
|
||||
attrs += ` target="${linkTarget}"`
|
||||
}
|
||||
|
||||
let target = title && title.match(/:target=\w+/)
|
||||
if (target) {
|
||||
target = target[0]
|
||||
title = title.replace(target, '')
|
||||
blank = ' ' + target.slice(1)
|
||||
if (config.target) {
|
||||
attrs += ' target=' + config.target
|
||||
}
|
||||
|
||||
if (config.disabled) {
|
||||
attrs += ' disabled'
|
||||
href = 'javascript:void(0)'
|
||||
}
|
||||
|
||||
if (title) {
|
||||
title = ` title="${title}"`
|
||||
attrs += ` title="${title}"`
|
||||
}
|
||||
return `<a href="${href}"${title || ''}${blank}>${text}</a>`
|
||||
|
||||
return `<a href="${href}"${attrs}>${text}</a>`
|
||||
}
|
||||
origin.paragraph = renderer.paragraph = function (text) {
|
||||
if (/^!>/.test(text)) {
|
||||
@@ -129,13 +155,33 @@ export class Compiler {
|
||||
}
|
||||
origin.image = renderer.image = function (href, title, text) {
|
||||
let url = href
|
||||
const titleHTML = title ? ` title="${title}"` : ''
|
||||
let attrs = ''
|
||||
|
||||
const { str, config } = getAndRemoveConfig(title)
|
||||
title = str
|
||||
|
||||
if (config['no-zoom']) {
|
||||
attrs += ' data-no-zoom'
|
||||
}
|
||||
|
||||
if (title) {
|
||||
attrs += ` title="${title}"`
|
||||
}
|
||||
|
||||
if (!isAbsolutePath(href)) {
|
||||
url = getPath(contentBase, href)
|
||||
}
|
||||
|
||||
return `<img src="${url}" data-origin="${href}" alt="${text}"${titleHTML}>`
|
||||
return `<img src="${url}"data-origin="${href}" alt="${text}"${attrs}>`
|
||||
}
|
||||
|
||||
const CHECKED_RE = /^\[([ x])\] +/
|
||||
origin.listitem = renderer.listitem = function (text) {
|
||||
const checked = CHECKED_RE.exec(text)
|
||||
if (checked) {
|
||||
text = text.replace(CHECKED_RE, `<input type="checkbox" ${checked[1] === 'x' ? 'checked' : ''} />`)
|
||||
}
|
||||
return `<li${checked ? ` class="task-list-item"` : ''}>${text}</li>\n`
|
||||
}
|
||||
|
||||
renderer.origin = origin
|
||||
@@ -173,11 +219,12 @@ export class Compiler {
|
||||
const currentPath = this.router.getCurrentPath()
|
||||
const { cacheTree, toc } = this
|
||||
|
||||
toc[0] && toc[0].ignoreAllSubs && (this.toc = [])
|
||||
toc[0] && toc[0].ignoreAllSubs && toc.splice(0)
|
||||
toc[0] && toc[0].level === 1 && toc.shift()
|
||||
toc.forEach((node, i) => {
|
||||
node.ignoreSubHeading && toc.splice(i, 1)
|
||||
})
|
||||
|
||||
for (let i = 0; i < toc.length; i++) {
|
||||
toc[i].ignoreSubHeading && toc.splice(i, 1) && i--
|
||||
}
|
||||
|
||||
const tree = cacheTree[currentPath] || genTree(toc, level)
|
||||
|
||||
|
||||
@@ -22,10 +22,11 @@ export function parseQuery (query) {
|
||||
return res
|
||||
}
|
||||
|
||||
export function stringifyQuery (obj) {
|
||||
export function stringifyQuery (obj, ignores = []) {
|
||||
const qs = []
|
||||
|
||||
for (const key in obj) {
|
||||
if (ignores.indexOf(key) > -1) continue
|
||||
qs.push(
|
||||
obj[key]
|
||||
? `${encode(key)}=${encode(obj[key])}`.toLowerCase()
|
||||
|
||||
@@ -1,86 +0,0 @@
|
||||
const DEFAULT_OPTIONS = {
|
||||
theme: 'light',
|
||||
image: 'show'
|
||||
}
|
||||
|
||||
function tpl (id, options) {
|
||||
const qs = []
|
||||
|
||||
for (const key in options) {
|
||||
qs.push(`${key}=${options[key]}`)
|
||||
}
|
||||
|
||||
const div = Docsify.dom.create('div')
|
||||
|
||||
Docsify.dom.toggleClass(div, 'codesponsor')
|
||||
div.innerHTML = `<iframe
|
||||
scrolling=0
|
||||
frameborder=0
|
||||
width=250
|
||||
height=250
|
||||
id="code-sponsor-embed-iframe"
|
||||
src="https://app.codesponsor.io/widgets/${id}?${qs.join('&')}">
|
||||
</iframe>`
|
||||
|
||||
return div
|
||||
}
|
||||
|
||||
function appIframe (id, opts) {
|
||||
const html = tpl(id, opts)
|
||||
|
||||
Docsify.dom.before(Docsify.dom.find('section.content'), html)
|
||||
}
|
||||
|
||||
function appendStyle () {
|
||||
Docsify.dom.style(`
|
||||
.codesponsor {
|
||||
position: relative;
|
||||
float: right;
|
||||
right: 10px;
|
||||
top: 10px;
|
||||
}
|
||||
|
||||
@media screen and (min-width: 1600px) {
|
||||
body.sticky .codesponsor {
|
||||
position: fixed;
|
||||
}
|
||||
|
||||
.codesponsor {
|
||||
position: absolute;
|
||||
bottom: 10px;
|
||||
top: auto;
|
||||
float: none;
|
||||
}
|
||||
}
|
||||
`)
|
||||
}
|
||||
|
||||
const install = function (hook, vm) {
|
||||
let config = vm.config.codesponsor
|
||||
let id
|
||||
|
||||
if (typeof config === 'string') {
|
||||
id = config
|
||||
config = {}
|
||||
} else {
|
||||
id = config.id
|
||||
}
|
||||
|
||||
const opts = Docsify.util.merge(DEFAULT_OPTIONS, config)
|
||||
|
||||
if (!id) {
|
||||
throw Error('codesponsor plugin need id')
|
||||
}
|
||||
|
||||
if (Docsify.util.isMobile) {
|
||||
return
|
||||
}
|
||||
|
||||
// Append style
|
||||
hook.ready(() => {
|
||||
appendStyle()
|
||||
appIframe(id, opts)
|
||||
})
|
||||
}
|
||||
|
||||
window.$docsify.plugins = [].concat(install, window.$docsify.plugins)
|
||||
@@ -0,0 +1,51 @@
|
||||
const fixedPath = location.href.replace('/-/', '/#/')
|
||||
if (fixedPath !== location.href) {
|
||||
location.href = fixedPath
|
||||
}
|
||||
|
||||
function install (hook, vm) {
|
||||
const dom = Docsify.dom
|
||||
const disqus = vm.config.disqus
|
||||
if (!disqus) {
|
||||
throw Error('$docsify.disqus is required')
|
||||
}
|
||||
|
||||
hook.init(_ => {
|
||||
const script = dom.create('script')
|
||||
|
||||
script.async = true
|
||||
script.src = `https://${disqus}.disqus.com/embed.js`
|
||||
script.setAttribute('data-timestamp', +new Date())
|
||||
dom.appendTo(dom.body, script)
|
||||
})
|
||||
|
||||
hook.mounted(_ => {
|
||||
const div = dom.create('div')
|
||||
div.id = 'disqus_thread'
|
||||
const main = dom.getNode('#main')
|
||||
div.style = `width: ${main.clientWidth}px; margin: 0 auto 20px;`
|
||||
dom.appendTo(dom.find('.content'), div)
|
||||
|
||||
// eslint-disable-next-line
|
||||
window.disqus_config = function() {
|
||||
this.page.url = location.origin + '/-' + vm.route.path
|
||||
this.page.identifier = vm.route.path
|
||||
this.page.title = document.title
|
||||
}
|
||||
})
|
||||
|
||||
hook.doneEach(_ => {
|
||||
if (typeof window.DISQUS !== 'undefined') {
|
||||
window.DISQUS.reset({
|
||||
reload: true,
|
||||
config: function () {
|
||||
this.page.url = location.origin + '/-' + vm.route.path
|
||||
this.page.identifier = vm.route.path
|
||||
this.page.title = document.title
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
$docsify.plugins = [].concat(install, $docsify.plugins)
|
||||
@@ -0,0 +1,17 @@
|
||||
function install (hook, vm) {
|
||||
const dom = Docsify.dom
|
||||
|
||||
hook.mounted(_ => {
|
||||
const div = dom.create('div')
|
||||
div.id = 'gitalk-container'
|
||||
const main = dom.getNode('#main')
|
||||
div.style = `width: ${main.clientWidth}px; margin: 0 auto 20px;`
|
||||
dom.appendTo(dom.find('.content'), div)
|
||||
const script = dom.create('script')
|
||||
const content = `gitalk.render('gitalk-container')`
|
||||
script.textContent = content
|
||||
dom.appendTo(dom.body, script)
|
||||
})
|
||||
}
|
||||
|
||||
$docsify.plugins = [].concat(install, $docsify.plugins)
|
||||
@@ -94,8 +94,10 @@ function doSearch (value) {
|
||||
let html = ''
|
||||
matchs.forEach(post => {
|
||||
html += `<div class="matching-post">
|
||||
<h2><a href="${post.url}">${post.title}</a></h2>
|
||||
<a href="${post.url}">
|
||||
<h2>${post.title}</h2>
|
||||
<p>${post.content}</p>
|
||||
</a>
|
||||
</div>`
|
||||
})
|
||||
|
||||
|
||||
@@ -65,14 +65,22 @@ export function genIndex (path, content = '', router, depth) {
|
||||
return index
|
||||
}
|
||||
|
||||
export function search (keywords) {
|
||||
/**
|
||||
* @param {String} query
|
||||
* @returns {Array}
|
||||
*/
|
||||
export function search (query) {
|
||||
const matchingResults = []
|
||||
let data = []
|
||||
Object.keys(INDEXS).forEach(key => {
|
||||
data = data.concat(Object.keys(INDEXS[key]).map(page => INDEXS[key][page]))
|
||||
})
|
||||
|
||||
keywords = [].concat(keywords, keywords.trim().split(/[\s\-\,\\/]+/))
|
||||
query = query.trim()
|
||||
let keywords = query.split(/[\s\-\,\\/]+/)
|
||||
if (keywords.length !== 1) {
|
||||
keywords = [].concat(query, keywords)
|
||||
}
|
||||
|
||||
for (let i = 0; i < data.length; i++) {
|
||||
const post = data[i]
|
||||
|
||||
@@ -1,22 +1,14 @@
|
||||
import zoom from 'zoom-image'
|
||||
import style from 'zoom-image/css/zoom-image.css'
|
||||
import mediumZoom from 'medium-zoom'
|
||||
|
||||
function install (hook) {
|
||||
const dom = Docsify.dom
|
||||
let destroys
|
||||
|
||||
// add style
|
||||
dom.appendTo(dom.head, dom.create('style', style))
|
||||
let zoom
|
||||
|
||||
hook.doneEach(_ => {
|
||||
const images = dom.findAll('img:not(.emoji)')
|
||||
|
||||
if (Array.isArray(destroys) && destroys.length) {
|
||||
destroys.forEach(o => o())
|
||||
destroys = []
|
||||
if (zoom) {
|
||||
zoom.detach()
|
||||
}
|
||||
|
||||
destroys = images.map(zoom)
|
||||
zoom = mediumZoom('img:not(.emoji):not([data-no-zoom])')
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -52,6 +52,7 @@ div#app {
|
||||
.search .search-keyword {
|
||||
color: var(--theme-color, $color-primary);
|
||||
font-style: normal;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
html,
|
||||
@@ -74,6 +75,11 @@ img {
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
a[disabled] {
|
||||
cursor: not-allowed;
|
||||
opacity: 0.6;
|
||||
}
|
||||
|
||||
kbd {
|
||||
border: solid 1px #ccc;
|
||||
border-radius: 3px;
|
||||
@@ -85,6 +91,15 @@ kbd {
|
||||
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;
|
||||
@@ -206,6 +221,7 @@ main {
|
||||
display: block;
|
||||
position: relative;
|
||||
size: 100vw 100%;
|
||||
z-index: 0;
|
||||
}
|
||||
|
||||
.anchor {
|
||||
@@ -226,7 +242,7 @@ main {
|
||||
.sidebar {
|
||||
border-right: 1px solid rgba(0, 0, 0, 0.07);
|
||||
overflow-y: auto;
|
||||
padding: 40px 0;
|
||||
padding: 40px 0 0;
|
||||
position: absolute 0 * 0 0;
|
||||
transition: transform 250ms ease-out;
|
||||
width: $sidebar-width;
|
||||
@@ -251,6 +267,7 @@ main {
|
||||
|
||||
.sidebar-nav {
|
||||
line-height: 2em;
|
||||
padding-bottom: 40px;
|
||||
}
|
||||
|
||||
ul {
|
||||
@@ -443,10 +460,7 @@ body.close {
|
||||
@media print {
|
||||
.github-corner,
|
||||
.sidebar-toggle,
|
||||
.sidebar {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.sidebar,
|
||||
.app-nav {
|
||||
display: none;
|
||||
}
|
||||
@@ -493,6 +507,7 @@ body.close {
|
||||
.sidebar-toggle {
|
||||
background-color: transparent;
|
||||
width: auto;
|
||||
padding: 30px 30px 10px 10px;
|
||||
}
|
||||
|
||||
body.close {
|
||||
@@ -504,6 +519,7 @@ body.close {
|
||||
background-color: rgba($color-bg, 0.8);
|
||||
transition: 1s background-color;
|
||||
width: calc($sidebar-width - 16px);
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
.content {
|
||||
|
||||
+3
-4
@@ -47,10 +47,11 @@ body {
|
||||
}
|
||||
|
||||
.app-sub-sidebar {
|
||||
.section-link {
|
||||
li {
|
||||
&::before {
|
||||
content: '-';
|
||||
padding-right: 4px;
|
||||
float: left;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -99,9 +100,7 @@ body {
|
||||
}
|
||||
|
||||
.markdown-section figure,
|
||||
.markdown-section p,
|
||||
.markdown-section ul,
|
||||
.markdown-section ol {
|
||||
.markdown-section p {
|
||||
margin: 1.2em 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user