mirror of
https://github.com/wahyd4/docsify.git
synced 2026-08-09 21:36:10 +10:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
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 |
@@ -1,3 +1,68 @@
|
||||
<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)
|
||||
|
||||
|
||||
@@ -86,6 +86,8 @@ These projects are using docsify to generate their sites. Pull requests welcome
|
||||
| [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 |
|
||||
|
||||
## Similar projects
|
||||
|
||||
|
||||
+3
-1
@@ -48,7 +48,9 @@ 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: 'codesponsor', entry: 'codesponsor.js' },
|
||||
{ name: 'disqus', entry: 'disqus.js' },
|
||||
{ name: 'gitalk', entry: 'gitalk.js' }
|
||||
]
|
||||
|
||||
plugins.forEach(item => {
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||

|
||||
|
||||
# docsify <small>4.4.1</small>
|
||||
# docsify <small>4.5.5</small>
|
||||
|
||||
> A magical documentation site generator.
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -91,12 +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)
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -62,3 +62,23 @@ You will get `<a href="/demo/">link</a>`html. Do not worry, you can still set ti
|
||||
```md
|
||||
[link](/demo ":disabled")
|
||||
```
|
||||
|
||||
## Github Task Lists
|
||||
|
||||
```md
|
||||
|
||||
* [ ] foo
|
||||
* bar
|
||||
* [x] baz
|
||||
* [] bam
|
||||
* [ ] bim
|
||||
* [ ] lim
|
||||
```
|
||||
|
||||
* [ ] foo
|
||||
* bar
|
||||
* [x] baz
|
||||
* [] bam
|
||||
* [ ] bim
|
||||
* [ ] lim
|
||||
|
||||
|
||||
+37
-1
@@ -91,7 +91,7 @@ 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>
|
||||
@@ -147,3 +147,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>
|
||||
```
|
||||
@@ -329,7 +329,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 +345,7 @@ window.$docsify = {
|
||||
|
||||
## external-link-target
|
||||
|
||||
Currently it defaults to _blank, would be nice if configurable:
|
||||
当前默认为 _blank, 配置一下就可以:
|
||||
|
||||
```js
|
||||
window.$docsify = {
|
||||
@@ -356,10 +356,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}` 都不会在页面上呈现。
|
||||
|
||||
|
||||
+12
-4
@@ -85,21 +85,29 @@
|
||||
|
||||
## 图片缩放 - 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)
|
||||
```markdown
|
||||

|
||||
```
|
||||
|
||||
|
||||
|
||||
## 在 Github 上编辑
|
||||
|
||||
在每一页上添加 `Edit on github` 按钮. 由第三方库提供, 查看 [document](https://github.com/njleonzhang/docsify-edit-on-github)
|
||||
|
||||
|
||||
## CodeSponsor
|
||||
|
||||
See https://codesponsor.io
|
||||
参考 https://codesponsor.io
|
||||
|
||||
|
||||
```html
|
||||
|
||||
+46
-19
@@ -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()
|
||||
@@ -2973,6 +2976,15 @@ Compiler.prototype._initRenderer = function _initRenderer () {
|
||||
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;
|
||||
|
||||
return renderer
|
||||
@@ -3851,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) {
|
||||
@@ -3869,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;
|
||||
@@ -3876,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);
|
||||
@@ -3884,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 () {
|
||||
@@ -3910,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);
|
||||
|
||||
@@ -3919,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) {
|
||||
@@ -4036,7 +4063,7 @@ initGlobalAPI();
|
||||
/**
|
||||
* Version
|
||||
*/
|
||||
Docsify.version = '4.4.1';
|
||||
Docsify.version = '4.5.5';
|
||||
|
||||
/**
|
||||
* Run Docsify
|
||||
|
||||
Vendored
+2
-2
File diff suppressed because one or more lines are too long
@@ -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)}();
|
||||
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
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "docsify",
|
||||
"version": "4.4.1",
|
||||
"version": "4.5.5",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "docsify",
|
||||
"version": "4.4.1",
|
||||
"version": "4.5.5",
|
||||
"description": "A magical documentation generator.",
|
||||
"author": {
|
||||
"name": "qingwei-li",
|
||||
|
||||
+1
-1
@@ -37,5 +37,5 @@
|
||||
"integrity": "sha1-6DWIAbhrg7F1YNTjw4LXrvIQCUQ="
|
||||
}
|
||||
},
|
||||
"version": "4.4.1"
|
||||
"version": "4.5.5"
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "docsify-server-renderer",
|
||||
"version": "4.4.1",
|
||||
"version": "4.5.5",
|
||||
"description": "docsify server renderer",
|
||||
"author": {
|
||||
"name": "qingwei-li",
|
||||
|
||||
+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) {
|
||||
|
||||
@@ -175,6 +175,15 @@ export class Compiler {
|
||||
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
|
||||
|
||||
return renderer
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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)
|
||||
@@ -91,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;
|
||||
|
||||
+1
-3
@@ -100,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