feat: add docsify-updated, close #158

This commit is contained in:
qingwei.li 2017-05-16 23:03:22 +08:00
commit d2be5aecf8
No known key found for this signature in database
GPG key ID: B6DDC2F7AE80B2F4
11 changed files with 95 additions and 13 deletions

View file

@ -315,3 +315,18 @@ window.$docsify = {
mergeNavbar: true
}
```
## format-updated
We can display the file update date through **{docsify-updated<span>}</span>** variable. And format it by `formatUpdated`.
See https://github.com/lukeed/tinydate#patterns
```js
window.$docsify = {
formatUpdated: '{MM}/{DD} {HH}:{mm}',
formatUpdated: function (time) {
// ...
return time
}
}
```

View file

@ -314,4 +314,19 @@ Navbar will be merged with the sidebar on smaller screens.
window.$docsify = {
mergeNavbar: true
}
```
```
## format-updated
We can display the file update date through **{docsify-updated<span>}</span>** variable. And format it by `formatUpdated`.
See https://github.com/lukeed/tinydate#patterns
```js
window.$docsify = {
formatUpdated: '{MM}/{DD} {HH}:{mm}',
formatUpdated: function (time) {
// ...
return time
}
}
```

View file

@ -34,6 +34,7 @@
loadNavbar: true,
mergeNavbar: true,
maxLevel: 4,
subMaxLevel: 2,
name: 'docsify',
search: {
noData: {
@ -48,7 +49,14 @@
'/': 'Search'
}
},
subMaxLevel: 2
formatUpdated: '{MM}/{DD} {HH}:{mm}',
plugins: [
function(hook) {
hook.beforeEach(function (html) {
return html += '> Last modified {docsify-updated}'
})
}
]
}
</script>
<script src="//unpkg.com/docsify/lib/docsify.min.js"></script>

View file

@ -326,3 +326,17 @@ window.$docsify = {
}
```
## format-updated
我们可以显示文档更新日期通过 **{docsify-updated<span>}</span>** 变量. 并且格式化日期通过 `formatUpdated`.
参考 https://github.com/lukeed/tinydate#patterns
```js
window.$docsify = {
formatUpdated: '{MM}/{DD} {HH}:{mm}',
formatUpdated: function (time) {
// ...
return time
}
}
```