mirror of
https://github.com/wahyd4/docsify.git
synced 2026-08-11 06:16:10 +10:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5dcd6d43ea | ||
|
|
00e3609b25 | ||
|
|
a6d9669bfa | ||
|
|
00983ab796 | ||
|
|
8e203b07ab | ||
|
|
eff6d21539 | ||
|
|
dc536a3930 | ||
|
|
cc4ffb4ab7 | ||
|
|
d62da2034f | ||
|
|
dd0c84bb40 | ||
|
|
02022af53c | ||
|
|
44d7257691 | ||
|
|
c6f760275c |
@@ -1,3 +1,34 @@
|
||||
### 2.4.3
|
||||
|
||||
> 2017-02-15
|
||||
|
||||
#### Bug fixes
|
||||
* fix emoji replacing error (#76)
|
||||
|
||||
### 2.4.2
|
||||
|
||||
> 2017-02-14
|
||||
|
||||
#### Bug fixes
|
||||
- fix(index): load file path error
|
||||
|
||||
|
||||
### 2.4.1
|
||||
|
||||
> 2017-02-13
|
||||
|
||||
#### Bug fixes
|
||||
- fix(index): cover page
|
||||
|
||||
### 2.4.0
|
||||
|
||||
> 2017-02-13
|
||||
|
||||
#### Features
|
||||
|
||||
- feat(hook): add `doneEach`
|
||||
|
||||
|
||||
### 2.3.0
|
||||
|
||||
> 2017-02-13
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
|
||||
## Features
|
||||
- Not build static html files
|
||||
- Simple and lightweight (~13kB gzipped)
|
||||
- Simple and lightweight (~14kB gzipped)
|
||||
- Smart full-text search plugin
|
||||
- Multiple themes
|
||||
- Useful plugin API
|
||||
|
||||
+1
-1
@@ -11,7 +11,7 @@ See the [Quick start](/quickstart) for more details.
|
||||
## Features
|
||||
|
||||
- Not build static html files
|
||||
- Simple and lightweight (~13kB gzipped)
|
||||
- Simple and lightweight (~14kB gzipped)
|
||||
- Smart full-text search plugin
|
||||
- Multiple themes
|
||||
- Useful plugin API
|
||||
|
||||
+2
-2
@@ -1,10 +1,10 @@
|
||||

|
||||
|
||||
# docsify <small>2.3.0</small>
|
||||
# docsify <small>2.4.3</small>
|
||||
|
||||
> A magical documentation site generator.
|
||||
|
||||
- Simple and lightweight (~13kB gzipped)
|
||||
- Simple and lightweight (~14kB gzipped)
|
||||
- Not build static html files
|
||||
- Multiple themes
|
||||
|
||||
|
||||
+7
-2
@@ -67,7 +67,7 @@ window.$docsify = {
|
||||
plugins: [
|
||||
function (hook) {
|
||||
hook.init(function() {
|
||||
// Called when the script starts running, only trigger once.
|
||||
// Called when the script starts running, only trigger once, no arguments,
|
||||
})
|
||||
|
||||
hook.beforeEach(function(content) {
|
||||
@@ -84,8 +84,13 @@ window.$docsify = {
|
||||
next(html)
|
||||
})
|
||||
|
||||
hook.doneEach(function() {
|
||||
// Invoked each time after the data is fully loaded, no arguments,
|
||||
// ...
|
||||
})
|
||||
|
||||
hook.ready(function() {
|
||||
// Called after initialization is complete. Only trigger once.
|
||||
// Called after initialization is complete. Only trigger once, no arguments.
|
||||
})
|
||||
}
|
||||
]
|
||||
|
||||
@@ -12,8 +12,8 @@ docsify 是一个动态生成文档网站的工具。不同于 GitBook、Hexo
|
||||
|
||||
## 特性
|
||||
- 无需构建,写完文档直接发布
|
||||
- 容易使用并且轻量 (~13Kb gzipped)
|
||||
- 智能的全文检索
|
||||
- 容易使用并且轻量 (~14kB gzipped)
|
||||
- 智能的全文搜索
|
||||
- 提供多套主题
|
||||
- 丰富的 API
|
||||
- 兼容 IE9+
|
||||
|
||||
@@ -108,7 +108,7 @@ window.$docsify = {
|
||||
- 类型:`Number`
|
||||
- 默认值: `0`
|
||||
|
||||
自定义侧边栏后默认不会再生成目录,你也可以通过设置生成目录的最大层级开启这个功能,
|
||||
自定义侧边栏后默认不会再生成目录,你也可以通过设置生成目录的最大层级开启这个功能。
|
||||
|
||||
|
||||
```js
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
## 内置插件
|
||||
|
||||
### 全文检索 - Search
|
||||
### 全文搜索 - Search
|
||||
|
||||
全文检索插件会根据当前页面上的超链接获取文档内容,在 `localStorage` 内建立文档索引。默认过期时间为一天,当然我们可以自己指定需要缓存的文件列表或者配置过期时间。
|
||||
全文搜索插件会根据当前页面上的超链接获取文档内容,在 `localStorage` 内建立文档索引。默认过期时间为一天,当然我们可以自己指定需要缓存的文件列表或者配置过期时间。
|
||||
|
||||
|
||||
```html
|
||||
@@ -63,7 +63,7 @@ window.$docsify = {
|
||||
plugins: [
|
||||
function (hook) {
|
||||
hook.init(function() {
|
||||
// 初始化时调用,只调用一次
|
||||
// 初始化时调用,只调用一次,没有参数。
|
||||
})
|
||||
|
||||
hook.beforeEach(function(content) {
|
||||
@@ -79,8 +79,13 @@ window.$docsify = {
|
||||
next(html)
|
||||
})
|
||||
|
||||
hook.doneEach(function() {
|
||||
// 每次路由切换时数据全部加载完成后调用,没有参数。
|
||||
// ...
|
||||
})
|
||||
|
||||
hook.ready(function() {
|
||||
// docsify 初始化完成后调用,只调用一次
|
||||
// 初始化完成后调用,只调用一次,没有参数。
|
||||
})
|
||||
}
|
||||
]
|
||||
|
||||
+9
-4
@@ -171,7 +171,7 @@ var merge = Object.assign || function (to) {
|
||||
function emojify (text) {
|
||||
return text
|
||||
.replace(/<(pre|template)[^>]*?>([\s\S]+)<\/(pre|template)>/g, function (match) { return match.replace(/:/g, '__colon__'); })
|
||||
.replace(/:(\w*?):/ig, '<img class="emoji" src="https://assets-cdn.github.com/images/icons/emoji/$1.png" alt="$1" />')
|
||||
.replace(/:(\w+?):/ig, '<img class="emoji" src="https://assets-cdn.github.com/images/icons/emoji/$1.png" alt="$1" />')
|
||||
.replace(/__colon__/g, ':')
|
||||
}
|
||||
|
||||
@@ -2818,6 +2818,7 @@ var Hook = function Hook () {
|
||||
this.afterHooks = [];
|
||||
this.initHooks = [];
|
||||
this.readyHooks = [];
|
||||
this.doneEachHooks = [];
|
||||
};
|
||||
|
||||
Hook.prototype.beforeEach = function beforeEach (fn) {
|
||||
@@ -2828,6 +2829,10 @@ Hook.prototype.afterEach = function afterEach (fn) {
|
||||
this.afterHooks.push(fn);
|
||||
};
|
||||
|
||||
Hook.prototype.doneEach = function doneEach (fn) {
|
||||
this.doneEachHooks.push(fn);
|
||||
};
|
||||
|
||||
Hook.prototype.init = function init (fn) {
|
||||
this.initHooks.push(fn);
|
||||
};
|
||||
@@ -2933,9 +2938,8 @@ var mainRender = function (cb) {
|
||||
}
|
||||
|
||||
// replace route
|
||||
route = '/' + route;
|
||||
if (OPTIONS.alias && OPTIONS.alias[route]) {
|
||||
route = getAlias(route);
|
||||
if (OPTIONS.alias && OPTIONS.alias['/' + route]) {
|
||||
route = getAlias('/' + route);
|
||||
} else {
|
||||
route = (OPTIONS.basePath + route).replace(/\/+/, '/');
|
||||
}
|
||||
@@ -2991,6 +2995,7 @@ var Docsify = function () {
|
||||
mainRender(function (_) {
|
||||
scrollIntoView();
|
||||
activeLink('nav');
|
||||
window.Docsify.hook.emit('doneEach');
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
Vendored
+2
-2
File diff suppressed because one or more lines are too long
@@ -290,7 +290,7 @@ var install = function () {
|
||||
new SearchComponent();
|
||||
!isAuto && searchPlugin();
|
||||
});
|
||||
isAuto && hook.beforeEach(searchPlugin);
|
||||
isAuto && hook.doneEach(searchPlugin);
|
||||
}, window.$docsify.plugins);
|
||||
};
|
||||
|
||||
|
||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "docsify",
|
||||
"version": "2.3.0",
|
||||
"version": "2.4.3",
|
||||
"description": "A magical documentation generator.",
|
||||
"main": "lib/docsify.js",
|
||||
"files": [
|
||||
|
||||
@@ -4,6 +4,7 @@ export default class Hook {
|
||||
this.afterHooks = []
|
||||
this.initHooks = []
|
||||
this.readyHooks = []
|
||||
this.doneEachHooks = []
|
||||
}
|
||||
|
||||
beforeEach (fn) {
|
||||
@@ -14,6 +15,10 @@ export default class Hook {
|
||||
this.afterHooks.push(fn)
|
||||
}
|
||||
|
||||
doneEach (fn) {
|
||||
this.doneEachHooks.push(fn)
|
||||
}
|
||||
|
||||
init (fn) {
|
||||
this.initHooks.push(fn)
|
||||
}
|
||||
|
||||
+3
-3
@@ -72,9 +72,8 @@ const mainRender = function (cb) {
|
||||
}
|
||||
|
||||
// replace route
|
||||
route = '/' + route
|
||||
if (OPTIONS.alias && OPTIONS.alias[route]) {
|
||||
route = getAlias(route)
|
||||
if (OPTIONS.alias && OPTIONS.alias['/' + route]) {
|
||||
route = getAlias('/' + route)
|
||||
} else {
|
||||
route = (OPTIONS.basePath + route).replace(/\/+/, '/')
|
||||
}
|
||||
@@ -130,6 +129,7 @@ const Docsify = function () {
|
||||
mainRender(_ => {
|
||||
scrollIntoView()
|
||||
activeLink('nav')
|
||||
window.Docsify.hook.emit('doneEach')
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -342,7 +342,7 @@ const install = function () {
|
||||
new SearchComponent()
|
||||
!isAuto && searchPlugin()
|
||||
})
|
||||
isAuto && hook.beforeEach(searchPlugin)
|
||||
isAuto && hook.doneEach(searchPlugin)
|
||||
}, window.$docsify.plugins)
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -161,6 +161,6 @@ export const merge = Object.assign || function (to) {
|
||||
export function emojify (text) {
|
||||
return text
|
||||
.replace(/<(pre|template)[^>]*?>([\s\S]+)<\/(pre|template)>/g, match => match.replace(/:/g, '__colon__'))
|
||||
.replace(/:(\w*?):/ig, '<img class="emoji" src="https://assets-cdn.github.com/images/icons/emoji/$1.png" alt="$1" />')
|
||||
.replace(/:(\w+?):/ig, '<img class="emoji" src="https://assets-cdn.github.com/images/icons/emoji/$1.png" alt="$1" />')
|
||||
.replace(/__colon__/g, ':')
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user