mirror of
https://github.com/wahyd4/docsify.git
synced 2026-08-10 05:48:18 +10:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d91a66cadd | ||
|
|
58b130996e | ||
|
|
ee800a6572 | ||
|
|
6daecc8a68 | ||
|
|
325ecd08e6 | ||
|
|
9a09458eee | ||
|
|
fdd8826b3b | ||
|
|
fcd1087c16 | ||
|
|
ab19b13210 | ||
|
|
5fcf210dd1 | ||
|
|
2edf47ec73 | ||
|
|
b52607dec9 | ||
|
|
e89a2b3fea | ||
|
|
239eb3503b | ||
|
|
fce40eae25 | ||
|
|
d35059dd0b | ||
|
|
4f588e0af4 | ||
|
|
22ab7dfd14 | ||
|
|
4805cb5322 | ||
|
|
2bc880d335 | ||
|
|
b3b6116464 | ||
|
|
137ae8d5b8 | ||
|
|
4a23c4acf2 | ||
|
|
a39b214733 | ||
|
|
1ce37bdc2e | ||
|
|
2cd4646386 | ||
|
|
42ea8af245 | ||
|
|
bf060befb7 | ||
|
|
b329e1eb1d | ||
|
|
63876c601d | ||
|
|
0a0802aded | ||
|
|
94bc415534 | ||
|
|
9e860177cb | ||
|
|
47a8d5faa4 | ||
|
|
18f0f03a89 | ||
|
|
f6f4e32485 | ||
|
|
50c2434ab5 | ||
|
|
1897bb6af0 | ||
|
|
b0179e4c64 |
@@ -1,3 +1,67 @@
|
||||
<a name="4.8.3"></a>
|
||||
## [4.8.3](https://github.com/docsifyjs/docsify/compare/v4.8.2...v4.8.3) (2018-11-01)
|
||||
|
||||
|
||||
|
||||
<a name="4.8.2"></a>
|
||||
## [4.8.2](https://github.com/docsifyjs/docsify/compare/v4.8.1...v4.8.2) (2018-11-01)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* cover button style, fixed [#670](https://github.com/docsifyjs/docsify/issues/670), fixed [#665](https://github.com/docsifyjs/docsify/issues/665) ([#675](https://github.com/docsifyjs/docsify/issues/675)) ([fcd1087](https://github.com/docsifyjs/docsify/commit/fcd1087))
|
||||
* update match regex ([#669](https://github.com/docsifyjs/docsify/issues/669)) ([2edf47e](https://github.com/docsifyjs/docsify/commit/2edf47e))
|
||||
* use copy of cached value ([#668](https://github.com/docsifyjs/docsify/issues/668)) ([5fcf210](https://github.com/docsifyjs/docsify/commit/5fcf210))
|
||||
* **compiler:** import prism-markup-templating, fixed [#672](https://github.com/docsifyjs/docsify/issues/672) ([#676](https://github.com/docsifyjs/docsify/issues/676)) ([fdd8826](https://github.com/docsifyjs/docsify/commit/fdd8826))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* add heading config id ([#671](https://github.com/docsifyjs/docsify/issues/671)) ([ab19b13](https://github.com/docsifyjs/docsify/commit/ab19b13))
|
||||
|
||||
|
||||
|
||||
<a name="4.8.1"></a>
|
||||
## [4.8.1](https://github.com/docsifyjs/docsify/compare/v4.8.0...v4.8.1) (2018-10-31)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* ssr package dep, fixed [#605](https://github.com/docsifyjs/docsify/issues/605) ([2bc880d](https://github.com/docsifyjs/docsify/commit/2bc880d))
|
||||
* **compiler:** extra quotes for codeblock ([4f588e0](https://github.com/docsifyjs/docsify/commit/4f588e0))
|
||||
* **compiler:** prevent render of html code in paragraph, fixed [#663](https://github.com/docsifyjs/docsify/issues/663) ([d35059d](https://github.com/docsifyjs/docsify/commit/d35059d))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* upgrade PrismJS, fixed [#534](https://github.com/docsifyjs/docsify/issues/534) ([4805cb5](https://github.com/docsifyjs/docsify/commit/4805cb5))
|
||||
|
||||
|
||||
|
||||
<a name="4.8.0"></a>
|
||||
# [4.8.0](https://github.com/docsifyjs/docsify/compare/v4.7.1...v4.8.0) (2018-10-31)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* Cache TOC for later usage in the case of cached file html ([#649](https://github.com/docsifyjs/docsify/issues/649)) ([9e86017](https://github.com/docsifyjs/docsify/commit/9e86017))
|
||||
* improve external script plugin ([#632](https://github.com/docsifyjs/docsify/issues/632)) ([50c2434](https://github.com/docsifyjs/docsify/commit/50c2434))
|
||||
* missing variable declaration ([#660](https://github.com/docsifyjs/docsify/issues/660)) ([1ce37bd](https://github.com/docsifyjs/docsify/commit/1ce37bd))
|
||||
* Remove target for mailto links ([#652](https://github.com/docsifyjs/docsify/issues/652)) ([18f0f03](https://github.com/docsifyjs/docsify/commit/18f0f03))
|
||||
* Update getAllPath query selector ([#653](https://github.com/docsifyjs/docsify/issues/653)) ([f6f4e32](https://github.com/docsifyjs/docsify/commit/f6f4e32))
|
||||
* Update vue.styl ([#634](https://github.com/docsifyjs/docsify/issues/634)) ([bf060be](https://github.com/docsifyjs/docsify/commit/bf060be))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* Add docsify version to $window.docsify object ([#641](https://github.com/docsifyjs/docsify/issues/641)) ([94bc415](https://github.com/docsifyjs/docsify/commit/94bc415)), closes [#521](https://github.com/docsifyjs/docsify/issues/521)
|
||||
* **compiler:** support embedded mermaid ([#629](https://github.com/docsifyjs/docsify/issues/629)) ([42ea8af](https://github.com/docsifyjs/docsify/commit/42ea8af))
|
||||
* Add hideOtherSidebarContent option ([#661](https://github.com/docsifyjs/docsify/issues/661)) ([4a23c4a](https://github.com/docsifyjs/docsify/commit/4a23c4a))
|
||||
* Allow base64, external, and relative logo values ([#642](https://github.com/docsifyjs/docsify/issues/642)) ([0a0802a](https://github.com/docsifyjs/docsify/commit/0a0802a)), closes [#577](https://github.com/docsifyjs/docsify/issues/577)
|
||||
* upgrade marked to 0.5.x, fixed [#645](https://github.com/docsifyjs/docsify/issues/645), close [#644](https://github.com/docsifyjs/docsify/issues/644) ([#662](https://github.com/docsifyjs/docsify/issues/662)) ([a39b214](https://github.com/docsifyjs/docsify/commit/a39b214))
|
||||
|
||||
|
||||
|
||||
<a name="4.7.1"></a>
|
||||
## [4.7.1](https://github.com/docsifyjs/docsify/compare/v4.7.0...v4.7.1) (2018-08-30)
|
||||
|
||||
|
||||
@@ -17,10 +17,10 @@
|
||||
<a href="https://gitter.im/docsifyjs/Lobby?utm_source=share-link&utm_medium=link&utm_campaign=share-link"><img alt="gitter" src="https://img.shields.io/gitter/room/docsifyjs/docsify.svg?style=flat-square"></a>
|
||||
</p>
|
||||
|
||||
<p align="center">Glod Sponsor via <a href="https://opencollective.com/docsify">Open Collective</a></p>
|
||||
<p align="center">Gold Sponsor via <a href="https://opencollective.com/docsify">Open Collective</a></p>
|
||||
|
||||
<p align="center">
|
||||
<a href="https://opencollective.com/docsify/tiers/gold-sponsor/website">
|
||||
<a href="https://opencollective.com/docsify/order/3254">
|
||||
<img src="https://opencollective.com/docsify/tiers/gold-sponsor.svg?avatarHeight=36">
|
||||
</a>
|
||||
</p>
|
||||
@@ -36,7 +36,7 @@
|
||||
## Features
|
||||
|
||||
- No statically built html files
|
||||
- Simple and lightweight (~19kB gzipped)
|
||||
- Simple and lightweight (~21kB gzipped)
|
||||
- Smart full-text search plugin
|
||||
- Multiple themes
|
||||
- Useful plugin API
|
||||
@@ -46,7 +46,9 @@
|
||||
|
||||
## Quick start
|
||||
|
||||
Look at [this tutorial](https://docsify.js.org/#/quickstart) or [online demo](https://jsfiddle.net/7ztb8qsr/1/).
|
||||
Look at [this tutorial](https://docsify.js.org/#/quickstart)
|
||||
|
||||
[](https://codesandbox.io/s/307qqv236)
|
||||
|
||||
## Showcase
|
||||
|
||||
@@ -103,6 +105,6 @@ This project exists thanks to all the people who contribute. [[Contribute](CONTR
|
||||
|
||||
## License
|
||||
|
||||
MIT
|
||||
[MIT](LICENSE)
|
||||
|
||||
[](https://app.fossa.io/projects/git%2Bhttps%3A%2F%2Fgithub.com%2Fdocsifyjs%2Fdocsify?ref=badge_large)
|
||||
|
||||
+5
-5
@@ -9,7 +9,7 @@ const version = process.env.VERSION || require('../package.json').version
|
||||
const chokidar = require('chokidar')
|
||||
const path = require('path')
|
||||
|
||||
const build = function(opts) {
|
||||
const build = function (opts) {
|
||||
rollup
|
||||
.rollup({
|
||||
input: opts.input,
|
||||
@@ -23,7 +23,7 @@ const build = function(opts) {
|
||||
})
|
||||
])
|
||||
})
|
||||
.then(function(bundle) {
|
||||
.then(function (bundle) {
|
||||
var dest = 'lib/' + (opts.output || opts.input)
|
||||
|
||||
console.log(dest)
|
||||
@@ -33,11 +33,11 @@ const build = function(opts) {
|
||||
strict: false
|
||||
})
|
||||
})
|
||||
.catch(function(err) {
|
||||
.catch(function (err) {
|
||||
console.error(err)
|
||||
})
|
||||
}
|
||||
const buildCore = function() {
|
||||
const buildCore = function () {
|
||||
build({
|
||||
input: 'src/core/index.js',
|
||||
output: 'docsify.js'
|
||||
@@ -51,7 +51,7 @@ const buildCore = function() {
|
||||
})
|
||||
}
|
||||
}
|
||||
const buildAllPlugin = function() {
|
||||
const buildAllPlugin = function () {
|
||||
var plugins = [
|
||||
{name: 'search', input: 'search/index.js'},
|
||||
{name: 'ga', input: 'ga.js'},
|
||||
|
||||
+7
-7
@@ -2,26 +2,26 @@
|
||||
|
||||
> A magical documentation site generator.
|
||||
|
||||
## What is it
|
||||
## What it is
|
||||
|
||||
docsify generates your documentation website on the fly. Unlike GitBook, it does not generate static html files. Instead, it smartly loads and parses your Markdown files and displays them as website. All you need to do is create an `index.html` to start and [deploy it on GitHub Pages](deploy.md).
|
||||
docsify generates your documentation website on the fly. Unlike GitBook, it does not generate static html files. Instead, it smartly loads and parses your Markdown files and displays them as a website. To start using it, all you need to do is create an `index.html` and [deploy it on GitHub Pages](deploy.md).
|
||||
|
||||
See the [Quick start](quickstart.md) for more details.
|
||||
See the [Quick start](quickstart.md) guide for more details.
|
||||
|
||||
## Features
|
||||
|
||||
- No statically built html files
|
||||
- Simple and lightweight (~19kB gzipped)
|
||||
- Simple and lightweight (~21kB gzipped)
|
||||
- Smart full-text search plugin
|
||||
- Multiple themes
|
||||
- Useful plugin API
|
||||
- Emoji support
|
||||
- Compatible with IE10+
|
||||
- Support SSR ([example](https://github.com/docsifyjs/docsify-ssr-demo))
|
||||
- Support server-side rendering ([example](https://github.com/docsifyjs/docsify-ssr-demo))
|
||||
|
||||
## Examples
|
||||
|
||||
Check out the [Showcase](https://github.com/docsifyjs/docsify/#showcase) to docsify in use.
|
||||
Check out the [Showcase](https://github.com/docsifyjs/docsify/#showcase) to see docsify in use.
|
||||
|
||||
## Donate
|
||||
|
||||
@@ -29,4 +29,4 @@ Please consider donating if you think docsify is helpful to you or that my work
|
||||
|
||||
## Community
|
||||
|
||||
Users and development team are in the [Gitter](https://gitter.im/docsifyjs/Lobby).
|
||||
Users and the development team are usually in the [Gitter chat room](https://gitter.im/docsifyjs/Lobby).
|
||||
|
||||
+4
-4
@@ -1,12 +1,12 @@
|
||||

|
||||
|
||||
# docsify <small>4.7.1</small>
|
||||
# docsify <small>4.8.3</small>
|
||||
|
||||
> A magical documentation site generator.
|
||||
|
||||
* Simple and lightweight (~19kB gzipped)
|
||||
* No statically built html files
|
||||
* Multiple themes
|
||||
- Simple and lightweight (~21kB gzipped)
|
||||
- No statically built html files
|
||||
- Multiple themes
|
||||
|
||||
[GitHub](https://github.com/docsifyjs/docsify/)
|
||||
[Getting Started](#docsify)
|
||||
|
||||
+22
-22
@@ -1,28 +1,28 @@
|
||||
* Getting started
|
||||
- Getting started
|
||||
|
||||
* [Quick start](quickstart.md)
|
||||
* [Writing more pages](more-pages.md)
|
||||
* [Custom navbar](custom-navbar.md)
|
||||
* [Cover page](cover.md)
|
||||
- [Quick start](quickstart.md)
|
||||
- [Writing more pages](more-pages.md)
|
||||
- [Custom navbar](custom-navbar.md)
|
||||
- [Cover page](cover.md)
|
||||
|
||||
* Customization
|
||||
- Customization
|
||||
|
||||
* [Configuration](configuration.md)
|
||||
* [Themes](themes.md)
|
||||
* [List of Plugins](plugins.md)
|
||||
* [Write a Plugin](write-a-plugin.md)
|
||||
* [Markdown configuration](markdown.md)
|
||||
* [Language highlighting](language-highlight.md)
|
||||
- [Configuration](configuration.md)
|
||||
- [Themes](themes.md)
|
||||
- [List of Plugins](plugins.md)
|
||||
- [Write a Plugin](write-a-plugin.md)
|
||||
- [Markdown configuration](markdown.md)
|
||||
- [Language highlighting](language-highlight.md)
|
||||
|
||||
* Guide
|
||||
- Guide
|
||||
|
||||
* [Deploy](deploy.md)
|
||||
* [Helpers](helpers.md)
|
||||
* [Vue compatibility](vue.md)
|
||||
* [CDN](cdn.md)
|
||||
* [Offline Mode(PWA)](pwa.md)
|
||||
* [Server-Side Rendering(SSR)](ssr.md)
|
||||
* [Embed Files <sup style="color:red">(new)<sup>](embed-files.md)
|
||||
- [Deploy](deploy.md)
|
||||
- [Helpers](helpers.md)
|
||||
- [Vue compatibility](vue.md)
|
||||
- [CDN](cdn.md)
|
||||
- [Offline Mode(PWA)](pwa.md)
|
||||
- [Server-Side Rendering(SSR)](ssr.md)
|
||||
- [Embed Files](embed-files.md)
|
||||
|
||||
* [Awesome docsify](awesome.md)
|
||||
* [Changelog](changelog.md)
|
||||
- [Awesome docsify](awesome.md)
|
||||
- [Changelog](changelog.md)
|
||||
|
||||
+3
-3
@@ -26,9 +26,9 @@ Set `coverpage` to **true**, and create a `_coverpage.md`:
|
||||
|
||||
> A magical documentation site generator.
|
||||
|
||||
* Simple and lightweight (~19kB gzipped)
|
||||
* No statically built html files
|
||||
* Multiple themes
|
||||
- Simple and lightweight (~21kB gzipped)
|
||||
- No statically built html files
|
||||
- Multiple themes
|
||||
|
||||
[GitHub](https://github.com/docsifyjs/docsify/)
|
||||
[Get Started](#docsify)
|
||||
|
||||
@@ -94,3 +94,9 @@ You will get `<a href="/demo/">link</a>`html. Do not worry, you can still set ti
|
||||

|
||||

|
||||

|
||||
|
||||
## Customise ID for headings
|
||||
|
||||
```md
|
||||
### 你好,世界! :id=hello-world
|
||||
```
|
||||
@@ -51,6 +51,10 @@ Create the `_sidebar.md`:
|
||||
|
||||
You need to create a `.nojekyll` in `./docs` to prevent GitHub Pages from ignoring files that begin with an underscore.
|
||||
|
||||
## Nested Sidebars
|
||||
|
||||
You may want the sidebar to update with only navigation to reflect the current directory. This can be done by adding a `_sidebar.md` file to each folder.
|
||||
|
||||
`_sidebar.md` is loaded from each level directory. If the current directory doesn't have `_sidebar.md`, it will fall back to the parent directory. If, for example, the current path is `/guide/quick-start`, the `_sidebar.md` will be loaded from `/guide/_sidebar.md`.
|
||||
|
||||
You can specify `alias` to avoid unnecessary fallback.
|
||||
@@ -66,6 +70,8 @@ You can specify `alias` to avoid unnecessary fallback.
|
||||
</script>
|
||||
```
|
||||
|
||||
!> You can create a `README.md` file in a subdirectory to use it as the landing page for the route.
|
||||
|
||||
## Table of Contents
|
||||
|
||||
Once you've created `_sidebar.md`, the sidebar content is automatically generated based on the headers in the markdown files.
|
||||
|
||||
+16
-2
@@ -37,7 +37,9 @@ By default, the hyperlink on the current page is recognized and the content is s
|
||||
},
|
||||
|
||||
// Headline depth, 1 - 6
|
||||
depth: 2
|
||||
depth: 2,
|
||||
|
||||
hideOtherSidebarContent: false, // whether or not to hide other sidebar content
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -93,7 +95,7 @@ Medium's image zoom. Based on [medium-zoom](https://github.com/francoischalifour
|
||||
Exclude the special image
|
||||
|
||||
```markdown
|
||||

|
||||

|
||||
```
|
||||
|
||||
## Edit on github
|
||||
@@ -177,3 +179,15 @@ window.$docsify = {
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
## Tabs
|
||||
|
||||
A docsify.js plugin for displaying tabbed content from markdown.
|
||||
|
||||
- [Documentation & Demos](https://jhildenbiddle.github.io/docsify-tabs)
|
||||
|
||||
Provided by [@jhildenbiddle](https://github.com/jhildenbiddle/docsify-tabs).
|
||||
|
||||
## More plugins
|
||||
|
||||
See [awesome-docsify](awesome?id=plugins)
|
||||
|
||||
+1
-1
@@ -42,7 +42,7 @@ You can manually initialize a Vue instance.
|
||||
```markdown
|
||||
# Vue demo
|
||||
|
||||
<div>hello {{ msg }}</div>
|
||||
<div id="main">hello {{ msg }}</div>
|
||||
|
||||
<script>
|
||||
new Vue({
|
||||
|
||||
+835
-375
File diff suppressed because it is too large
Load Diff
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+1
-1
@@ -1 +1 @@
|
||||
!function(){var i=location.href.replace("/-/","/#/");i!==location.href&&(location.href=i);$docsify.plugins=[].concat(function(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",Number(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}})})},$docsify.plugins)}();
|
||||
!function(){var i=location.href.replace("/-/","/#/");i!==location.href&&(location.href=i),$docsify.plugins=[].concat(function(i,o){var n=Docsify.dom,e=o.config.disqus;if(!e)throw Error("$docsify.disqus is required");i.init(function(i){var t=n.create("script");t.async=!0,t.src="https://"+e+".disqus.com/embed.js",t.setAttribute("data-timestamp",Number(new Date)),n.appendTo(n.body,t)}),i.mounted(function(i){var t=n.create("div");t.id="disqus_thread";var e=n.getNode("#main");t.style="width: "+e.clientWidth+"px; margin: 0 auto 20px;",n.appendTo(n.find(".content"),t),window.disqus_config=function(){this.page.url=location.origin+"/-"+o.route.path,this.page.identifier=o.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+"/-"+o.route.path,this.page.identifier=o.route.path,this.page.title=document.title}})})},$docsify.plugins)}();
|
||||
|
||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+1
-1
@@ -1 +1 @@
|
||||
!function(){function o(){for(var o=Docsify.dom.getNode("#main"),e=Docsify.dom.findAll(o,"script"),n=e.length;n--;){var i=e[n];if(i&&i.src){var t=document.createElement("script");Array.prototype.slice.call(i.attributes).forEach(function(o){t[o.name]=o.value}),i.parentNode.insertBefore(t,i),i.parentNode.removeChild(i)}}}window.$docsify.plugins=[].concat(function(e){e.doneEach(o)},window.$docsify.plugins)}();
|
||||
!function(){function e(){for(var o=Docsify.dom.getNode("#main"),e=Docsify.dom.findAll(o,"script"),n=e.length;n--;){var i=e[n];if(i&&i.src){var t=document.createElement("script");Array.prototype.slice.call(i.attributes).forEach(function(o){t[o.name]=o.value}),i.parentNode.insertBefore(t,i),i.parentNode.removeChild(i)}}}window.$docsify.plugins=[].concat(function(o){o.doneEach(e)},window.$docsify.plugins)}();
|
||||
|
||||
Vendored
+1
-1
@@ -1 +1 @@
|
||||
!function(){var e=[],n=[],t=0,r={regLevel:new RegExp("^([\\s\\-]+)"),invalidLine:new RegExp("^\\-\\-\\-|^\\.\\.\\.|^\\s*#.*|^\\s*$"),dashesString:new RegExp('^\\s*\\"([^\\"]*)\\"\\s*$'),quotesString:new RegExp("^\\s*\\'([^\\']*)\\'\\s*$"),float:new RegExp("^[+-]?[0-9]+\\.[0-9]+(e[+-]?[0-9]+(\\.[0-9]+)?)?$"),integer:new RegExp("^[+-]?[0-9]+$"),array:new RegExp("\\[\\s*(.*)\\s*\\]"),map:new RegExp("\\{\\s*(.*)\\s*\\}"),key_value:new RegExp("([a-z0-9_-][ a-z0-9_-]*):( .+)","i"),single_key_value:new RegExp("^([a-z0-9_-][ a-z0-9_-]*):( .+?)$","i"),key:new RegExp("([a-z0-9_-][ a-z0-9_-]+):( .+)?","i"),item:new RegExp("^-\\s+"),trim:new RegExp("^\\s+|\\s+$"),comment:new RegExp("([^\\'\\\"#]+([\\'\\\"][^\\'\\\"]*[\\'\\\"])*)*(#.*)?")};function i(e){return{parent:null,length:0,level:e,lines:[],children:[],addChild:function(e){this.children.push(e),e.parent=this,++this.length}}}function l(e){var n=null;if("true"==(e=e.replace(r.trim,"")))return!0;if("false"==e)return!1;if(".NaN"==e)return Number.NaN;if("null"==e)return null;if(".inf"==e)return Number.POSITIVE_INFINITY;if("-.inf"==e)return Number.NEGATIVE_INFINITY;if(n=e.match(r.dashesString))return n[1];if(n=e.match(r.quotesString))return n[1];if(n=e.match(r.float))return parseFloat(n[0]);if(n=e.match(r.integer))return parseInt(n[0]);if(isNaN(n=Date.parse(e))){if(n=e.match(r.single_key_value)){return(u={})[n[1]]=l(n[2]),u}if(n=e.match(r.array)){for(var t=0,i=" ",u=[],a="",s=!1,f=0,h=n[1].length;f<h;++f){if("'"==(i=n[1][f])||'"'==i){if(!1===s){s=i,a+=i;continue}if("'"==i&&"'"==s||'"'==i&&'"'==s){s=!1,a+=i;continue}}else if(!1!==s||"["!=i&&"{"!=i)if(!1!==s||"]"!=i&&"}"!=i){if(!1===s&&0==t&&","==i){u.push(l(a)),a="";continue}}else--t;else++t;a+=i}return a.length>0&&u.push(l(a)),u}if(n=e.match(r.map)){for(t=0,i=" ",u=[],a="",s=!1,f=0,h=n[1].length;f<h;++f){if("'"==(i=n[1][f])||'"'==i){if(!1===s){s=i,a+=i;continue}if("'"==i&&"'"==s||'"'==i&&'"'==s){s=!1,a+=i;continue}}else if(!1!==s||"["!=i&&"{"!=i)if(!1!==s||"]"!=i&&"}"!=i){if(!1===s&&0==t&&","==i){u.push(a),a="";continue}}else--t;else++t;a+=i}a.length>0&&u.push(a);var o={};for(f=0,h=u.length;f<h;++f)(n=u[f].match(r.key_value))&&(o[n[1]]=l(n[2]));return o}return e}return new Date(n)}function u(e){for(var n=e.lines,t=e.children,r=[n.join(" ")],i=0,l=t.length;i<l;++i)r.push(u(t[i]));return r.join("\n")}function a(e){for(var n=e.lines,t=e.children,r=n.join("\n"),i=0,l=t.length;i<l;++i)r+=a(t[i]);return r}function s(t){return function t(i){for(var s=null,f={},h=null,o=null,c=null,p=-1,g=[],v=!0,d=0,m=i.length;d<m;++d)if(-1==p||p==i[d].level){g.push(d),p=i[d].level,h=i[d].lines,o=i[d].children,c=null;for(var w=0,E=h.length;w<E;++w){var x=h[w];if(s=x.match(r.key)){var b=s[1];if("-"==b[0]&&(b=b.replace(r.item,""),v&&(v=!1,void 0===f.length&&(f=[])),null!=c&&f.push(c),c={},v=!0),void 0!==s[2]){var y=s[2].replace(r.trim,"");if("&"==y[0]){var R=t(o);null!=c?c[b]=R:f[b]=R,n[y.substr(1)]=R}else if("|"==y[0])null!=c?c[b]=a(o.shift()):f[b]=a(o.shift());else if("*"==y[0]){var N=y.substr(1),_={};if(void 0===n[N])e.push("Reference '"+N+"' not found!");else{for(var $ in n[N])_[$]=n[N][$];null!=c?c[b]=_:f[b]=_}}else">"==y[0]?null!=c?c[b]=u(o.shift()):f[b]=u(o.shift()):null!=c?c[b]=l(y):f[b]=l(y)}else null!=c?c[b]=t(o):f[b]=t(o)}else{if(x.match(/^-\s*$/)){v&&(v=!1,void 0===f.length&&(f=[])),null!=c&&f.push(c),c={},v=!0;continue}if(s=x.match(/^-\s*(.*)/)){null!=c?c.push(l(s[1])):(v&&(v=!1,void 0===f.length&&(f=[])),f.push(l(s[1])));continue}}}null!=c&&(v&&(v=!1,void 0===f.length&&(f=[])),f.push(c))}for(d=g.length-1;d>=0;--d)i.splice.call(i,g[d],1);return f}(t.children)}function f(l){e=[],n=[],t=(new Date).getTime();var u=s(function(n){var t,l=r.regLevel,u=r.invalidLine,a=n.split("\n"),s=0,f=0,h=[],o=new i(-1),c=new i(0);o.addChild(c);var p=[],g="";h.push(c),p.push(s);for(var v=0,d=a.length;v<d;++v)if(!(g=a[v]).match(u)){if((s=(t=l.exec(g))?t[1].length:0)>f){var m=c;c=new i(s),m.addChild(c),h.push(c),p.push(s)}else if(s<f){for(var w=!1,E=p.length-1;E>=0;--E)if(p[E]==s){c=new i(s),h.push(c),p.push(s),null!=h[E].parent&&h[E].parent.addChild(c),w=!0;break}if(!w)return void e.push("Error: Invalid indentation at line "+v+": "+g)}c.lines.push(g.replace(r.trim,"")),f=s}return o}(function(e){var n,t=e.split("\n"),i=r.comment;for(var l in t)(n=t[l].match(i))&&void 0!==n[3]&&(t[l]=n[0].substr(0,n[0].length-n[3].length));return t.join("\n")}(l)));return t=(new Date).getTime()-t,u}var h=new RegExp("^(\\ufeff?(= yaml =|---)$([\\s\\S]*?)(?:\\2|\\.\\.\\.)$(?:\\n)?)","m");function o(e){var n=(e=e||"").split(/(\r?\n)/);return n[0]&&/= yaml =|---/.test(n[0])?function(e){var n=h.exec(e);if(!n)return{attributes:{},body:e};var t=n[n.length-1].replace(/^\s+|\s+$/g,""),r=f(t)||{},i=e.replace(n[0],"");return{attributes:r,body:i,frontmatter:t}}(e):{attributes:{},body:e}}$docsify.plugins=[].concat(function(e,n){e.beforeEach(function(e){var t=o(e),r=t.attributes,i=t.body;return n.frontmatter=r,i})},$docsify.plugins)}();
|
||||
!function(){var b=[],y=[],t=0,R={regLevel:new RegExp("^([\\s\\-]+)"),invalidLine:new RegExp("^\\-\\-\\-|^\\.\\.\\.|^\\s*#.*|^\\s*$"),dashesString:new RegExp('^\\s*\\"([^\\"]*)\\"\\s*$'),quotesString:new RegExp("^\\s*\\'([^\\']*)\\'\\s*$"),float:new RegExp("^[+-]?[0-9]+\\.[0-9]+(e[+-]?[0-9]+(\\.[0-9]+)?)?$"),integer:new RegExp("^[+-]?[0-9]+$"),array:new RegExp("\\[\\s*(.*)\\s*\\]"),map:new RegExp("\\{\\s*(.*)\\s*\\}"),key_value:new RegExp("([a-z0-9_-][ a-z0-9_-]*):( .+)","i"),single_key_value:new RegExp("^([a-z0-9_-][ a-z0-9_-]*):( .+?)$","i"),key:new RegExp("([a-z0-9_-][ a-z0-9_-]+):( .+)?","i"),item:new RegExp("^-\\s+"),trim:new RegExp("^\\s+|\\s+$"),comment:new RegExp("([^\\'\\\"#]+([\\'\\\"][^\\'\\\"]*[\\'\\\"])*)*(#.*)?")};function m(e){return{parent:null,length:0,level:e,lines:[],children:[],addChild:function(e){this.children.push(e),++(e.parent=this).length}}}function N(e){var n=null;if("true"==(e=e.replace(R.trim,"")))return!0;if("false"==e)return!1;if(".NaN"==e)return Number.NaN;if("null"==e)return null;if(".inf"==e)return Number.POSITIVE_INFINITY;if("-.inf"==e)return Number.NEGATIVE_INFINITY;if(n=e.match(R.dashesString))return n[1];if(n=e.match(R.quotesString))return n[1];if(n=e.match(R.float))return parseFloat(n[0]);if(n=e.match(R.integer))return parseInt(n[0]);if(isNaN(n=Date.parse(e))){if(n=e.match(R.single_key_value))return(i={})[n[1]]=N(n[2]),i;if(n=e.match(R.array)){for(var t=0,r=" ",i=[],l="",u=!1,a=0,s=n[1].length;a<s;++a){if("'"==(r=n[1][a])||'"'==r){if(!1===u){l+=u=r;continue}if("'"==r&&"'"==u||'"'==r&&'"'==u){u=!1,l+=r;continue}}else if(!1!==u||"["!=r&&"{"!=r)if(!1!==u||"]"!=r&&"}"!=r){if(!1===u&&0==t&&","==r){i.push(N(l)),l="";continue}}else--t;else++t;l+=r}return 0<l.length&&i.push(N(l)),i}if(n=e.match(R.map)){for(t=0,r=" ",i=[],l="",u=!1,a=0,s=n[1].length;a<s;++a){if("'"==(r=n[1][a])||'"'==r){if(!1===u){l+=u=r;continue}if("'"==r&&"'"==u||'"'==r&&'"'==u){u=!1,l+=r;continue}}else if(!1!==u||"["!=r&&"{"!=r)if(!1!==u||"]"!=r&&"}"!=r){if(!1===u&&0==t&&","==r){i.push(l),l="";continue}}else--t;else++t;l+=r}0<l.length&&i.push(l);var f={};for(a=0,s=i.length;a<s;++a)(n=i[a].match(R.key_value))&&(f[n[1]]=N(n[2]));return f}return e}return new Date(n)}function _(e){for(var n=e.lines,t=e.children,r=[n.join(" ")],i=0,l=t.length;i<l;++i)r.push(_(t[i]));return r.join("\n")}function $(e){for(var n=e.lines,t=e.children,r=n.join("\n"),i=0,l=t.length;i<l;++i)r+=$(t[i]);return r}function r(e){return function e(n){for(var t=null,r={},i=null,l=null,u=null,a=-1,s=[],f=!0,h=0,o=n.length;h<o;++h)if(-1==a||a==n[h].level){s.push(h),a=n[h].level,i=n[h].lines,l=n[h].children,u=null;for(var c=0,p=i.length;c<p;++c){var g=i[c];if(t=g.match(R.key)){var v=t[1];if("-"==v[0]&&(v=v.replace(R.item,""),f&&(f=!1,void 0===r.length&&(r=[])),null!=u&&r.push(u),u={},f=!0),void 0!==t[2]){var d=t[2].replace(R.trim,"");if("&"==d[0]){var m=e(l);null!=u?u[v]=m:r[v]=m,y[d.substr(1)]=m}else if("|"==d[0])null!=u?u[v]=$(l.shift()):r[v]=$(l.shift());else if("*"==d[0]){var w=d.substr(1),E={};if(void 0===y[w])b.push("Reference '"+w+"' not found!");else{for(var x in y[w])E[x]=y[w][x];null!=u?u[v]=E:r[v]=E}}else">"==d[0]?null!=u?u[v]=_(l.shift()):r[v]=_(l.shift()):null!=u?u[v]=N(d):r[v]=N(d)}else null!=u?u[v]=e(l):r[v]=e(l)}else{if(g.match(/^-\s*$/)){f&&(f=!1,void 0===r.length&&(r=[])),null!=u&&r.push(u),u={},f=!0;continue}if(t=g.match(/^-\s*(.*)/)){null!=u?u.push(N(t[1])):(f&&(f=!1,void 0===r.length&&(r=[])),r.push(N(t[1])));continue}}}null!=u&&(f&&(f=!1,void 0===r.length&&(r=[])),r.push(u))}for(h=s.length-1;0<=h;--h)n.splice.call(n,s[h],1);return r}(e.children)}function l(e){b=[],y=[],t=(new Date).getTime();var n=r(function(e){var n,t=R.regLevel,r=R.invalidLine,i=e.split("\n"),l=0,u=0,a=[],s=new m(-1),f=new m(0);s.addChild(f);var h=[],o="";a.push(f),h.push(l);for(var c=0,p=i.length;c<p;++c)if(!(o=i[c]).match(r)){if(u<(l=(n=t.exec(o))?n[1].length:0)){var g=f;f=new m(l),g.addChild(f),a.push(f),h.push(l)}else if(l<u){for(var v=!1,d=h.length-1;0<=d;--d)if(h[d]==l){f=new m(l),a.push(f),h.push(l),null!=a[d].parent&&a[d].parent.addChild(f),v=!0;break}if(!v)return void b.push("Error: Invalid indentation at line "+c+": "+o)}f.lines.push(o.replace(R.trim,"")),u=l}return s}(function(e){var n,t=e.split("\n"),r=R.comment;for(var i in t)(n=t[i].match(r))&&void 0!==n[3]&&(t[i]=n[0].substr(0,n[0].length-n[3].length));return t.join("\n")}(e)));return t=(new Date).getTime()-t,n}var u=new RegExp("^(\\ufeff?(= yaml =|---)$([\\s\\S]*?)(?:\\2|\\.\\.\\.)$(?:\\n)?)","m");function a(e){var n=(e=e||"").split(/(\r?\n)/);return n[0]&&/= yaml =|---/.test(n[0])?function(e){var n=u.exec(e);if(!n)return{attributes:{},body:e};var t=n[n.length-1].replace(/^\s+|\s+$/g,""),r=l(t)||{},i=e.replace(n[0],"");return{attributes:r,body:i,frontmatter:t}}(e):{attributes:{},body:e}}$docsify.plugins=[].concat(function(e,i){e.beforeEach(function(e){var n=a(e),t=n.attributes,r=n.body;return i.frontmatter=t,r})},$docsify.plugins)}();
|
||||
|
||||
Vendored
+1
-1
@@ -1 +1 @@
|
||||
!function(){function n(n){!function(){var n=document.createElement("script");n.async=!0,n.src="https://www.google-analytics.com/analytics.js",document.body.appendChild(n)}(),window.ga=window.ga||function(){(window.ga.q=window.ga.q||[]).push(arguments)},window.ga.l=Number(new Date),window.ga("create",n,"auto")}function o(){window.ga||n($docsify.ga),window.ga("set","page",location.hash),window.ga("send","pageview")}$docsify.plugins=[].concat(function(n){$docsify.ga?n.beforeEach(o):console.error("[Docsify] ga is required.")},$docsify.plugins)}();
|
||||
!function(){function n(n){var o;(o=document.createElement("script")).async=!0,o.src="https://www.google-analytics.com/analytics.js",document.body.appendChild(o),window.ga=window.ga||function(){(window.ga.q=window.ga.q||[]).push(arguments)},window.ga.l=Number(new Date),window.ga("create",n,"auto")}function o(){window.ga||n($docsify.ga),window.ga("set","page",location.hash),window.ga("send","pageview")}$docsify.plugins=[].concat(function(n){$docsify.ga?n.beforeEach(o):console.error("[Docsify] ga is required.")},$docsify.plugins)}();
|
||||
|
||||
Vendored
+1
-1
@@ -1 +1 @@
|
||||
!function(){$docsify.plugins=[].concat(function(n){var t=Docsify.dom;n.mounted(function(n){var i=t.create("div");i.id="gitalk-container";var e=t.getNode("#main");i.style="width: "+e.clientWidth+"px; margin: 0 auto 20px;",t.appendTo(t.find(".content"),i);var o=t.create("script");o.textContent="gitalk.render('gitalk-container')",t.appendTo(t.body,o)})},$docsify.plugins)}();
|
||||
$docsify.plugins=[].concat(function(t){var a=Docsify.dom;t.mounted(function(t){var n=a.create("div");n.id="gitalk-container";var i=a.getNode("#main");n.style="width: "+i.clientWidth+"px; margin: 0 auto 20px;",a.appendTo(a.find(".content"),n);var e=a.create("script");e.textContent="gitalk.render('gitalk-container')",a.appendTo(a.body,e)})},$docsify.plugins);
|
||||
|
||||
+26
-9
@@ -1,6 +1,5 @@
|
||||
(function () {
|
||||
var INDEXS = {};
|
||||
var helper;
|
||||
|
||||
function escapeHtml(string) {
|
||||
var entityMap = {
|
||||
@@ -18,7 +17,7 @@ function escapeHtml(string) {
|
||||
function getAllPaths(router) {
|
||||
var paths = [];
|
||||
|
||||
helper.dom.findAll('a:not([data-nosearch])').forEach(function (node) {
|
||||
document.querySelectorAll('.sidebar-nav a:not(.section-link):not([data-nosearch])').forEach(function (node) {
|
||||
var href = node.href;
|
||||
var originHref = node.getAttribute('href');
|
||||
var path = router.parse(href).path;
|
||||
@@ -154,8 +153,6 @@ function search(query) {
|
||||
}
|
||||
|
||||
function init$1(config, vm) {
|
||||
helper = Docsify;
|
||||
|
||||
var isAuto = config.paths === 'auto';
|
||||
var isExpired = localStorage.getItem('docsify.search.expires') < Date.now();
|
||||
|
||||
@@ -176,7 +173,7 @@ function init$1(config, vm) {
|
||||
return count++
|
||||
}
|
||||
|
||||
helper
|
||||
Docsify
|
||||
.get(vm.router.getFile(path), false, vm.config.requestHeaders)
|
||||
.then(function (result) {
|
||||
INDEXS[path] = genIndex(path, result, vm.router, config.depth);
|
||||
@@ -186,14 +183,15 @@ function init$1(config, vm) {
|
||||
}
|
||||
|
||||
var NO_DATA_TEXT = '';
|
||||
var options;
|
||||
|
||||
function style() {
|
||||
var code = "\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 .input-wrap {\n display: flex;\n align-items: center;\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: 0 7px;\n line-height: 36px;\n font-size: 14px;\n}\n\n.search input::-webkit-search-decoration,\n.search input::-webkit-search-cancel-button,\n.search input {\n -webkit-appearance: none;\n -moz-appearance: none;\n appearance: none;\n}\n.search .clear-button {\n width: 36px;\n text-align: right;\n display: none;\n}\n\n.search .clear-button.show {\n display: block;\n}\n\n.search .clear-button svg {\n transform: scale(.5);\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}";
|
||||
var code = "\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 .input-wrap {\n display: flex;\n align-items: center;\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: 0 7px;\n line-height: 36px;\n font-size: 14px;\n}\n\n.search input::-webkit-search-decoration,\n.search input::-webkit-search-cancel-button,\n.search input {\n -webkit-appearance: none;\n -moz-appearance: none;\n appearance: none;\n}\n.search .clear-button {\n width: 36px;\n text-align: right;\n display: none;\n}\n\n.search .clear-button.show {\n display: block;\n}\n\n.search .clear-button svg {\n transform: scale(.5);\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}\n\n.app-name.hide, .sidebar-nav.hide {\n display: none;\n}";
|
||||
|
||||
Docsify.dom.style(code);
|
||||
}
|
||||
|
||||
function tpl(opts, defaultValue) {
|
||||
function tpl(defaultValue) {
|
||||
if ( defaultValue === void 0 ) defaultValue = '';
|
||||
|
||||
var html =
|
||||
@@ -209,11 +207,18 @@ function doSearch(value) {
|
||||
var $search = Docsify.dom.find('div.search');
|
||||
var $panel = Docsify.dom.find($search, '.results-panel');
|
||||
var $clearBtn = Docsify.dom.find($search, '.clear-button');
|
||||
var $sidebarNav = Docsify.dom.find('.sidebar-nav');
|
||||
var $appName = Docsify.dom.find('.app-name');
|
||||
|
||||
if (!value) {
|
||||
$panel.classList.remove('show');
|
||||
$clearBtn.classList.remove('show');
|
||||
$panel.innerHTML = '';
|
||||
|
||||
if (options.hideOtherSidebarContent) {
|
||||
$sidebarNav.classList.remove('hide');
|
||||
$appName.classList.remove('hide');
|
||||
}
|
||||
return
|
||||
}
|
||||
var matchs = search(value);
|
||||
@@ -226,6 +231,10 @@ function doSearch(value) {
|
||||
$panel.classList.add('show');
|
||||
$clearBtn.classList.add('show');
|
||||
$panel.innerHTML = html || ("<p class=\"empty\">" + NO_DATA_TEXT + "</p>");
|
||||
if (options.hideOtherSidebarContent) {
|
||||
$sidebarNav.classList.add('hide');
|
||||
$appName.classList.add('hide');
|
||||
}
|
||||
}
|
||||
|
||||
function bindEvents() {
|
||||
@@ -276,16 +285,22 @@ function updateNoData(text, path) {
|
||||
}
|
||||
}
|
||||
|
||||
function updateOptions(opts) {
|
||||
options = opts;
|
||||
}
|
||||
|
||||
function init(opts, vm) {
|
||||
var keywords = vm.router.parse().query.s;
|
||||
|
||||
updateOptions(opts);
|
||||
style();
|
||||
tpl(opts, keywords);
|
||||
tpl(keywords);
|
||||
bindEvents();
|
||||
keywords && setTimeout(function (_) { return doSearch(keywords); }, 500);
|
||||
}
|
||||
|
||||
function update(opts, vm) {
|
||||
updateOptions(opts);
|
||||
updatePlaceholder(opts.placeholder, vm.route.path);
|
||||
updateNoData(opts.noData, vm.route.path);
|
||||
}
|
||||
@@ -295,7 +310,8 @@ var CONFIG = {
|
||||
noData: 'No Results!',
|
||||
paths: 'auto',
|
||||
depth: 2,
|
||||
maxAge: 86400000 // 1 day
|
||||
maxAge: 86400000, // 1 day
|
||||
hideOtherSidebarContent: false
|
||||
};
|
||||
|
||||
var install = function (hook, vm) {
|
||||
@@ -310,6 +326,7 @@ var install = function (hook, vm) {
|
||||
CONFIG.placeholder = opts.placeholder || CONFIG.placeholder;
|
||||
CONFIG.noData = opts.noData || CONFIG.noData;
|
||||
CONFIG.depth = opts.depth || CONFIG.depth;
|
||||
CONFIG.hideOtherSidebarContent = opts.hideOtherSidebarContent || CONFIG.hideOtherSidebarContent;
|
||||
}
|
||||
|
||||
var isAuto = CONFIG.paths === 'auto';
|
||||
|
||||
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
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
+3838
-3998
File diff suppressed because it is too large
Load Diff
+3
-3
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "docsify",
|
||||
"version": "4.7.1",
|
||||
"version": "4.8.3",
|
||||
"description": "A magical documentation generator.",
|
||||
"author": {
|
||||
"name": "qingwei-li",
|
||||
@@ -42,10 +42,10 @@
|
||||
"postinstall": "opencollective postinstall"
|
||||
},
|
||||
"dependencies": {
|
||||
"marked": "^0.3.12",
|
||||
"marked": "^0.5.1",
|
||||
"medium-zoom": "^0.4.0",
|
||||
"opencollective": "^1.0.3",
|
||||
"prismjs": "^1.9.0",
|
||||
"prismjs": "^1.15.0",
|
||||
"tinydate": "^1.0.0",
|
||||
"tweezer.js": "^1.4.0"
|
||||
},
|
||||
|
||||
+1
-1
@@ -37,5 +37,5 @@
|
||||
"integrity": "sha1-6DWIAbhrg7F1YNTjw4LXrvIQCUQ="
|
||||
}
|
||||
},
|
||||
"version": "4.7.1"
|
||||
"version": "4.8.3"
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "docsify-server-renderer",
|
||||
"version": "4.7.1",
|
||||
"version": "4.8.3",
|
||||
"description": "docsify server renderer",
|
||||
"author": {
|
||||
"name": "qingwei-li",
|
||||
@@ -16,6 +16,7 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"debug": "^2.6.8",
|
||||
"docsify": "^4.8.0",
|
||||
"node-fetch": "^1.7.0",
|
||||
"resolve-pathname": "^2.1.0"
|
||||
}
|
||||
|
||||
+56
-38
@@ -7,6 +7,9 @@ import {emojify} from './emojify'
|
||||
import {isAbsolutePath, getPath, getParentPath} from '../router/util'
|
||||
import {isFn, merge, cached, isPrimitive} from '../util/core'
|
||||
|
||||
// See https://github.com/PrismJS/prism/pull/1367
|
||||
import 'prismjs/components/prism-markup-templating'
|
||||
|
||||
const cachedLinks = {}
|
||||
|
||||
export function getAndRemoveConfig(str = '') {
|
||||
@@ -14,6 +17,8 @@ export function getAndRemoveConfig(str = '') {
|
||||
|
||||
if (str) {
|
||||
str = str
|
||||
.replace(/^'/, '')
|
||||
.replace(/'$/, '')
|
||||
.replace(/:([\w-]+)=?([\w-]+)?/g, (m, key, value) => {
|
||||
config[key] = (value && value.replace(/"/g, '')) || true
|
||||
return ''
|
||||
@@ -30,19 +35,24 @@ const compileMedia = {
|
||||
url
|
||||
}
|
||||
},
|
||||
mermaid(url) {
|
||||
return {
|
||||
url
|
||||
}
|
||||
},
|
||||
iframe(url, title) {
|
||||
return {
|
||||
code: `<iframe src="${url}" ${title || 'width=100% height=400'}></iframe>`
|
||||
html: `<iframe src="${url}" ${title || 'width=100% height=400'}></iframe>`
|
||||
}
|
||||
},
|
||||
video(url, title) {
|
||||
return {
|
||||
code: `<video src="${url}" ${title || 'controls'}>Not Support</video>`
|
||||
html: `<video src="${url}" ${title || 'controls'}>Not Support</video>`
|
||||
}
|
||||
},
|
||||
audio(url, title) {
|
||||
return {
|
||||
code: `<audio src="${url}" ${title || 'controls'}>Not Support</audio>`
|
||||
html: `<audio src="${url}" ${title || 'controls'}>Not Support</audio>`
|
||||
}
|
||||
},
|
||||
code(url, title) {
|
||||
@@ -66,6 +76,7 @@ export class Compiler {
|
||||
this.router = router
|
||||
this.cacheTree = {}
|
||||
this.toc = []
|
||||
this.cacheTOC = {}
|
||||
this.linkTarget = config.externalLinkTarget || '_blank'
|
||||
this.contentBase = router.getBasePath()
|
||||
|
||||
@@ -85,24 +96,38 @@ export class Compiler {
|
||||
}
|
||||
|
||||
this._marked = compile
|
||||
this.compile = cached(text => {
|
||||
let html = ''
|
||||
this.compile = text => {
|
||||
let isCached = true
|
||||
const result = cached(_ => {
|
||||
isCached = false
|
||||
let html = ''
|
||||
|
||||
if (!text) {
|
||||
return text
|
||||
}
|
||||
if (!text) {
|
||||
return text
|
||||
}
|
||||
|
||||
if (isPrimitive(text)) {
|
||||
html = compile(text)
|
||||
if (isPrimitive(text)) {
|
||||
html = compile(text)
|
||||
} else {
|
||||
html = compile.parser(text)
|
||||
}
|
||||
|
||||
html = config.noEmoji ? html : emojify(html)
|
||||
slugify.clear()
|
||||
|
||||
return html
|
||||
})(text)
|
||||
|
||||
const curFileName = this.router.parse().file
|
||||
|
||||
if (isCached) {
|
||||
this.toc = this.cacheTOC[curFileName]
|
||||
} else {
|
||||
html = compile.parser(text)
|
||||
this.cacheTOC[curFileName] = [...this.toc]
|
||||
}
|
||||
|
||||
html = config.noEmoji ? html : emojify(html)
|
||||
slugify.clear()
|
||||
|
||||
return html
|
||||
})
|
||||
return result
|
||||
}
|
||||
}
|
||||
|
||||
compileEmbed(href, title) {
|
||||
@@ -127,6 +152,8 @@ export class Compiler {
|
||||
let type = 'code'
|
||||
if (/\.(md|markdown)/.test(href)) {
|
||||
type = 'markdown'
|
||||
} else if (/\.mmd/.test(href)) {
|
||||
type = 'mermaid'
|
||||
} else if (/\.html?/.test(href)) {
|
||||
type = 'iframe'
|
||||
} else if (/\.(mp4|ogg)/.test(href)) {
|
||||
@@ -166,26 +193,27 @@ export class Compiler {
|
||||
* @link https://github.com/markedjs/marked#overriding-renderer-methods
|
||||
*/
|
||||
origin.heading = renderer.heading = function (text, level) {
|
||||
const nextToc = {level, title: text}
|
||||
let {str, config} = getAndRemoveConfig(text)
|
||||
const nextToc = {level, title: str}
|
||||
|
||||
if (/{docsify-ignore}/g.test(text)) {
|
||||
text = text.replace('{docsify-ignore}', '')
|
||||
nextToc.title = text
|
||||
if (/{docsify-ignore}/g.test(str)) {
|
||||
str = str.replace('{docsify-ignore}', '')
|
||||
nextToc.title = str
|
||||
nextToc.ignoreSubHeading = true
|
||||
}
|
||||
|
||||
if (/{docsify-ignore-all}/g.test(text)) {
|
||||
text = text.replace('{docsify-ignore-all}', '')
|
||||
nextToc.title = text
|
||||
if (/{docsify-ignore-all}/g.test(str)) {
|
||||
str = str.replace('{docsify-ignore-all}', '')
|
||||
nextToc.title = str
|
||||
nextToc.ignoreAllSubs = true
|
||||
}
|
||||
|
||||
const slug = slugify(text)
|
||||
const slug = slugify(config.id || str)
|
||||
const url = router.toURL(router.getCurrentPath(), {id: slug})
|
||||
nextToc.slug = url
|
||||
_self.toc.push(nextToc)
|
||||
|
||||
return `<h${level} id="${slug}"><a href="${url}" data-id="${slug}" class="anchor"><span>${text}</span></a></h${level}>`
|
||||
return `<h${level} id="${slug}"><a href="${url}" data-id="${slug}" class="anchor"><span>${str}</span></a></h${level}>`
|
||||
}
|
||||
// Highlight code
|
||||
origin.code = renderer.code = function (code, lang = '') {
|
||||
@@ -213,7 +241,7 @@ export class Compiler {
|
||||
}
|
||||
href = router.toURL(href, null, router.getCurrentPath())
|
||||
} else {
|
||||
attrs += ` target="${linkTarget}"`
|
||||
attrs += href.startsWith('mailto:') ? '' : ` target="${linkTarget}"`
|
||||
}
|
||||
|
||||
if (config.target) {
|
||||
@@ -237,6 +265,8 @@ export class Compiler {
|
||||
result = helperTpl('tip', text)
|
||||
} else if (/^\?>/.test(text)) {
|
||||
result = helperTpl('warn', text)
|
||||
} else if (/^</.test(text)) {
|
||||
return text
|
||||
} else {
|
||||
result = `<p>${text}</p>`
|
||||
}
|
||||
@@ -274,18 +304,6 @@ 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
|
||||
|
||||
+24
-13
@@ -27,6 +27,14 @@ function walkFetchEmbed({embedTokens, compile, fetch}, cb) {
|
||||
text.replace(/`/g, '@DOCSIFY_QM@') +
|
||||
'\n```\n'
|
||||
)
|
||||
} else if (token.embed.type === 'mermaid') {
|
||||
embedToken = [
|
||||
{type: 'html', text: `<div class="mermaid">\n${text}\n</div>`}
|
||||
]
|
||||
embedToken.links = {}
|
||||
} else {
|
||||
embedToken = [{type: 'html', text}]
|
||||
embedToken.links = {}
|
||||
}
|
||||
}
|
||||
cb({token, embedToken})
|
||||
@@ -36,18 +44,24 @@ function walkFetchEmbed({embedTokens, compile, fetch}, cb) {
|
||||
}
|
||||
})(token)
|
||||
|
||||
if (process.env.SSR) {
|
||||
fetch(token.embed.url).then(next)
|
||||
if (token.embed.url) {
|
||||
if (process.env.SSR) {
|
||||
fetch(token.embed.url).then(next)
|
||||
} else {
|
||||
get(token.embed.url).then(next)
|
||||
}
|
||||
} else {
|
||||
get(token.embed.url).then(next)
|
||||
next(token.embed.html)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export function prerenderEmbed({compiler, raw = '', fetch}, done) {
|
||||
let hit
|
||||
if ((hit = cached[raw])) {
|
||||
return done(hit)
|
||||
let hit = cached[raw]
|
||||
if (hit) {
|
||||
const copy = hit.slice()
|
||||
copy.links = hit.links
|
||||
return done(copy)
|
||||
}
|
||||
|
||||
const compile = compiler._marked
|
||||
@@ -64,13 +78,10 @@ export function prerenderEmbed({compiler, raw = '', fetch}, done) {
|
||||
const embed = compiler.compileEmbed(href, title)
|
||||
|
||||
if (embed) {
|
||||
if (embed.type === 'markdown' || embed.type === 'code') {
|
||||
embedTokens.push({
|
||||
index,
|
||||
embed
|
||||
})
|
||||
}
|
||||
return embed.code
|
||||
embedTokens.push({
|
||||
index,
|
||||
embed
|
||||
})
|
||||
}
|
||||
|
||||
return src
|
||||
|
||||
@@ -176,9 +176,10 @@ export function renderMixin(proto) {
|
||||
dom.toggleClass(el, 'add', 'show')
|
||||
|
||||
let html = this.coverIsHTML ? text : this.compiler.cover(text)
|
||||
|
||||
const m = html
|
||||
.trim()
|
||||
.match('<p><img.*?data-origin="(.*?)"[^a]+alt="(.*?)">([^<]*?)</p>$')
|
||||
.match('<img.*?data-origin="(.*?)"[^a]+alt="(.*?)">([^<]*?)$')
|
||||
|
||||
if (m) {
|
||||
if (m[2] === 'color') {
|
||||
@@ -197,6 +198,17 @@ export function renderMixin(proto) {
|
||||
html = html.replace(m[0], '')
|
||||
}
|
||||
|
||||
// XXX: A Workaround
|
||||
html = html
|
||||
.split('\n')
|
||||
.map(part => {
|
||||
if (/^<a/.test(part)) {
|
||||
return part.replace('<a', '<a data-button')
|
||||
}
|
||||
return part
|
||||
})
|
||||
.join('\n')
|
||||
|
||||
this._renderTo('.cover-main', html)
|
||||
sticky()
|
||||
}
|
||||
@@ -232,7 +244,13 @@ export function initRender(vm) {
|
||||
}
|
||||
|
||||
if (config.logo) {
|
||||
config.logo = getPath(vm.router.getBasePath(), config.logo)
|
||||
const isBase64 = /^data:image/.test(config.logo)
|
||||
const isExternal = /(?:http[s]?:)?\/\//.test(config.logo)
|
||||
const isRelative = /^\./.test(config.logo)
|
||||
|
||||
if (!isBase64 && !isExternal && !isRelative) {
|
||||
config.logo = getPath(vm.router.getBasePath(), config.logo)
|
||||
}
|
||||
}
|
||||
|
||||
html += tpl.main(config)
|
||||
|
||||
@@ -36,7 +36,7 @@ export function main(config) {
|
||||
'</button>' +
|
||||
'<aside class="sidebar">' +
|
||||
(config.name ?
|
||||
`<h1><a class="app-name-link" data-nosearch>${
|
||||
`<h1 class="app-name"><a class="app-name-link" data-nosearch>${
|
||||
config.logo ?
|
||||
`<img alt=${config.name} src=${config.logo}>` :
|
||||
config.name
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import {search} from './search'
|
||||
|
||||
let NO_DATA_TEXT = ''
|
||||
let options
|
||||
|
||||
function style() {
|
||||
const code = `
|
||||
@@ -86,12 +87,16 @@ function style() {
|
||||
|
||||
.search p.empty {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.app-name.hide, .sidebar-nav.hide {
|
||||
display: none;
|
||||
}`
|
||||
|
||||
Docsify.dom.style(code)
|
||||
}
|
||||
|
||||
function tpl(opts, defaultValue = '') {
|
||||
function tpl(defaultValue = '') {
|
||||
const html =
|
||||
`<div class="input-wrap">
|
||||
<input type="search" value="${defaultValue}" />
|
||||
@@ -116,11 +121,18 @@ function doSearch(value) {
|
||||
const $search = Docsify.dom.find('div.search')
|
||||
const $panel = Docsify.dom.find($search, '.results-panel')
|
||||
const $clearBtn = Docsify.dom.find($search, '.clear-button')
|
||||
const $sidebarNav = Docsify.dom.find('.sidebar-nav')
|
||||
const $appName = Docsify.dom.find('.app-name')
|
||||
|
||||
if (!value) {
|
||||
$panel.classList.remove('show')
|
||||
$clearBtn.classList.remove('show')
|
||||
$panel.innerHTML = ''
|
||||
|
||||
if (options.hideOtherSidebarContent) {
|
||||
$sidebarNav.classList.remove('hide')
|
||||
$appName.classList.remove('hide')
|
||||
}
|
||||
return
|
||||
}
|
||||
const matchs = search(value)
|
||||
@@ -138,6 +150,10 @@ function doSearch(value) {
|
||||
$panel.classList.add('show')
|
||||
$clearBtn.classList.add('show')
|
||||
$panel.innerHTML = html || `<p class="empty">${NO_DATA_TEXT}</p>`
|
||||
if (options.hideOtherSidebarContent) {
|
||||
$sidebarNav.classList.add('hide')
|
||||
$appName.classList.add('hide')
|
||||
}
|
||||
}
|
||||
|
||||
function bindEvents() {
|
||||
@@ -188,16 +204,22 @@ function updateNoData(text, path) {
|
||||
}
|
||||
}
|
||||
|
||||
function updateOptions(opts) {
|
||||
options = opts
|
||||
}
|
||||
|
||||
export function init(opts, vm) {
|
||||
const keywords = vm.router.parse().query.s
|
||||
|
||||
updateOptions(opts)
|
||||
style()
|
||||
tpl(opts, keywords)
|
||||
tpl(keywords)
|
||||
bindEvents()
|
||||
keywords && setTimeout(_ => doSearch(keywords), 500)
|
||||
}
|
||||
|
||||
export function update(opts, vm) {
|
||||
updateOptions(opts)
|
||||
updatePlaceholder(opts.placeholder, vm.route.path)
|
||||
updateNoData(opts.noData, vm.route.path)
|
||||
}
|
||||
|
||||
@@ -6,7 +6,8 @@ const CONFIG = {
|
||||
noData: 'No Results!',
|
||||
paths: 'auto',
|
||||
depth: 2,
|
||||
maxAge: 86400000 // 1 day
|
||||
maxAge: 86400000, // 1 day
|
||||
hideOtherSidebarContent: false
|
||||
}
|
||||
|
||||
const install = function (hook, vm) {
|
||||
@@ -21,6 +22,7 @@ const install = function (hook, vm) {
|
||||
CONFIG.placeholder = opts.placeholder || CONFIG.placeholder
|
||||
CONFIG.noData = opts.noData || CONFIG.noData
|
||||
CONFIG.depth = opts.depth || CONFIG.depth
|
||||
CONFIG.hideOtherSidebarContent = opts.hideOtherSidebarContent || CONFIG.hideOtherSidebarContent
|
||||
}
|
||||
|
||||
const isAuto = CONFIG.paths === 'auto'
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
let INDEXS = {}
|
||||
let helper
|
||||
|
||||
function escapeHtml(string) {
|
||||
const entityMap = {
|
||||
@@ -17,7 +16,7 @@ function escapeHtml(string) {
|
||||
function getAllPaths(router) {
|
||||
const paths = []
|
||||
|
||||
helper.dom.findAll('a:not([data-nosearch])').forEach(node => {
|
||||
document.querySelectorAll('.sidebar-nav a:not(.section-link):not([data-nosearch])').forEach(node => {
|
||||
const href = node.href
|
||||
const originHref = node.getAttribute('href')
|
||||
const path = router.parse(href).path
|
||||
@@ -149,8 +148,6 @@ export function search(query) {
|
||||
}
|
||||
|
||||
export function init(config, vm) {
|
||||
helper = Docsify
|
||||
|
||||
const isAuto = config.paths === 'auto'
|
||||
const isExpired = localStorage.getItem('docsify.search.expires') < Date.now()
|
||||
|
||||
@@ -171,7 +168,7 @@ export function init(config, vm) {
|
||||
return count++
|
||||
}
|
||||
|
||||
helper
|
||||
Docsify
|
||||
.get(vm.router.getFile(path), false, vm.config.requestHeaders)
|
||||
.then(result => {
|
||||
INDEXS[path] = genIndex(path, result, vm.router, config.depth)
|
||||
|
||||
@@ -1,14 +1,20 @@
|
||||
import mediumZoom from 'medium-zoom'
|
||||
|
||||
const matchesSelector = Element.prototype.matches || Element.prototype.webkitMatchesSelector || Element.prototype.msMatchesSelector
|
||||
|
||||
function install(hook) {
|
||||
let zoom
|
||||
|
||||
hook.doneEach(_ => {
|
||||
let elms = Array.apply(null, document.querySelectorAll('.markdown-section img:not(.emoji):not([data-no-zoom])'))
|
||||
|
||||
elms = elms.filter(elm => matchesSelector.call(elm, 'a img') === false)
|
||||
|
||||
if (zoom) {
|
||||
zoom.detach()
|
||||
}
|
||||
|
||||
zoom = mediumZoom('img:not(.emoji):not([data-no-zoom])')
|
||||
zoom = mediumZoom(elms)
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ section.cover
|
||||
max-width 500px
|
||||
padding 0
|
||||
|
||||
.cover-main > p:last-child a
|
||||
.cover-main > a[data-button]
|
||||
border-color var(--theme-color, $color-primary)
|
||||
border-radius 2rem
|
||||
border-style solid
|
||||
|
||||
@@ -74,11 +74,8 @@ kbd
|
||||
padding 3px 5px
|
||||
vertical-align middle
|
||||
|
||||
.task-list-item
|
||||
list-style-type none
|
||||
|
||||
li input[type='checkbox']
|
||||
margin 0 0.2em 0.25em -1.6em
|
||||
margin 0 0.2em 0.25em 0
|
||||
vertical-align middle
|
||||
|
||||
/* navbar */
|
||||
|
||||
+1
-1
@@ -159,7 +159,7 @@ body
|
||||
.token.attr-value, .token.control, .token.directive, .token.unit
|
||||
color var(--theme-color, $color-primary)
|
||||
|
||||
.token.keyword
|
||||
.token.keyword, .token.function
|
||||
color #e96900
|
||||
|
||||
.token.statement, .token.regex, .token.atrule
|
||||
|
||||
Reference in New Issue
Block a user