mirror of
https://github.com/wahyd4/docsify.git
synced 2026-08-10 05:48:18 +10:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
69b2040571 | ||
|
|
e8d675c405 | ||
|
|
5cc3e6c469 | ||
|
|
3e94cb6d76 | ||
|
|
641e522779 | ||
|
|
026530de10 | ||
|
|
1b74ef31a9 | ||
|
|
25acd8ce77 | ||
|
|
9b4e6669db | ||
|
|
2e3fe59702 | ||
|
|
7923608bc9 | ||
|
|
e307308a78 | ||
|
|
c195d2d1a6 | ||
|
|
0624e592d8 | ||
|
|
aba2aec0d0 | ||
|
|
a9704b5156 | ||
|
|
16d730ec3d | ||
|
|
08afec7d2a | ||
|
|
fcee316d2c | ||
|
|
1d2b546602 | ||
|
|
97793bfd6c | ||
|
|
ae3f74bfd4 | ||
|
|
04eaf4026b | ||
|
|
46ac4c3fd2 | ||
|
|
44dc68c6b2 | ||
|
|
6c702d3362 | ||
|
|
c476e49164 | ||
|
|
0329bab359 | ||
|
|
62aa161bff | ||
|
|
3854692331 | ||
|
|
2066cb672d | ||
|
|
5b7b60c553 | ||
|
|
388ed3d685 | ||
|
|
e898350a84 | ||
|
|
9c62fb41b8 | ||
|
|
9b73b0bf8a | ||
|
|
9d43051791 | ||
|
|
f0aca1905c | ||
|
|
2959497874 |
@@ -1,9 +1,3 @@
|
||||
sudo: false
|
||||
cache:
|
||||
directories:
|
||||
- $HOME/.yarn-cache
|
||||
language: node_js
|
||||
node_js: stable
|
||||
os:
|
||||
- linux
|
||||
- osx
|
||||
|
||||
Vendored
+3
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"prettier.eslintIntegration": true
|
||||
}
|
||||
@@ -1,3 +1,83 @@
|
||||
<a name="4.3.9"></a>
|
||||
## [4.3.9](https://github.com/QingWei-Li/docsify/compare/v4.3.8...v4.3.9) (2017-10-11)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* scroll issue in IE ([#275](https://github.com/QingWei-Li/docsify/issues/275)) ([3e94cb6](https://github.com/QingWei-Li/docsify/commit/3e94cb6))
|
||||
|
||||
|
||||
|
||||
<a name="4.3.8"></a>
|
||||
## [4.3.8](https://github.com/QingWei-Li/docsify/compare/v4.3.7...v4.3.8) (2017-10-07)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **slugify:** GitHub compatible heading links, fixed [#272](https://github.com/QingWei-Li/docsify/issues/272) ([9b4e666](https://github.com/QingWei-Li/docsify/commit/9b4e666))
|
||||
|
||||
|
||||
|
||||
<a name="4.3.7"></a>
|
||||
## [4.3.7](https://github.com/QingWei-Li/docsify/compare/v4.3.6...v4.3.7) (2017-10-02)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **slugify:** GitHub compatible heading links, fixed [#267](https://github.com/QingWei-Li/docsify/issues/267) ([c195d2d](https://github.com/QingWei-Li/docsify/commit/c195d2d))
|
||||
|
||||
|
||||
|
||||
<a name="4.3.6"></a>
|
||||
## [4.3.6](https://github.com/QingWei-Li/docsify/compare/v4.3.5...v4.3.6) (2017-09-21)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* style for codesponsor plugin ([08afec7](https://github.com/QingWei-Li/docsify/commit/08afec7))
|
||||
|
||||
|
||||
|
||||
<a name="4.3.5"></a>
|
||||
## [4.3.5](https://github.com/QingWei-Li/docsify/compare/v4.3.4...v4.3.5) (2017-09-20)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* missed symbol ([#254](https://github.com/QingWei-Li/docsify/issues/254)) ([6c702d3](https://github.com/QingWei-Li/docsify/commit/6c702d3))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **plugin:** add codesponsor plugin ([46ac4c3](https://github.com/QingWei-Li/docsify/commit/46ac4c3))
|
||||
|
||||
|
||||
|
||||
<a name="4.3.4"></a>
|
||||
## [4.3.4](https://github.com/QingWei-Li/docsify/compare/v4.3.3...v4.3.4) (2017-09-07)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* scroll position issue, fixed [#234](https://github.com/QingWei-Li/docsify/issues/234) ([388ed3d](https://github.com/QingWei-Li/docsify/commit/388ed3d))
|
||||
|
||||
|
||||
|
||||
<a name="4.3.3"></a>
|
||||
## [4.3.3](https://github.com/QingWei-Li/docsify/compare/v4.3.2...v4.3.3) (2017-09-06)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **buble.css:** tweaks code block style, fixed [#249](https://github.com/QingWei-Li/docsify/issues/249) ([9d43051](https://github.com/QingWei-Li/docsify/commit/9d43051))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* add doc for react and vue demo box plugin ([#247](https://github.com/QingWei-Li/docsify/issues/247)) ([f0aca19](https://github.com/QingWei-Li/docsify/commit/f0aca19))
|
||||
|
||||
|
||||
|
||||
<a name="4.3.2"></a>
|
||||
## [4.3.2](https://github.com/QingWei-Li/docsify/compare/v4.3.1...v4.3.2) (2017-09-01)
|
||||
|
||||
|
||||
@@ -13,9 +13,12 @@
|
||||
<a href="https://www.npmjs.com/package/docsify"><img alt="npm" src="https://img.shields.io/npm/v/docsify.svg?style=flat-square"></a>
|
||||
<a href="https://cdnjs.com/libraries/docsify"><img alt="cdnjs" src="https://img.shields.io/cdnjs/v/docsify.svg?style=flat-square"></a>
|
||||
<a href="https://github.com/QingWei-Li/donate"><img alt="donate" src="https://img.shields.io/badge/%24-donate-ff69b4.svg?style=flat-square"></a>
|
||||
<a href="https://app.fossa.io/projects/git%2Bhttps%3A%2F%2Fgithub.com%2FQingWei-Li%2Fdocsify?ref=badge_shield" alt="FOSSA Status"><img src="https://app.fossa.io/api/projects/git%2Bhttps%3A%2F%2Fgithub.com%2FQingWei-Li%2Fdocsify.svg?type=shield"/></a>
|
||||
</p>
|
||||
|
||||
|
||||
<a target='_blank' rel='nofollow' href='https://app.codesponsor.io/link/YdWAqnN2kHQmLtFQhEddaaPT/QingWei-Li/docsify'> <img alt='Sponsor' width='888' height='68' src='https://app.codesponsor.io/embed/YdWAqnN2kHQmLtFQhEddaaPT/QingWei-Li/docsify.svg' /></a>
|
||||
|
||||
|
||||
## Links
|
||||
|
||||
- [Documentation](https://docsify.js.org)
|
||||
@@ -42,6 +45,7 @@ Create an `index.html`.
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<meta charset="UTF-8">
|
||||
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/docsify/lib/themes/vue.css">
|
||||
</head>
|
||||
@@ -76,6 +80,8 @@ These projects are using docsify to generate their sites. Pull requests welcome
|
||||
| [commitlint](https://marionebl.github.io/commitlint/) | Lint commit messages |
|
||||
| [vue-data-tables](https://github.com/njleonzhang/vue-data-tables/) | A simple and customizable data table,based on vue2 and element-ui. |
|
||||
| [Noty](http://ned.im/noty/) | A Dependency-free notification library |
|
||||
| [xTeko](https://docs.xteko.com/) | Addins framework for Pin 3.0 |
|
||||
| [vue2-datatable-component](https://github.com/OneWayTech/vue2-datatable) | The best Datatable for Vue.js 2.x which never sucks |
|
||||
|
||||
## Similar projects
|
||||
|
||||
@@ -105,3 +111,4 @@ open http://localhost:3000
|
||||
MIT
|
||||
|
||||
[](https://app.fossa.io/projects/git%2Bhttps%3A%2F%2Fgithub.com%2FQingWei-Li%2Fdocsify?ref=badge_large)
|
||||
|
||||
|
||||
@@ -30,22 +30,24 @@ var renderer = new Renderer({
|
||||
alias: {
|
||||
'/de-de/changelog': '/changelog',
|
||||
'/zh-cn/changelog': '/changelog',
|
||||
'/changelog': 'https://raw.githubusercontent.com/QingWei-Li/docsify/master/CHANGELOG'
|
||||
'/changelog':
|
||||
'https://raw.githubusercontent.com/QingWei-Li/docsify/master/CHANGELOG'
|
||||
}
|
||||
},
|
||||
path: './'
|
||||
})
|
||||
|
||||
http.createServer(function (req, res) {
|
||||
serveStatic('.')(req, res, function () {
|
||||
// TEST SSR
|
||||
// renderer.renderToString(req.url)
|
||||
http
|
||||
.createServer(function (req, res) {
|
||||
serveStatic('.')(req, res, function () {
|
||||
// TEST SSR
|
||||
// renderer.renderToString(req.url)
|
||||
// .then(html => res.end(html))
|
||||
|
||||
res.writeHead(404, { 'Content-Type': 'text/html' })
|
||||
res.end(fs.readFileSync('dev.html'))
|
||||
res.writeHead(404, { 'Content-Type': 'text/html' })
|
||||
res.end(fs.readFileSync('dev.html'))
|
||||
})
|
||||
})
|
||||
}).listen(3000, '0.0.0.0')
|
||||
.listen(3000, '0.0.0.0')
|
||||
|
||||
console.log(`\nListening at http://0.0.0.0:3000\n`)
|
||||
|
||||
|
||||
@@ -7,5 +7,8 @@ var file = __dirname + '/../docs/_coverpage.md'
|
||||
var cover = read(file, 'utf8').toString()
|
||||
|
||||
console.log('Replace version number in cover page...')
|
||||
cover = cover.replace(/<small>(\S+)?<\/small>/g, '<small>' + version + '</small>')
|
||||
cover = cover.replace(
|
||||
/<small>(\S+)?<\/small>/g,
|
||||
'<small>' + version + '</small>'
|
||||
)
|
||||
write(file, cover)
|
||||
|
||||
+15
-12
@@ -4,15 +4,17 @@ var resolve = require('path').resolve
|
||||
var postcss = require('postcss')
|
||||
var isProd = process.argv[process.argv.length - 1] !== '--dev'
|
||||
|
||||
var processor = postcss([require('postcss-salad')({
|
||||
features: {
|
||||
precss: {
|
||||
properties: {
|
||||
preserve: true
|
||||
var processor = postcss([
|
||||
require('postcss-salad')({
|
||||
features: {
|
||||
precss: {
|
||||
properties: {
|
||||
preserve: true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
})])
|
||||
})
|
||||
])
|
||||
|
||||
var saveMin = function (file, content) {
|
||||
fs.writeFileSync(resolve(__dirname, '../lib/themes/', file), content)
|
||||
@@ -31,17 +33,18 @@ var list = fs.readdirSync(resolve(__dirname, '../src/themes'))
|
||||
|
||||
list.forEach(function (file) {
|
||||
if (!/\.css$/.test(file)) return
|
||||
processor.process(load(file), { from: resolve(__dirname, '../src/themes/', file) })
|
||||
processor
|
||||
.process(load(file), { from: resolve(__dirname, '../src/themes/', file) })
|
||||
.then(function (result) {
|
||||
save(file, result.css)
|
||||
console.log('salad - ' + file)
|
||||
isProd && cssnano(loadLib(file))
|
||||
.then(function (result) {
|
||||
isProd &&
|
||||
cssnano(loadLib(file)).then(function (result) {
|
||||
saveMin(file, result.css)
|
||||
console.log('cssnao - ' + file)
|
||||
})
|
||||
}).catch(function (err) {
|
||||
})
|
||||
.catch(function (err) {
|
||||
console.log(err)
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
+1
-1
@@ -17,7 +17,7 @@ rollup
|
||||
}
|
||||
})
|
||||
],
|
||||
onwarn: function() {}
|
||||
onwarn: function () {}
|
||||
})
|
||||
.then(function (bundle) {
|
||||
var dest = 'packages/docsify-server-renderer/build.js'
|
||||
|
||||
+2
-1
@@ -47,7 +47,8 @@ var plugins = [
|
||||
{ name: 'emoji', entry: 'emoji.js' },
|
||||
{ name: 'external-script', entry: 'external-script.js' },
|
||||
{ name: 'front-matter', entry: 'front-matter/index.js' },
|
||||
{ name: 'zoom-image', entry: 'zoom-image.js' }
|
||||
{ name: 'zoom-image', entry: 'zoom-image.js' },
|
||||
{ name: 'codesponsor', entry: 'codesponsor.js' }
|
||||
]
|
||||
|
||||
plugins.forEach(item => {
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>docsify</title>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
|
||||
<link rel="stylesheet" href="/themes/vue.css" title="vue">
|
||||
<link rel="stylesheet" href="/themes/dark.css" title="dark" disabled>
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||

|
||||
|
||||
# docsify <small>4.3.2</small>
|
||||
# docsify <small>4.3.9</small>
|
||||
|
||||
> A magical documentation site generator.
|
||||
|
||||
|
||||
@@ -16,6 +16,30 @@ Es wird empfohlen, deine Dateien im `./docs` Unterordner im `master` branch dein
|
||||
|
||||
!> Du kannst die Dateien auch im Hauptverzeichnis speichern und dann `master branch` in den Einstellungen auswählen.
|
||||
|
||||
|
||||
## GitLab Pages
|
||||
|
||||
If you are deploying your master branch, include `.gitlab-ci.yml` with the following script:
|
||||
|
||||
?> The `.public` workaround is so `cp` doesn't also copy `public/` to itself in an infinite loop.
|
||||
|
||||
``` YAML
|
||||
pages:
|
||||
stage: deploy
|
||||
script:
|
||||
- mkdir .public
|
||||
- cp -r * .public
|
||||
- mv .public public
|
||||
artifacts:
|
||||
paths:
|
||||
- public
|
||||
only:
|
||||
- master
|
||||
```
|
||||
|
||||
!> You can replace script with `- cp -r docs/. public`, if `./docs` is your Docsify subfolder.
|
||||
|
||||
|
||||
## VPS
|
||||
|
||||
Verwende folgende nginx config.
|
||||
|
||||
@@ -100,3 +100,19 @@ Medium's Bilderzoom. Basierend auf [zoom-image](https://github.com/egoist/zoom-i
|
||||
## Edit on github
|
||||
|
||||
Add `Edit on github` button on every pages. provided by 3rd party, check [document](https://github.com/njleonzhang/docsify-edit-on-github)
|
||||
|
||||
|
||||
## CodeSponsor
|
||||
|
||||
See https://codesponsor.io
|
||||
|
||||
|
||||
```html
|
||||
<script>
|
||||
window.$docsify = {
|
||||
codesponsor: 'id'
|
||||
}
|
||||
</script>
|
||||
<script src="//unpkg.com/docsify/lib/plugins/codesponsor.min.js"></script>
|
||||
```
|
||||
|
||||
|
||||
@@ -44,7 +44,8 @@ Wenn du `npm` nicht verwenden möchtest, oder Probleme bei der Installation des
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">dict.
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<meta charset="UTF-8">
|
||||
<link rel="stylesheet" href="//unpkg.com/docsify/themes/vue.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
+23
-1
@@ -1,6 +1,6 @@
|
||||
# Deploy
|
||||
|
||||
Similar to [GitBook](https://www.gitbook.com), you can deploy files to GitHub Pages or VPS.
|
||||
Similar to [GitBook](https://www.gitbook.com), you can deploy files to GitHub Pages, GitLab Pages or VPS.
|
||||
|
||||
## GitHub Pages
|
||||
|
||||
@@ -16,6 +16,28 @@ 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`.
|
||||
|
||||
## GitLab Pages
|
||||
|
||||
If you are deploying your master branch, include `.gitlab-ci.yml` with the following script:
|
||||
|
||||
?> The `.public` workaround is so `cp` doesn't also copy `public/` to itself in an infinite loop.
|
||||
|
||||
``` YAML
|
||||
pages:
|
||||
stage: deploy
|
||||
script:
|
||||
- mkdir .public
|
||||
- cp -r * .public
|
||||
- mv .public public
|
||||
artifacts:
|
||||
paths:
|
||||
- public
|
||||
only:
|
||||
- master
|
||||
```
|
||||
|
||||
!> You can replace script with `- cp -r docs/. public`, if `./docs` is your Docsify subfolder.
|
||||
|
||||
## VPS
|
||||
|
||||
Try following nginx config.
|
||||
|
||||
+14
-9
@@ -4,13 +4,14 @@
|
||||
<meta charset="UTF-8">
|
||||
<title>docsify</title>
|
||||
<link rel="icon" href="_media/favicon.ico">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
|
||||
<meta name="keywords" content="doc,docs,documentation,gitbook,creator,generator,github,jekyll,github-pages">
|
||||
<meta name="description" content="A magical documentation generator.">
|
||||
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
|
||||
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/docsify@latest/lib/themes/vue.css" title="vue">
|
||||
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/docsify@latest/lib/themes/dark.css" title="dark" disabled>
|
||||
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/docsify@latest/lib/themes/buble.css" title="buble" disabled>
|
||||
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/docsify@latest/lib/themes/pure.css" title="pure" disabled>
|
||||
<link rel="stylesheet" href="//unpkg.com/docsify/lib/themes/vue.css" title="vue">
|
||||
<link rel="stylesheet" href="//unpkg.com/docsify/lib/themes/dark.css" title="dark" disabled>
|
||||
<link rel="stylesheet" href="//unpkg.com/docsify/lib/themes/buble.css" title="buble" disabled>
|
||||
<link rel="stylesheet" href="//unpkg.com/docsify/lib/themes/pure.css" title="pure" disabled>
|
||||
<style>
|
||||
nav.app-nav li ul {
|
||||
min-width: 100px;
|
||||
@@ -34,6 +35,8 @@
|
||||
mergeNavbar: true,
|
||||
maxLevel: 4,
|
||||
subMaxLevel: 2,
|
||||
codesponsor: '7c9Ms7xRs-j_y_8abU03DA',
|
||||
ga: 'UA-106147152-1',
|
||||
name: 'docsify',
|
||||
search: {
|
||||
noData: {
|
||||
@@ -65,9 +68,11 @@
|
||||
]
|
||||
}
|
||||
</script>
|
||||
<script src="//cdn.jsdelivr.net/npm/docsify@latest/lib/docsify.min.js"></script>
|
||||
<script src="//cdn.jsdelivr.net/npm/docsify@latest/lib/plugins/search.min.js"></script>
|
||||
<script src="//cdn.jsdelivr.net/npm/prismjs/components/prism-bash.min.js"></script>
|
||||
<script src="//cdn.jsdelivr.net/npm/prismjs/components/prism-markdown.min.js"></script>
|
||||
<script src="//cdn.jsdelivr.net/npm/prismjs/components/prism-nginx.min.js"></script>
|
||||
<script src="//unpkg.com/docsify/lib/docsify.min.js"></script>
|
||||
<script src="//unpkg.com/docsify/lib/plugins/search.min.js"></script>
|
||||
<script src="//unpkg.com/docsify/lib/plugins/codesponsor.min.js"></script>
|
||||
<script src="//unpkg.com/docsify/lib/plugins/ga.min.js"></script>
|
||||
<script src="//unpkg.com/prismjs/components/prism-bash.min.js"></script>
|
||||
<script src="//unpkg.com/prismjs/components/prism-markdown.min.js"></script>
|
||||
<script src="//unpkg.com/prismjs/components/prism-nginx.min.js"></script>
|
||||
</html>
|
||||
|
||||
@@ -100,3 +100,43 @@ Medium's Image Zoom. Based on [zoom-image](https://github.com/egoist/zoom-image)
|
||||
## 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)
|
||||
|
||||
## Demo code with instant preview and jsfiddle integration
|
||||
|
||||
With this plugin, sample code can be rendered on the page instantly, so that the readers can see the preview immediately.
|
||||
When readers expand the demo box, the source code and description are shown there. if they click the button `Try in Jsfiddle`,
|
||||
`jsfiddle.net` will be open with the code of this sample, which allow readers to revise the code and try on their own.
|
||||
|
||||
[Vue](https://njleonzhang.github.io/docsify-demo-box-vue/) and [React](https://njleonzhang.github.io/docsify-demo-box-react/) are both supported.
|
||||
|
||||
## CodeSponsor
|
||||
|
||||
See https://codesponsor.io
|
||||
|
||||
```html
|
||||
<script>
|
||||
window.$docsify = {
|
||||
codesponsor: 'id'
|
||||
}
|
||||
</script>
|
||||
<script src="//unpkg.com/docsify/lib/plugins/codesponsor.min.js"></script>
|
||||
```
|
||||
|
||||
## Copy to Clipboard
|
||||
|
||||
Add a simple `Click to copy` button to all preformatted code blocks to effortlessly allow users to copy example code from your docs.
|
||||
|
||||
```html
|
||||
<link rel="stylesheet" href="//unpkg.com/docsify-copy-code/styles.css">
|
||||
<script src="//unpkg.com/docsify-copy-code/index.js"></script>
|
||||
```
|
||||
|
||||
```javascript
|
||||
window.$docsify = {
|
||||
plugins: [
|
||||
window.DocsifyCopyCodePlugin.init()
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
See [here](https://github.com/jperasmus/docsify-copy-code/blob/master/README.md) for more details.
|
||||
|
||||
@@ -44,6 +44,7 @@ If you don't like `npm` or have trouble installing the tool, you can manually cr
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<meta charset="UTF-8">
|
||||
<link rel="stylesheet" href="//unpkg.com/docsify/themes/vue.css">
|
||||
</head>
|
||||
|
||||
+1
-1
@@ -28,7 +28,7 @@ Then you can immediately write Vue code at Markdown file. `new Vue({ el: '#main'
|
||||
<ul>
|
||||
<li v-for="i in 10">{{ i }}</li>
|
||||
</ul>
|
||||
``
|
||||
```
|
||||
|
||||
<ul>
|
||||
<li v-for="i in 10">{{ i }}</li>
|
||||
|
||||
@@ -15,6 +15,30 @@ GitHub Pages 支持从三个地方读取文件
|
||||
|
||||
!> 可以将文档放在根目录下,然后选择 **master 分支** 作为文档目录。
|
||||
|
||||
|
||||
## GitLab Pages
|
||||
|
||||
If you are deploying your master branch, include `.gitlab-ci.yml` with the following script:
|
||||
|
||||
?> The `.public` workaround is so `cp` doesn't also copy `public/` to itself in an infinite loop.
|
||||
|
||||
``` YAML
|
||||
pages:
|
||||
stage: deploy
|
||||
script:
|
||||
- mkdir .public
|
||||
- cp -r * .public
|
||||
- mv .public public
|
||||
artifacts:
|
||||
paths:
|
||||
- public
|
||||
only:
|
||||
- master
|
||||
```
|
||||
|
||||
!> You can replace script with `- cp -r docs/. public`, if `./docs` is your Docsify subfolder.
|
||||
|
||||
|
||||
## VPS
|
||||
|
||||
和部署所有静态网站一样,只需将服务器的访问根目录设定为 `index.html` 文件。
|
||||
|
||||
@@ -95,3 +95,19 @@ Medium's 风格的图片缩放插件. 基于 [zoom-image](https://github.com/ego
|
||||
## Edit on github
|
||||
|
||||
Add `Edit on github` button on every pages. provided by 3rd party, check [document](https://github.com/njleonzhang/docsify-edit-on-github)
|
||||
|
||||
|
||||
## CodeSponsor
|
||||
|
||||
See https://codesponsor.io
|
||||
|
||||
|
||||
```html
|
||||
<script>
|
||||
window.$docsify = {
|
||||
codesponsor: 'id'
|
||||
}
|
||||
</script>
|
||||
<script src="//unpkg.com/docsify/lib/plugins/codesponsor.min.js"></script>
|
||||
```
|
||||
|
||||
|
||||
@@ -44,6 +44,7 @@ docsify serve docs
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<meta charset="UTF-8">
|
||||
<link rel="stylesheet" href="//unpkg.com/docsify/themes/vue.css">
|
||||
</head>
|
||||
|
||||
+174
-141
@@ -22,23 +22,25 @@ var hyphenate = cached(function (str) {
|
||||
/**
|
||||
* Simple Object.assign polyfill
|
||||
*/
|
||||
var merge = Object.assign || function (to) {
|
||||
var arguments$1 = arguments;
|
||||
var merge =
|
||||
Object.assign ||
|
||||
function (to) {
|
||||
var arguments$1 = arguments;
|
||||
|
||||
var hasOwn = Object.prototype.hasOwnProperty;
|
||||
var hasOwn = Object.prototype.hasOwnProperty;
|
||||
|
||||
for (var i = 1; i < arguments.length; i++) {
|
||||
var from = Object(arguments$1[i]);
|
||||
for (var i = 1; i < arguments.length; i++) {
|
||||
var from = Object(arguments$1[i]);
|
||||
|
||||
for (var key in from) {
|
||||
if (hasOwn.call(from, key)) {
|
||||
to[key] = from[key];
|
||||
for (var key in from) {
|
||||
if (hasOwn.call(from, key)) {
|
||||
to[key] = from[key];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return to
|
||||
};
|
||||
return to
|
||||
};
|
||||
|
||||
/**
|
||||
* Check if value is primitive
|
||||
@@ -59,33 +61,38 @@ function isFn (obj) {
|
||||
return typeof obj === 'function'
|
||||
}
|
||||
|
||||
var config = merge({
|
||||
el: '#app',
|
||||
repo: '',
|
||||
maxLevel: 6,
|
||||
subMaxLevel: 0,
|
||||
loadSidebar: null,
|
||||
loadNavbar: null,
|
||||
homepage: 'README.md',
|
||||
coverpage: '',
|
||||
basePath: '',
|
||||
auto2top: false,
|
||||
name: '',
|
||||
themeColor: '',
|
||||
nameLink: window.location.pathname,
|
||||
autoHeader: false,
|
||||
executeScript: null,
|
||||
noEmoji: false,
|
||||
ga: '',
|
||||
mergeNavbar: false,
|
||||
formatUpdated: '',
|
||||
externalLinkTarget: '_blank',
|
||||
routerModel: 'hash',
|
||||
noCompileLinks: []
|
||||
}, window.$docsify);
|
||||
var config = merge(
|
||||
{
|
||||
el: '#app',
|
||||
repo: '',
|
||||
maxLevel: 6,
|
||||
subMaxLevel: 0,
|
||||
loadSidebar: null,
|
||||
loadNavbar: null,
|
||||
homepage: 'README.md',
|
||||
coverpage: '',
|
||||
basePath: '',
|
||||
auto2top: false,
|
||||
name: '',
|
||||
themeColor: '',
|
||||
nameLink: window.location.pathname,
|
||||
autoHeader: false,
|
||||
executeScript: null,
|
||||
noEmoji: false,
|
||||
ga: '',
|
||||
mergeNavbar: false,
|
||||
formatUpdated: '',
|
||||
externalLinkTarget: '_blank',
|
||||
routerMode: 'hash',
|
||||
noCompileLinks: []
|
||||
},
|
||||
window.$docsify
|
||||
);
|
||||
|
||||
var script = document.currentScript ||
|
||||
[].slice.call(document.getElementsByTagName('script'))
|
||||
var script =
|
||||
document.currentScript ||
|
||||
[].slice
|
||||
.call(document.getElementsByTagName('script'))
|
||||
.filter(function (n) { return /docsify\./.test(n.src); })[0];
|
||||
|
||||
if (script) {
|
||||
@@ -119,7 +126,7 @@ function initLifecycle (vm) {
|
||||
vm._hooks = {};
|
||||
vm._lifecycle = {};
|
||||
hooks.forEach(function (hook) {
|
||||
var arr = vm._hooks[hook] = [];
|
||||
var arr = (vm._hooks[hook] = []);
|
||||
vm._lifecycle[hook] = function (fn) { return arr.push(fn); };
|
||||
});
|
||||
}
|
||||
@@ -238,6 +245,11 @@ function toggleClass (el, type, val) {
|
||||
el && el.classList[val ? type : 'toggle'](val || type);
|
||||
}
|
||||
|
||||
function style (content) {
|
||||
appendTo(head, create('style', content));
|
||||
}
|
||||
|
||||
|
||||
|
||||
var dom = Object.freeze({
|
||||
getNode: getNode,
|
||||
@@ -251,7 +263,8 @@ var dom = Object.freeze({
|
||||
before: before,
|
||||
on: on,
|
||||
off: off,
|
||||
toggleClass: toggleClass
|
||||
toggleClass: toggleClass,
|
||||
style: style
|
||||
});
|
||||
|
||||
var inBrowser = typeof window !== 'undefined';
|
||||
@@ -261,14 +274,20 @@ var isMobile = inBrowser && document.body.clientWidth <= 600;
|
||||
/**
|
||||
* @see https://github.com/MoOx/pjax/blob/master/lib/is-supported.js
|
||||
*/
|
||||
var supportsPushState = inBrowser && (function () {
|
||||
// Borrowed wholesale from https://github.com/defunkt/jquery-pjax
|
||||
return window.history &&
|
||||
window.history.pushState &&
|
||||
window.history.replaceState &&
|
||||
// pushState isn’t reliable on iOS until 5.
|
||||
!navigator.userAgent.match(/((iPod|iPhone|iPad).+\bOS\s+[1-4]\D|WebApps\/.+CFNetwork)/)
|
||||
})();
|
||||
var supportsPushState =
|
||||
inBrowser &&
|
||||
(function () {
|
||||
// Borrowed wholesale from https://github.com/defunkt/jquery-pjax
|
||||
return (
|
||||
window.history &&
|
||||
window.history.pushState &&
|
||||
window.history.replaceState &&
|
||||
// pushState isn’t reliable on iOS until 5.
|
||||
!navigator.userAgent.match(
|
||||
/((iPod|iPhone|iPad).+\bOS\s+[1-4]\D|WebApps\/.+CFNetwork)/
|
||||
)
|
||||
)
|
||||
})();
|
||||
|
||||
/**
|
||||
* Render github corner
|
||||
@@ -281,37 +300,40 @@ function corner (data) {
|
||||
data = data.replace(/^git\+/, '');
|
||||
|
||||
return (
|
||||
"<a href=\"" + data + "\" class=\"github-corner\" aria-label=\"View source on Github\">" +
|
||||
"<a href=\"" + data + "\" class=\"github-corner\" aria-label=\"View source on Github\">" +
|
||||
'<svg viewBox="0 0 250 250" aria-hidden="true">' +
|
||||
'<path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z"></path>' +
|
||||
'<path d="M128.3,109.0 C113.8,99.7 119.0,89.6 119.0,89.6 C122.0,82.7 120.5,78.6 120.5,78.6 C119.2,72.0 123.4,76.3 123.4,76.3 C127.3,80.9 125.5,87.3 125.5,87.3 C122.9,97.6 130.6,101.9 134.4,103.2" fill="currentColor" style="transform-origin: 130px 106px;" class="octo-arm"></path>' +
|
||||
'<path d="M115.0,115.0 C114.9,115.1 118.7,116.5 119.8,115.4 L133.7,101.6 C136.9,99.2 139.9,98.4 142.2,98.6 C133.8,88.0 127.5,74.4 143.8,58.0 C148.5,53.4 154.0,51.2 159.7,51.0 C160.3,49.4 163.2,43.6 171.4,40.1 C171.4,40.1 176.1,42.5 178.8,56.2 C183.1,58.6 187.2,61.8 190.9,65.4 C194.5,69.0 197.7,73.2 200.1,77.6 C213.8,80.2 216.3,84.9 216.3,84.9 C212.7,93.1 206.9,96.0 205.4,96.6 C205.1,102.4 203.0,107.8 198.3,112.5 C181.9,128.9 168.3,122.5 157.7,114.1 C157.9,116.9 156.7,120.9 152.7,124.9 L141.0,136.5 C139.8,137.7 141.6,141.9 141.8,141.8 Z" fill="currentColor" class="octo-body"></path>' +
|
||||
'<path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z"></path>' +
|
||||
'<path d="M128.3,109.0 C113.8,99.7 119.0,89.6 119.0,89.6 C122.0,82.7 120.5,78.6 120.5,78.6 C119.2,72.0 123.4,76.3 123.4,76.3 C127.3,80.9 125.5,87.3 125.5,87.3 C122.9,97.6 130.6,101.9 134.4,103.2" fill="currentColor" style="transform-origin: 130px 106px;" class="octo-arm"></path>' +
|
||||
'<path d="M115.0,115.0 C114.9,115.1 118.7,116.5 119.8,115.4 L133.7,101.6 C136.9,99.2 139.9,98.4 142.2,98.6 C133.8,88.0 127.5,74.4 143.8,58.0 C148.5,53.4 154.0,51.2 159.7,51.0 C160.3,49.4 163.2,43.6 171.4,40.1 C171.4,40.1 176.1,42.5 178.8,56.2 C183.1,58.6 187.2,61.8 190.9,65.4 C194.5,69.0 197.7,73.2 200.1,77.6 C213.8,80.2 216.3,84.9 216.3,84.9 C212.7,93.1 206.9,96.0 205.4,96.6 C205.1,102.4 203.0,107.8 198.3,112.5 C181.9,128.9 168.3,122.5 157.7,114.1 C157.9,116.9 156.7,120.9 152.7,124.9 L141.0,136.5 C139.8,137.7 141.6,141.9 141.8,141.8 Z" fill="currentColor" class="octo-body"></path>' +
|
||||
'</svg>' +
|
||||
'</a>')
|
||||
'</a>'
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* Render main content
|
||||
*/
|
||||
function main (config) {
|
||||
var aside = (
|
||||
var aside =
|
||||
'<button class="sidebar-toggle">' +
|
||||
'<div class="sidebar-toggle-button">' +
|
||||
'<span></span><span></span><span></span>' +
|
||||
'</div>' +
|
||||
'<div class="sidebar-toggle-button">' +
|
||||
'<span></span><span></span><span></span>' +
|
||||
'</div>' +
|
||||
'</button>' +
|
||||
'<aside class="sidebar">' +
|
||||
(config.name
|
||||
? ("<h1><a class=\"app-name-link\" data-nosearch>" + (config.name) + "</a></h1>")
|
||||
: '') +
|
||||
'<div class="sidebar-nav"><!--sidebar--></div>' +
|
||||
'</aside>');
|
||||
(config.name
|
||||
? ("<h1><a class=\"app-name-link\" data-nosearch>" + (config.name) + "</a></h1>")
|
||||
: '') +
|
||||
'<div class="sidebar-nav"><!--sidebar--></div>' +
|
||||
'</aside>';
|
||||
|
||||
return (isMobile ? (aside + "<main>") : ("<main>" + aside)) +
|
||||
'<section class="content">' +
|
||||
'<article class="markdown-section" id="main"><!--main--></article>' +
|
||||
'</section>' +
|
||||
return (
|
||||
(isMobile ? (aside + "<main>") : ("<main>" + aside)) +
|
||||
'<section class="content">' +
|
||||
'<article class="markdown-section" id="main"><!--main--></article>' +
|
||||
'</section>' +
|
||||
'</main>'
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -319,14 +341,17 @@ function main (config) {
|
||||
*/
|
||||
function cover () {
|
||||
var SL = ', 100%, 85%';
|
||||
var bgc = 'linear-gradient(to left bottom, ' +
|
||||
"hsl(" + (Math.floor(Math.random() * 255) + SL) + ") 0%," +
|
||||
"hsl(" + (Math.floor(Math.random() * 255) + SL) + ") 100%)";
|
||||
var bgc =
|
||||
'linear-gradient(to left bottom, ' +
|
||||
"hsl(" + (Math.floor(Math.random() * 255) + SL) + ") 0%," +
|
||||
"hsl(" + (Math.floor(Math.random() * 255) + SL) + ") 100%)";
|
||||
|
||||
return "<section class=\"cover\" style=\"background: " + bgc + "\">" +
|
||||
return (
|
||||
"<section class=\"cover\" style=\"background: " + bgc + "\">" +
|
||||
'<div class="cover-main"></div>' +
|
||||
'<div class="mask"></div>' +
|
||||
'</section>'
|
||||
'</section>'
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -431,9 +456,12 @@ function get (url, hasBar) {
|
||||
if ( error === void 0 ) error = noop;
|
||||
|
||||
if (hasBar) {
|
||||
var id = setInterval(function (_) { return progressbar({
|
||||
step: Math.floor(Math.random() * 5 + 1)
|
||||
}); }, 500);
|
||||
var id = setInterval(
|
||||
function (_) { return progressbar({
|
||||
step: Math.floor(Math.random() * 5 + 1)
|
||||
}); },
|
||||
500
|
||||
);
|
||||
|
||||
on('progress', progressbar);
|
||||
on('loadend', function (evt) {
|
||||
@@ -449,12 +477,12 @@ function get (url, hasBar) {
|
||||
if (target.status >= 400) {
|
||||
error(target);
|
||||
} else {
|
||||
var result = cache[url] = {
|
||||
var result = (cache[url] = {
|
||||
content: target.response,
|
||||
opt: {
|
||||
updatedAt: xhr.getResponseHeader('last-modified')
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
success(result.content, result.opt);
|
||||
}
|
||||
@@ -465,15 +493,15 @@ function get (url, hasBar) {
|
||||
}
|
||||
|
||||
function replaceVar (block, color) {
|
||||
block.innerHTML = block.innerHTML
|
||||
.replace(/var\(\s*--theme-color.*?\)/g, color);
|
||||
block.innerHTML = block.innerHTML.replace(
|
||||
/var\(\s*--theme-color.*?\)/g,
|
||||
color
|
||||
);
|
||||
}
|
||||
|
||||
var cssVars = function (color) {
|
||||
// Variable support
|
||||
if (window.CSS &&
|
||||
window.CSS.supports &&
|
||||
window.CSS.supports('(--v:red)')) { return }
|
||||
if (window.CSS && window.CSS.supports && window.CSS.supports('(--v:red)')) { return }
|
||||
|
||||
var styleBlocks = findAll('style:not(.inserted),link');[].forEach.call(styleBlocks, function (block) {
|
||||
if (block.nodeName === 'STYLE') {
|
||||
@@ -484,10 +512,10 @@ var cssVars = function (color) {
|
||||
if (!/\.css$/.test(href)) { return }
|
||||
|
||||
get(href).then(function (res) {
|
||||
var style = create('style', res);
|
||||
var style$$1 = create('style', res);
|
||||
|
||||
head.appendChild(style);
|
||||
replaceVar(style, color);
|
||||
head.appendChild(style$$1);
|
||||
replaceVar(style$$1, color);
|
||||
});
|
||||
}
|
||||
});
|
||||
@@ -2666,10 +2694,16 @@ function genTree (toc, maxLevel) {
|
||||
var cache$1 = {};
|
||||
var re = /[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,.\/:;<=>?@\[\]^`{|}~]/g;
|
||||
|
||||
function lower (string) {
|
||||
return string.toLowerCase()
|
||||
}
|
||||
|
||||
function slugify (str) {
|
||||
if (typeof str !== 'string') { return '' }
|
||||
|
||||
var slug = str.toLowerCase().trim()
|
||||
var slug = str
|
||||
.trim()
|
||||
.replace(/[A-Z]+/g, lower)
|
||||
.replace(/<[^>\d]+>/g, '')
|
||||
.replace(re, '')
|
||||
.replace(/\s/g, '-')
|
||||
@@ -2677,7 +2711,7 @@ function slugify (str) {
|
||||
.replace(/^(\d)/, '_$1');
|
||||
var count = cache$1[slug];
|
||||
|
||||
count = cache$1.hasOwnProperty(slug) ? (count + 1) : 0;
|
||||
count = cache$1.hasOwnProperty(slug) ? count + 1 : 0;
|
||||
cache$1[slug] = count;
|
||||
|
||||
if (count) {
|
||||
@@ -2728,9 +2762,11 @@ function stringifyQuery (obj) {
|
||||
var qs = [];
|
||||
|
||||
for (var key in obj) {
|
||||
qs.push(obj[key]
|
||||
? ((encode(key)) + "=" + (encode(obj[key]))).toLowerCase()
|
||||
: encode(key));
|
||||
qs.push(
|
||||
obj[key]
|
||||
? ((encode(key)) + "=" + (encode(obj[key]))).toLowerCase()
|
||||
: encode(key)
|
||||
);
|
||||
}
|
||||
|
||||
return qs.length ? ("?" + (qs.join('&'))) : ''
|
||||
@@ -2750,15 +2786,11 @@ var isAbsolutePath = cached(function (path) {
|
||||
var getParentPath = cached(function (path) {
|
||||
return /\/$/g.test(path)
|
||||
? path
|
||||
: (path = path.match(/(\S*\/)[^\/]+$/))
|
||||
? path[1]
|
||||
: ''
|
||||
: (path = path.match(/(\S*\/)[^\/]+$/)) ? path[1] : ''
|
||||
});
|
||||
|
||||
var cleanPath = cached(function (path) {
|
||||
return path
|
||||
.replace(/^\/+/, '/')
|
||||
.replace(/([^:])\/{2,}/g, '$1/')
|
||||
return path.replace(/^\/+/, '/').replace(/([^:])\/{2,}/g, '$1/')
|
||||
});
|
||||
|
||||
var cachedLinks = {};
|
||||
@@ -2977,8 +3009,12 @@ function btn (el, router) {
|
||||
|
||||
var sidebar = getNode('.sidebar');
|
||||
|
||||
isMobile && on(body, 'click', function (_) { return body.classList.contains('close') && toggle(); }
|
||||
);
|
||||
isMobile &&
|
||||
on(
|
||||
body,
|
||||
'click',
|
||||
function (_) { return body.classList.contains('close') && toggle(); }
|
||||
);
|
||||
on(sidebar, 'click', function (_) { return setTimeout((function (_) { return getAndActive(router, sidebar, true, true); }, 0)); }
|
||||
);
|
||||
}
|
||||
@@ -3010,19 +3046,17 @@ function getAndActive (router, el, isParent, autoTitle) {
|
||||
var hash = router.toURL(router.getCurrentPath());
|
||||
var target;
|
||||
|
||||
links
|
||||
.sort(function (a, b) { return b.href.length - a.href.length; })
|
||||
.forEach(function (a) {
|
||||
var href = a.getAttribute('href');
|
||||
var node = isParent ? a.parentNode : a;
|
||||
links.sort(function (a, b) { return b.href.length - a.href.length; }).forEach(function (a) {
|
||||
var href = a.getAttribute('href');
|
||||
var node = isParent ? a.parentNode : a;
|
||||
|
||||
if (hash.indexOf(href) === 0 && !target) {
|
||||
target = a;
|
||||
toggleClass(node, 'add', 'active');
|
||||
} else {
|
||||
toggleClass(node, 'remove', 'active');
|
||||
}
|
||||
});
|
||||
if (hash.indexOf(href) === 0 && !target) {
|
||||
target = a;
|
||||
toggleClass(node, 'add', 'active');
|
||||
} else {
|
||||
toggleClass(node, 'remove', 'active');
|
||||
}
|
||||
});
|
||||
|
||||
if (autoTitle) {
|
||||
$.title = target ? ((target.innerText) + " - " + title) : title;
|
||||
@@ -3130,18 +3164,22 @@ var nav = {};
|
||||
var hoverOver = false;
|
||||
var scroller = null;
|
||||
var enableScrollEvent = true;
|
||||
var coverHeight = 0;
|
||||
|
||||
function scrollTo (el) {
|
||||
if (scroller) { scroller.stop(); }
|
||||
enableScrollEvent = false;
|
||||
scroller = new Tweezer({
|
||||
start: window.scrollY,
|
||||
end: el.getBoundingClientRect().top + window.scrollY,
|
||||
start: window.pageYOffset,
|
||||
end: el.getBoundingClientRect().top + window.pageYOffset,
|
||||
duration: 500
|
||||
})
|
||||
.on('tick', function (v) { return window.scrollTo(0, v); })
|
||||
.on('done', function () { enableScrollEvent = true; scroller = null; })
|
||||
.begin();
|
||||
.on('tick', function (v) { return window.scrollTo(0, v); })
|
||||
.on('done', function () {
|
||||
enableScrollEvent = true;
|
||||
scroller = null;
|
||||
})
|
||||
.begin();
|
||||
}
|
||||
|
||||
function highlight () {
|
||||
@@ -3151,7 +3189,7 @@ function highlight () {
|
||||
var wrap = find(sidebar, '.sidebar-nav');
|
||||
var active = find(sidebar, 'li.active');
|
||||
var doc = document.documentElement;
|
||||
var top = doc && doc.scrollTop || document.body.scrollTop;
|
||||
var top = ((doc && doc.scrollTop) || document.body.scrollTop) - coverHeight;
|
||||
var last;
|
||||
|
||||
for (var i = 0, len = anchors.length; i < len; i += 1) {
|
||||
@@ -3179,23 +3217,18 @@ function highlight () {
|
||||
var height = sidebar.clientHeight;
|
||||
var curOffset = 0;
|
||||
var cur = active.offsetTop + active.clientHeight + 40;
|
||||
var isInView = (
|
||||
active.offsetTop >= wrap.scrollTop &&
|
||||
cur <= wrap.scrollTop + height
|
||||
);
|
||||
var isInView =
|
||||
active.offsetTop >= wrap.scrollTop && cur <= wrap.scrollTop + height;
|
||||
var notThan = cur - curOffset < height;
|
||||
var top$1 = isInView
|
||||
? wrap.scrollTop
|
||||
: notThan
|
||||
? curOffset
|
||||
: cur - height;
|
||||
var top$1 = isInView ? wrap.scrollTop : notThan ? curOffset : cur - height;
|
||||
|
||||
sidebar.scrollTop = top$1;
|
||||
}
|
||||
}
|
||||
|
||||
function scrollActiveSidebar (router) {
|
||||
if (isMobile) { return }
|
||||
var cover = find('.cover.show');
|
||||
coverHeight = cover ? cover.offsetHeight : 0;
|
||||
|
||||
var sidebar = getNode('.sidebar');
|
||||
var lis = findAll(sidebar, 'li');
|
||||
@@ -3213,10 +3246,16 @@ function scrollActiveSidebar (router) {
|
||||
if (href) { nav[decodeURIComponent(href)] = li; }
|
||||
}
|
||||
|
||||
if (isMobile) { return }
|
||||
|
||||
off('scroll', highlight);
|
||||
on('scroll', highlight);
|
||||
on(sidebar, 'mouseover', function () { hoverOver = true; });
|
||||
on(sidebar, 'mouseleave', function () { hoverOver = false; });
|
||||
on(sidebar, 'mouseover', function () {
|
||||
hoverOver = true;
|
||||
});
|
||||
on(sidebar, 'mouseleave', function () {
|
||||
hoverOver = false;
|
||||
});
|
||||
}
|
||||
|
||||
function scrollIntoView (id) {
|
||||
@@ -3467,15 +3506,15 @@ function getAlias (path, alias, last) {
|
||||
return re.test(path) && path !== last
|
||||
})[0];
|
||||
|
||||
return match ? getAlias(path.replace(cached$1[match], alias[match]), alias, path) : path
|
||||
return match
|
||||
? getAlias(path.replace(cached$1[match], alias[match]), alias, path)
|
||||
: path
|
||||
}
|
||||
|
||||
function getFileName (path) {
|
||||
return /\.(md|html)$/g.test(path)
|
||||
? path
|
||||
: /\/$/g.test(path)
|
||||
? (path + "README.md")
|
||||
: (path + ".md")
|
||||
: /\/$/g.test(path) ? (path + "README.md") : (path + ".md")
|
||||
}
|
||||
|
||||
var History = function History (config) {
|
||||
@@ -3495,7 +3534,7 @@ History.prototype.getFile = function getFile (path, isRelative) {
|
||||
|
||||
path = config.alias ? getAlias(path, config.alias) : path;
|
||||
path = getFileName(path);
|
||||
path = path === '/README.md' ? (config.homepage || path) : path;
|
||||
path = path === '/README.md' ? config.homepage || path : path;
|
||||
path = isAbsolutePath(path) ? path : getPath(base, path);
|
||||
|
||||
if (isRelative) {
|
||||
@@ -3521,9 +3560,7 @@ History.prototype.toURL = function toURL () {};
|
||||
|
||||
function replaceHash (path) {
|
||||
var i = location.href.indexOf('#');
|
||||
location.replace(
|
||||
location.href.slice(0, i >= 0 ? i : 0) + '#' + path
|
||||
);
|
||||
location.replace(location.href.slice(0, i >= 0 ? i : 0) + '#' + path);
|
||||
}
|
||||
|
||||
var replaceSlug = cached(function (path) {
|
||||
@@ -3544,9 +3581,7 @@ var HashHistory = (function (History$$1) {
|
||||
var path = window.location.pathname || '';
|
||||
var base = this.config.basePath;
|
||||
|
||||
return /^(\/|https?:)/g.test(base)
|
||||
? base
|
||||
: cleanPath(path + '/' + base)
|
||||
return /^(\/|https?:)/g.test(base) ? base : cleanPath(path + '/' + base)
|
||||
};
|
||||
|
||||
HashHistory.prototype.getCurrentPath = function getCurrentPath () {
|
||||
@@ -3641,9 +3676,7 @@ var HTML5History = (function (History$$1) {
|
||||
if ( cb === void 0 ) cb = noop;
|
||||
|
||||
on('click', function (e) {
|
||||
var el = e.target.tagName === 'A'
|
||||
? e.target
|
||||
: e.target.parentNode;
|
||||
var el = e.target.tagName === 'A' ? e.target : e.target.parentNode;
|
||||
|
||||
if (el.tagName === 'A' && !/_blank/.test(el.target)) {
|
||||
e.preventDefault();
|
||||
@@ -3946,7 +3979,7 @@ initGlobalAPI();
|
||||
/**
|
||||
* Version
|
||||
*/
|
||||
Docsify.version = '4.3.2';
|
||||
Docsify.version = '4.3.9';
|
||||
|
||||
/**
|
||||
* Run Docsify
|
||||
|
||||
Vendored
+2
-2
File diff suppressed because one or more lines are too long
@@ -0,0 +1,64 @@
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
var DEFAULT_OPTIONS = {
|
||||
theme: 'light',
|
||||
image: 'show'
|
||||
};
|
||||
|
||||
function tpl (id, options) {
|
||||
var qs = [];
|
||||
|
||||
for (var key in options) {
|
||||
qs.push((key + "=" + (options[key])));
|
||||
}
|
||||
|
||||
var div = Docsify.dom.create('div');
|
||||
|
||||
Docsify.dom.toggleClass(div, 'codesponsor');
|
||||
div.innerHTML = "<iframe\n scrolling=0\n frameborder=0\n width=250\n height=250\n id=\"code-sponsor-embed-iframe\"\n src=\"https://app.codesponsor.io/widgets/" + id + "?" + (qs.join('&')) + "\">\n </iframe>";
|
||||
|
||||
return div
|
||||
}
|
||||
|
||||
function appIframe (id, opts) {
|
||||
var html = tpl(id, opts);
|
||||
|
||||
Docsify.dom.before(Docsify.dom.find('section.content'), html);
|
||||
}
|
||||
|
||||
function appendStyle () {
|
||||
Docsify.dom.style("\n .codesponsor {\n position: relative;\n float: right;\n right: 10px;\n top: 10px;\n }\n\n @media screen and (min-width: 1600px) {\n body.sticky .codesponsor {\n position: fixed;\n }\n\n .codesponsor {\n position: absolute;\n bottom: 10px;\n top: auto;\n float: none;\n }\n }\n ");
|
||||
}
|
||||
|
||||
var install = function (hook, vm) {
|
||||
var config = vm.config.codesponsor;
|
||||
var id;
|
||||
|
||||
if (typeof config === 'string') {
|
||||
id = config;
|
||||
config = {};
|
||||
} else {
|
||||
id = config.id;
|
||||
}
|
||||
|
||||
var opts = Docsify.util.merge(DEFAULT_OPTIONS, config);
|
||||
|
||||
if (!id) {
|
||||
throw Error('codesponsor plugin need id')
|
||||
}
|
||||
|
||||
if (Docsify.util.isMobile) {
|
||||
return
|
||||
}
|
||||
|
||||
// Append style
|
||||
hook.ready(function () {
|
||||
appendStyle();
|
||||
appIframe(id, opts);
|
||||
});
|
||||
};
|
||||
|
||||
window.$docsify.plugins = [].concat(install, window.$docsify.plugins);
|
||||
|
||||
}());
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
!function(){"use strict";function o(o,n){var i=[];for(var s in n)i.push(s+"="+n[s]);var e=Docsify.dom.create("div");return Docsify.dom.toggleClass(e,"codesponsor"),e.innerHTML='<iframe\n scrolling=0\n frameborder=0\n width=250\n height=250\n id="code-sponsor-embed-iframe"\n src="https://app.codesponsor.io/widgets/'+o+"?"+i.join("&")+'">\n </iframe>',e}function n(n,i){var s=o(n,i);Docsify.dom.before(Docsify.dom.find("section.content"),s)}function i(){Docsify.dom.style("\n .codesponsor {\n position: relative;\n float: right;\n right: 10px;\n top: 10px;\n }\n\n @media screen and (min-width: 1600px) {\n body.sticky .codesponsor {\n position: fixed;\n }\n\n .codesponsor {\n position: absolute;\n bottom: 10px;\n top: auto;\n float: none;\n }\n }\n ")}var s={theme:"light",image:"show"},e=function(o,e){var t,r=e.config.codesponsor;"string"==typeof r?(t=r,r={}):t=r.id;var c=Docsify.util.merge(s,r);if(!t)throw Error("codesponsor plugin need id");Docsify.util.isMobile||o.ready(function(){i(),n(t,c)})};window.$docsify.plugins=[].concat(e,window.$docsify.plugins)}();
|
||||
+893
-146
File diff suppressed because it is too large
Load Diff
+327
-331
@@ -32,386 +32,381 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* @namespace
|
||||
*/
|
||||
|
||||
|
||||
var errors = [];
|
||||
var reference_blocks = [];
|
||||
var processing_time = 0;
|
||||
var regex$1 =
|
||||
{
|
||||
"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("([^\\\'\\\"#]+([\\\'\\\"][^\\\'\\\"]*[\\\'\\\"])*)*(#.*)?")
|
||||
};
|
||||
var regex$1 = {
|
||||
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('([^\\\'\\"#]+([\\\'\\"][^\\\'\\"]*[\\\'\\"])*)*(#.*)?')
|
||||
};
|
||||
|
||||
/**
|
||||
/**
|
||||
* @class A block of lines of a given level.
|
||||
* @param {int} lvl The block's level.
|
||||
* @private
|
||||
*/
|
||||
function Block(lvl) {
|
||||
return {
|
||||
/* The block's parent */
|
||||
parent: null,
|
||||
/* Number of children */
|
||||
length: 0,
|
||||
/* Block's level */
|
||||
level: lvl,
|
||||
/* Lines of code to process */
|
||||
lines: [],
|
||||
/* Blocks with greater level */
|
||||
children : [],
|
||||
/* Add a block to the children collection */
|
||||
addChild : function(obj) {
|
||||
this.children.push(obj);
|
||||
obj.parent = this;
|
||||
++this.length;
|
||||
}
|
||||
};
|
||||
return {
|
||||
/* The block's parent */
|
||||
parent: null,
|
||||
/* Number of children */
|
||||
length: 0,
|
||||
/* Block's level */
|
||||
level: lvl,
|
||||
/* Lines of code to process */
|
||||
lines: [],
|
||||
/* Blocks with greater level */
|
||||
children: [],
|
||||
/* Add a block to the children collection */
|
||||
addChild: function(obj) {
|
||||
this.children.push(obj);
|
||||
obj.parent = this;
|
||||
++this.length;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function parser$1(str) {
|
||||
var regLevel = regex$1["regLevel"];
|
||||
var invalidLine = regex$1["invalidLine"];
|
||||
var lines = str.split("\n");
|
||||
var m;
|
||||
var level = 0, curLevel = 0;
|
||||
var regLevel = regex$1['regLevel'];
|
||||
var invalidLine = regex$1['invalidLine'];
|
||||
var lines = str.split('\n');
|
||||
var m;
|
||||
var level = 0,
|
||||
curLevel = 0;
|
||||
|
||||
var blocks = [];
|
||||
var blocks = [];
|
||||
|
||||
var result = new Block(-1);
|
||||
var currentBlock = new Block(0);
|
||||
result.addChild(currentBlock);
|
||||
var levels = [];
|
||||
var line = "";
|
||||
var result = new Block(-1);
|
||||
var currentBlock = new Block(0);
|
||||
result.addChild(currentBlock);
|
||||
var levels = [];
|
||||
var line = '';
|
||||
|
||||
blocks.push(currentBlock);
|
||||
levels.push(level);
|
||||
blocks.push(currentBlock);
|
||||
levels.push(level);
|
||||
|
||||
for(var i = 0, len = lines.length; i < len; ++i) {
|
||||
line = lines[i];
|
||||
for (var i = 0, len = lines.length; i < len; ++i) {
|
||||
line = lines[i];
|
||||
|
||||
if(line.match(invalidLine)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if(m = regLevel.exec(line)) {
|
||||
level = m[1].length;
|
||||
} else
|
||||
{ level = 0; }
|
||||
|
||||
if(level > curLevel) {
|
||||
var oldBlock = currentBlock;
|
||||
currentBlock = new Block(level);
|
||||
oldBlock.addChild(currentBlock);
|
||||
blocks.push(currentBlock);
|
||||
levels.push(level);
|
||||
} else if(level < curLevel) {
|
||||
var added = false;
|
||||
|
||||
var k = levels.length - 1;
|
||||
for(; k >= 0; --k) {
|
||||
if(levels[k] == level) {
|
||||
currentBlock = new Block(level);
|
||||
blocks.push(currentBlock);
|
||||
levels.push(level);
|
||||
if(blocks[k].parent!= null)
|
||||
{ blocks[k].parent.addChild(currentBlock); }
|
||||
added = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(!added) {
|
||||
errors.push("Error: Invalid indentation at line " + i + ": " + line);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
currentBlock.lines.push(line.replace(regex$1["trim"], ""));
|
||||
curLevel = level;
|
||||
if (line.match(invalidLine)) {
|
||||
continue
|
||||
}
|
||||
|
||||
return result;
|
||||
if ((m = regLevel.exec(line))) {
|
||||
level = m[1].length;
|
||||
} else { level = 0; }
|
||||
|
||||
if (level > curLevel) {
|
||||
var oldBlock = currentBlock;
|
||||
currentBlock = new Block(level);
|
||||
oldBlock.addChild(currentBlock);
|
||||
blocks.push(currentBlock);
|
||||
levels.push(level);
|
||||
} else if (level < curLevel) {
|
||||
var added = false;
|
||||
|
||||
var k = levels.length - 1;
|
||||
for (; k >= 0; --k) {
|
||||
if (levels[k] == level) {
|
||||
currentBlock = new Block(level);
|
||||
blocks.push(currentBlock);
|
||||
levels.push(level);
|
||||
if (blocks[k].parent != null) { blocks[k].parent.addChild(currentBlock); }
|
||||
added = true;
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if (!added) {
|
||||
errors.push('Error: Invalid indentation at line ' + i + ': ' + line);
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
currentBlock.lines.push(line.replace(regex$1['trim'], ''));
|
||||
curLevel = level;
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
function processValue(val) {
|
||||
val = val.replace(regex$1["trim"], "");
|
||||
var m = null;
|
||||
val = val.replace(regex$1['trim'], '');
|
||||
var m = null;
|
||||
|
||||
if(val == 'true') {
|
||||
return true;
|
||||
} else if(val == 'false') {
|
||||
return false;
|
||||
} else if(val == '.NaN') {
|
||||
return Number.NaN;
|
||||
} else if(val == 'null') {
|
||||
return null;
|
||||
} else if(val == '.inf') {
|
||||
return Number.POSITIVE_INFINITY;
|
||||
} else if(val == '-.inf') {
|
||||
return Number.NEGATIVE_INFINITY;
|
||||
} else if(m = val.match(regex$1["dashesString"])) {
|
||||
return m[1];
|
||||
} else if(m = val.match(regex$1["quotesString"])) {
|
||||
return m[1];
|
||||
} else if(m = val.match(regex$1["float"])) {
|
||||
return parseFloat(m[0]);
|
||||
} else if(m = val.match(regex$1["integer"])) {
|
||||
return parseInt(m[0]);
|
||||
} else if( !isNaN(m = Date.parse(val))) {
|
||||
return new Date(m);
|
||||
} else if(m = val.match(regex$1["single_key_value"])) {
|
||||
var res = {};
|
||||
res[m[1]] = processValue(m[2]);
|
||||
return res;
|
||||
} else if(m = val.match(regex$1["array"])){
|
||||
var count = 0, c = ' ';
|
||||
var res = [];
|
||||
var content = "";
|
||||
var str = false;
|
||||
for(var j = 0, lenJ = m[1].length; j < lenJ; ++j) {
|
||||
c = m[1][j];
|
||||
if(c == '\'' || c == '"') {
|
||||
if(str === false) {
|
||||
str = c;
|
||||
content += c;
|
||||
continue;
|
||||
} else if((c == '\'' && str == '\'') || (c == '"' && str == '"')) {
|
||||
str = false;
|
||||
content += c;
|
||||
continue;
|
||||
}
|
||||
} else if(str === false && (c == '[' || c == '{')) {
|
||||
++count;
|
||||
} else if(str === false && (c == ']' || c == '}')) {
|
||||
--count;
|
||||
} else if(str === false && count == 0 && c == ',') {
|
||||
res.push(processValue(content));
|
||||
content = "";
|
||||
continue;
|
||||
}
|
||||
|
||||
content += c;
|
||||
if (val == 'true') {
|
||||
return true
|
||||
} else if (val == 'false') {
|
||||
return false
|
||||
} else if (val == '.NaN') {
|
||||
return Number.NaN
|
||||
} else if (val == 'null') {
|
||||
return null
|
||||
} else if (val == '.inf') {
|
||||
return Number.POSITIVE_INFINITY
|
||||
} else if (val == '-.inf') {
|
||||
return Number.NEGATIVE_INFINITY
|
||||
} else if ((m = val.match(regex$1['dashesString']))) {
|
||||
return m[1]
|
||||
} else if ((m = val.match(regex$1['quotesString']))) {
|
||||
return m[1]
|
||||
} else if ((m = val.match(regex$1['float']))) {
|
||||
return parseFloat(m[0])
|
||||
} else if ((m = val.match(regex$1['integer']))) {
|
||||
return parseInt(m[0])
|
||||
} else if (!isNaN((m = Date.parse(val)))) {
|
||||
return new Date(m)
|
||||
} else if ((m = val.match(regex$1['single_key_value']))) {
|
||||
var res = {};
|
||||
res[m[1]] = processValue(m[2]);
|
||||
return res
|
||||
} else if ((m = val.match(regex$1['array']))) {
|
||||
var count = 0,
|
||||
c = ' ';
|
||||
var res = [];
|
||||
var content = '';
|
||||
var str = false;
|
||||
for (var j = 0, lenJ = m[1].length; j < lenJ; ++j) {
|
||||
c = m[1][j];
|
||||
if (c == "'" || c == '"') {
|
||||
if (str === false) {
|
||||
str = c;
|
||||
content += c;
|
||||
continue
|
||||
} else if ((c == "'" && str == "'") || (c == '"' && str == '"')) {
|
||||
str = false;
|
||||
content += c;
|
||||
continue
|
||||
}
|
||||
} else if (str === false && (c == '[' || c == '{')) {
|
||||
++count;
|
||||
} else if (str === false && (c == ']' || c == '}')) {
|
||||
--count;
|
||||
} else if (str === false && count == 0 && c == ',') {
|
||||
res.push(processValue(content));
|
||||
content = '';
|
||||
continue
|
||||
}
|
||||
|
||||
if(content.length > 0)
|
||||
{ res.push(processValue(content)); }
|
||||
return res;
|
||||
} else if(m = val.match(regex$1["map"])){
|
||||
var count = 0, c = ' ';
|
||||
var res = [];
|
||||
var content = "";
|
||||
var str = false;
|
||||
for(var j = 0, lenJ = m[1].length; j < lenJ; ++j) {
|
||||
c = m[1][j];
|
||||
if(c == '\'' || c == '"') {
|
||||
if(str === false) {
|
||||
str = c;
|
||||
content += c;
|
||||
continue;
|
||||
} else if((c == '\'' && str == '\'') || (c == '"' && str == '"')) {
|
||||
str = false;
|
||||
content += c;
|
||||
continue;
|
||||
}
|
||||
} else if(str === false && (c == '[' || c == '{')) {
|
||||
++count;
|
||||
} else if(str === false && (c == ']' || c == '}')) {
|
||||
--count;
|
||||
} else if(str === false && count == 0 && c == ',') {
|
||||
res.push(content);
|
||||
content = "";
|
||||
continue;
|
||||
}
|
||||
content += c;
|
||||
}
|
||||
|
||||
content += c;
|
||||
if (content.length > 0) { res.push(processValue(content)); }
|
||||
return res
|
||||
} else if ((m = val.match(regex$1['map']))) {
|
||||
var count = 0,
|
||||
c = ' ';
|
||||
var res = [];
|
||||
var content = '';
|
||||
var str = false;
|
||||
for (var j = 0, lenJ = m[1].length; j < lenJ; ++j) {
|
||||
c = m[1][j];
|
||||
if (c == "'" || c == '"') {
|
||||
if (str === false) {
|
||||
str = c;
|
||||
content += c;
|
||||
continue
|
||||
} else if ((c == "'" && str == "'") || (c == '"' && str == '"')) {
|
||||
str = false;
|
||||
content += c;
|
||||
continue
|
||||
}
|
||||
} else if (str === false && (c == '[' || c == '{')) {
|
||||
++count;
|
||||
} else if (str === false && (c == ']' || c == '}')) {
|
||||
--count;
|
||||
} else if (str === false && count == 0 && c == ',') {
|
||||
res.push(content);
|
||||
content = '';
|
||||
continue
|
||||
}
|
||||
|
||||
if(content.length > 0)
|
||||
{ res.push(content); }
|
||||
content += c;
|
||||
}
|
||||
|
||||
var newRes = {};
|
||||
for(var j = 0, lenJ = res.length; j < lenJ; ++j) {
|
||||
if(m = res[j].match(regex$1["key_value"])) {
|
||||
newRes[m[1]] = processValue(m[2]);
|
||||
}
|
||||
}
|
||||
if (content.length > 0) { res.push(content); }
|
||||
|
||||
return newRes;
|
||||
} else
|
||||
{ return val; }
|
||||
var newRes = {};
|
||||
for (var j = 0, lenJ = res.length; j < lenJ; ++j) {
|
||||
if ((m = res[j].match(regex$1['key_value']))) {
|
||||
newRes[m[1]] = processValue(m[2]);
|
||||
}
|
||||
}
|
||||
|
||||
return newRes
|
||||
} else { return val }
|
||||
}
|
||||
|
||||
function processFoldedBlock(block) {
|
||||
var lines = block.lines;
|
||||
var children = block.children;
|
||||
var str = lines.join(" ");
|
||||
var chunks = [str];
|
||||
for(var i = 0, len = children.length; i < len; ++i) {
|
||||
chunks.push(processFoldedBlock(children[i]));
|
||||
}
|
||||
return chunks.join("\n");
|
||||
var lines = block.lines;
|
||||
var children = block.children;
|
||||
var str = lines.join(' ');
|
||||
var chunks = [str];
|
||||
for (var i = 0, len = children.length; i < len; ++i) {
|
||||
chunks.push(processFoldedBlock(children[i]));
|
||||
}
|
||||
return chunks.join('\n')
|
||||
}
|
||||
|
||||
function processLiteralBlock(block) {
|
||||
var lines = block.lines;
|
||||
var children = block.children;
|
||||
var str = lines.join("\n");
|
||||
for(var i = 0, len = children.length; i < len; ++i) {
|
||||
str += processLiteralBlock(children[i]);
|
||||
}
|
||||
return str;
|
||||
var lines = block.lines;
|
||||
var children = block.children;
|
||||
var str = lines.join('\n');
|
||||
for (var i = 0, len = children.length; i < len; ++i) {
|
||||
str += processLiteralBlock(children[i]);
|
||||
}
|
||||
return str
|
||||
}
|
||||
|
||||
function processBlock(blocks) {
|
||||
var m = null;
|
||||
var res = {};
|
||||
var lines = null;
|
||||
var children = null;
|
||||
var currentObj = null;
|
||||
var m = null;
|
||||
var res = {};
|
||||
var lines = null;
|
||||
var children = null;
|
||||
var currentObj = null;
|
||||
|
||||
var level = -1;
|
||||
var level = -1;
|
||||
|
||||
var processedBlocks = [];
|
||||
var processedBlocks = [];
|
||||
|
||||
var isMap = true;
|
||||
var isMap = true;
|
||||
|
||||
for(var j = 0, lenJ = blocks.length; j < lenJ; ++j) {
|
||||
for (var j = 0, lenJ = blocks.length; j < lenJ; ++j) {
|
||||
if (level != -1 && level != blocks[j].level) { continue }
|
||||
|
||||
if(level != -1 && level != blocks[j].level)
|
||||
{ continue; }
|
||||
processedBlocks.push(j);
|
||||
|
||||
processedBlocks.push(j);
|
||||
level = blocks[j].level;
|
||||
lines = blocks[j].lines;
|
||||
children = blocks[j].children;
|
||||
currentObj = null;
|
||||
|
||||
level = blocks[j].level;
|
||||
lines = blocks[j].lines;
|
||||
children = blocks[j].children;
|
||||
currentObj = null;
|
||||
for (var i = 0, len = lines.length; i < len; ++i) {
|
||||
var line = lines[i];
|
||||
|
||||
for(var i = 0, len = lines.length; i < len; ++i) {
|
||||
var line = lines[i];
|
||||
if ((m = line.match(regex$1['key']))) {
|
||||
var key = m[1];
|
||||
|
||||
if(m = line.match(regex$1["key"])) {
|
||||
var key = m[1];
|
||||
|
||||
if(key[0] == '-') {
|
||||
key = key.replace(regex$1["item"], "");
|
||||
if (isMap) {
|
||||
isMap = false;
|
||||
if (typeof(res.length) === "undefined") {
|
||||
res = [];
|
||||
}
|
||||
}
|
||||
if(currentObj != null) { res.push(currentObj); }
|
||||
currentObj = {};
|
||||
isMap = true;
|
||||
}
|
||||
|
||||
if(typeof m[2] != "undefined") {
|
||||
var value = m[2].replace(regex$1["trim"], "");
|
||||
if(value[0] == '&') {
|
||||
var nb = processBlock(children);
|
||||
if(currentObj != null) { currentObj[key] = nb; }
|
||||
else { res[key] = nb; }
|
||||
reference_blocks[value.substr(1)] = nb;
|
||||
} else if(value[0] == '|') {
|
||||
if(currentObj != null) { currentObj[key] = processLiteralBlock(children.shift()); }
|
||||
else { res[key] = processLiteralBlock(children.shift()); }
|
||||
} else if(value[0] == '*') {
|
||||
var v = value.substr(1);
|
||||
var no = {};
|
||||
|
||||
if(typeof reference_blocks[v] == "undefined") {
|
||||
errors.push("Reference '" + v + "' not found!");
|
||||
} else {
|
||||
for(var k in reference_blocks[v]) {
|
||||
no[k] = reference_blocks[v][k];
|
||||
}
|
||||
|
||||
if(currentObj != null) { currentObj[key] = no; }
|
||||
else { res[key] = no; }
|
||||
}
|
||||
} else if(value[0] == '>') {
|
||||
if(currentObj != null) { currentObj[key] = processFoldedBlock(children.shift()); }
|
||||
else { res[key] = processFoldedBlock(children.shift()); }
|
||||
} else {
|
||||
if(currentObj != null) { currentObj[key] = processValue(value); }
|
||||
else { res[key] = processValue(value); }
|
||||
}
|
||||
} else {
|
||||
if(currentObj != null) { currentObj[key] = processBlock(children); }
|
||||
else { res[key] = processBlock(children); }
|
||||
}
|
||||
} else if(line.match(/^-\s*$/)) {
|
||||
if (isMap) {
|
||||
isMap = false;
|
||||
if (typeof(res.length) === "undefined") {
|
||||
res = [];
|
||||
}
|
||||
}
|
||||
if(currentObj != null) { res.push(currentObj); }
|
||||
currentObj = {};
|
||||
isMap = true;
|
||||
continue;
|
||||
} else if(m = line.match(/^-\s*(.*)/)) {
|
||||
if(currentObj != null)
|
||||
{ currentObj.push(processValue(m[1])); }
|
||||
else {
|
||||
if (isMap) {
|
||||
isMap = false;
|
||||
if (typeof(res.length) === "undefined") {
|
||||
res = [];
|
||||
}
|
||||
}
|
||||
res.push(processValue(m[1]));
|
||||
}
|
||||
continue;
|
||||
if (key[0] == '-') {
|
||||
key = key.replace(regex$1['item'], '');
|
||||
if (isMap) {
|
||||
isMap = false;
|
||||
if (typeof res.length === 'undefined') {
|
||||
res = [];
|
||||
}
|
||||
}
|
||||
if (currentObj != null) { res.push(currentObj); }
|
||||
currentObj = {};
|
||||
isMap = true;
|
||||
}
|
||||
|
||||
if(currentObj != null) {
|
||||
if (isMap) {
|
||||
isMap = false;
|
||||
if (typeof(res.length) === "undefined") {
|
||||
res = [];
|
||||
}
|
||||
if (typeof m[2] != 'undefined') {
|
||||
var value = m[2].replace(regex$1['trim'], '');
|
||||
if (value[0] == '&') {
|
||||
var nb = processBlock(children);
|
||||
if (currentObj != null) { currentObj[key] = nb; }
|
||||
else { res[key] = nb; }
|
||||
reference_blocks[value.substr(1)] = nb;
|
||||
} else if (value[0] == '|') {
|
||||
if (currentObj != null)
|
||||
{ currentObj[key] = processLiteralBlock(children.shift()); }
|
||||
else { res[key] = processLiteralBlock(children.shift()); }
|
||||
} else if (value[0] == '*') {
|
||||
var v = value.substr(1);
|
||||
var no = {};
|
||||
|
||||
if (typeof reference_blocks[v] == 'undefined') {
|
||||
errors.push("Reference '" + v + "' not found!");
|
||||
} else {
|
||||
for (var k in reference_blocks[v]) {
|
||||
no[k] = reference_blocks[v][k];
|
||||
}
|
||||
|
||||
if (currentObj != null) { currentObj[key] = no; }
|
||||
else { res[key] = no; }
|
||||
}
|
||||
res.push(currentObj);
|
||||
} else if (value[0] == '>') {
|
||||
if (currentObj != null)
|
||||
{ currentObj[key] = processFoldedBlock(children.shift()); }
|
||||
else { res[key] = processFoldedBlock(children.shift()); }
|
||||
} else {
|
||||
if (currentObj != null) { currentObj[key] = processValue(value); }
|
||||
else { res[key] = processValue(value); }
|
||||
}
|
||||
} else {
|
||||
if (currentObj != null) { currentObj[key] = processBlock(children); }
|
||||
else { res[key] = processBlock(children); }
|
||||
}
|
||||
} else if (line.match(/^-\s*$/)) {
|
||||
if (isMap) {
|
||||
isMap = false;
|
||||
if (typeof res.length === 'undefined') {
|
||||
res = [];
|
||||
}
|
||||
}
|
||||
if (currentObj != null) { res.push(currentObj); }
|
||||
currentObj = {};
|
||||
isMap = true;
|
||||
continue
|
||||
} else if ((m = line.match(/^-\s*(.*)/))) {
|
||||
if (currentObj != null) { currentObj.push(processValue(m[1])); }
|
||||
else {
|
||||
if (isMap) {
|
||||
isMap = false;
|
||||
if (typeof res.length === 'undefined') {
|
||||
res = [];
|
||||
}
|
||||
}
|
||||
res.push(processValue(m[1]));
|
||||
}
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
||||
for(var j = processedBlocks.length - 1; j >= 0; --j) {
|
||||
blocks.splice.call(blocks, processedBlocks[j], 1);
|
||||
if (currentObj != null) {
|
||||
if (isMap) {
|
||||
isMap = false;
|
||||
if (typeof res.length === 'undefined') {
|
||||
res = [];
|
||||
}
|
||||
}
|
||||
res.push(currentObj);
|
||||
}
|
||||
}
|
||||
|
||||
return res;
|
||||
for (var j = processedBlocks.length - 1; j >= 0; --j) {
|
||||
blocks.splice.call(blocks, processedBlocks[j], 1);
|
||||
}
|
||||
|
||||
return res
|
||||
}
|
||||
|
||||
function semanticAnalysis(blocks) {
|
||||
var res = processBlock(blocks.children);
|
||||
return res;
|
||||
var res = processBlock(blocks.children);
|
||||
return res
|
||||
}
|
||||
|
||||
function preProcess(src) {
|
||||
var m;
|
||||
var lines = src.split("\n");
|
||||
var m;
|
||||
var lines = src.split('\n');
|
||||
|
||||
var r = regex$1["comment"];
|
||||
var r = regex$1['comment'];
|
||||
|
||||
for(var i in lines) {
|
||||
if(m = lines[i].match(r)) {
|
||||
/* var cmt = "";
|
||||
for (var i in lines) {
|
||||
if ((m = lines[i].match(r))) {
|
||||
/* var cmt = "";
|
||||
if(typeof m[3] != "undefined")
|
||||
lines[i] = m[1];
|
||||
else if(typeof m[3] != "undefined")
|
||||
@@ -419,25 +414,25 @@ function preProcess(src) {
|
||||
else
|
||||
lines[i] = "";
|
||||
*/
|
||||
if(typeof m[3] !== "undefined") {
|
||||
lines[i] = m[0].substr(0, m[0].length - m[3].length);
|
||||
}
|
||||
}
|
||||
if (typeof m[3] !== 'undefined') {
|
||||
lines[i] = m[0].substr(0, m[0].length - m[3].length);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return lines.join("\n");
|
||||
return lines.join('\n')
|
||||
}
|
||||
|
||||
function load(str) {
|
||||
errors = [];
|
||||
reference_blocks = [];
|
||||
processing_time = (new Date()).getTime();
|
||||
var pre = preProcess(str);
|
||||
var doc = parser$1(pre);
|
||||
var res = semanticAnalysis(doc);
|
||||
processing_time = (new Date()).getTime() - processing_time;
|
||||
errors = [];
|
||||
reference_blocks = [];
|
||||
processing_time = new Date().getTime();
|
||||
var pre = preProcess(str);
|
||||
var doc = parser$1(pre);
|
||||
var res = semanticAnalysis(doc);
|
||||
processing_time = new Date().getTime() - processing_time;
|
||||
|
||||
return res;
|
||||
return res
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -445,7 +440,8 @@ function load(str) {
|
||||
*/
|
||||
/* eslint-disable */
|
||||
var optionalByteOrderMark = '\\ufeff?';
|
||||
var pattern = '^(' +
|
||||
var pattern =
|
||||
'^(' +
|
||||
optionalByteOrderMark +
|
||||
'(= yaml =|---)' +
|
||||
'$([\\s\\S]*?)' +
|
||||
@@ -457,7 +453,7 @@ var pattern = '^(' +
|
||||
// need to be moved down into the functions that use it.
|
||||
var regex = new RegExp(pattern, 'm');
|
||||
|
||||
function extractor (string) {
|
||||
function extractor(string) {
|
||||
string = string || '';
|
||||
|
||||
var lines = string.split(/(\r?\n)/);
|
||||
@@ -468,7 +464,7 @@ function extractor (string) {
|
||||
}
|
||||
}
|
||||
|
||||
function parse (string) {
|
||||
function parse(string) {
|
||||
var match = regex.exec(string);
|
||||
|
||||
if (!match) {
|
||||
|
||||
+5
-3
@@ -11,9 +11,11 @@ function appendScript () {
|
||||
|
||||
function init (id) {
|
||||
appendScript();
|
||||
window.ga = window.ga || function () {
|
||||
(window.ga.q = window.ga.q || []).push(arguments);
|
||||
};
|
||||
window.ga =
|
||||
window.ga ||
|
||||
function () {
|
||||
(window.ga.q = window.ga.q || []).push(arguments);
|
||||
};
|
||||
window.ga.l = Number(new Date());
|
||||
window.ga('create', id, 'auto');
|
||||
}
|
||||
|
||||
@@ -171,8 +171,8 @@ var NO_DATA_TEXT = '';
|
||||
|
||||
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 .results-panel {\n display: none;\n}\n\n.search .results-panel.show {\n display: block;\n}\n\n.search input {\n outline: none;\n border: none;\n width: 100%;\n padding: 7px;\n line-height: 22px;\n font-size: 14px;\n -webkit-appearance: none;\n -moz-appearance: none;\n appearance: none;\n}\n\n.search h2 {\n font-size: 17px;\n margin: 10px 0;\n}\n\n.search a {\n text-decoration: none;\n color: inherit;\n}\n\n.search .matching-post {\n border-bottom: 1px solid #eee;\n}\n\n.search .matching-post:last-child {\n border-bottom: 0;\n}\n\n.search p {\n font-size: 14px;\n overflow: hidden;\n text-overflow: ellipsis;\n display: -webkit-box;\n -webkit-line-clamp: 2;\n -webkit-box-orient: vertical;\n}\n\n.search p.empty {\n text-align: center;\n}";
|
||||
var style = Docsify.dom.create('style', code);
|
||||
Docsify.dom.appendTo(Docsify.dom.head, style);
|
||||
|
||||
Docsify.dom.style(code);
|
||||
}
|
||||
|
||||
function tpl (opts, defaultValue) {
|
||||
@@ -180,7 +180,7 @@ function tpl (opts, defaultValue) {
|
||||
|
||||
var html =
|
||||
"<input type=\"search\" value=\"" + defaultValue + "\" />" +
|
||||
'<div class="results-panel"></div>' +
|
||||
'<div class="results-panel"></div>' +
|
||||
'</div>';
|
||||
var el = Docsify.dom.create('div', html);
|
||||
var aside = Docsify.dom.find('aside');
|
||||
@@ -215,8 +215,11 @@ function bindEvents () {
|
||||
|
||||
var timeId;
|
||||
// Prevent to Fold sidebar
|
||||
Docsify.dom.on($search, 'click',
|
||||
function (e) { return e.target.tagName !== 'A' && e.stopPropagation(); });
|
||||
Docsify.dom.on(
|
||||
$search,
|
||||
'click',
|
||||
function (e) { return e.target.tagName !== 'A' && e.stopPropagation(); }
|
||||
);
|
||||
Docsify.dom.on($input, 'input', function (e) {
|
||||
clearTimeout(timeId);
|
||||
timeId = setTimeout(function (_) { return doSearch(e.target.value.trim()); }, 100);
|
||||
|
||||
Vendored
+1
-1
@@ -1 +1 @@
|
||||
!function(){"use strict";function e(e){var n={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};return String(e).replace(/[&<>"'\/]/g,function(e){return n[e]})}function n(e){var n=[];return h.dom.findAll("a:not([data-nosearch])").map(function(t){var o=t.href,i=t.getAttribute("href"),r=e.parse(o).path;r&&-1===n.indexOf(r)&&!Docsify.util.isAbsolutePath(i)&&n.push(r)}),n}function t(e){localStorage.setItem("docsify.search.expires",Date.now()+e),localStorage.setItem("docsify.search.index",JSON.stringify(y))}function o(e,n,t,o){void 0===n&&(n="");var i,r=window.marked.lexer(n),a=window.Docsify.slugify,s={};return r.forEach(function(n){if("heading"===n.type&&n.depth<=o)i=t.toURL(e,{id:a(n.text)}),s[i]={slug:i,title:n.text,body:""};else{if(!i)return;s[i]?s[i].body?s[i].body+="\n"+(n.text||""):s[i].body=n.text:s[i]={slug:i,title:"",body:""}}}),a.clear(),s}function i(n){var t=[],o=[];Object.keys(y).forEach(function(e){o=o.concat(Object.keys(y[e]).map(function(n){return y[e][n]}))}),n=[].concat(n,n.trim().split(/[\s\-\,\\\/]+/));for(var i=0;i<o.length;i++)!function(i){var r=o[i],a=!1,s="",c=r.title&&r.title.trim(),f=r.body&&r.body.trim(),l=r.slug||"";if(c&&f&&(n.forEach(function(n,t){var o=new RegExp(n,"gi"),i=-1,r=-1;if(i=c&&c.search(o),r=f&&f.search(o),i<0&&r<0)a=!1;else{a=!0,r<0&&(r=0);var l=0,d=0;l=r<11?0:r-10,d=0===l?70:r+n.length+60,d>f.length&&(d=f.length);var p="..."+e(f).substring(l,d).replace(o,'<em class="search-keyword">'+n+"</em>")+"...";s+=p}}),a)){var d={title:e(c),content:s,url:l};t.push(d)}}(i);return t}function r(e,i){h=Docsify;var r="auto"===e.paths,a=localStorage.getItem("docsify.search.expires")<Date.now();if(y=JSON.parse(localStorage.getItem("docsify.search.index")),a)y={};else if(!r)return;var s=r?n(i.router):e.paths,c=s.length,f=0;s.forEach(function(n){if(y[n])return f++;h.get(i.router.getFile(n)).then(function(r){y[n]=o(n,r,i.router,e.depth),c===++f&&t(e.maxAge)})})}function a(){var e=Docsify.dom.create("style","\n.sidebar {\n padding-top: 0;\n}\n\n.search {\n margin-bottom: 20px;\n padding: 6px;\n border-bottom: 1px solid #eee;\n}\n\n.search .results-panel {\n display: none;\n}\n\n.search .results-panel.show {\n display: block;\n}\n\n.search input {\n outline: none;\n border: none;\n width: 100%;\n padding: 7px;\n line-height: 22px;\n font-size: 14px;\n -webkit-appearance: none;\n -moz-appearance: none;\n appearance: none;\n}\n\n.search h2 {\n font-size: 17px;\n margin: 10px 0;\n}\n\n.search a {\n text-decoration: none;\n color: inherit;\n}\n\n.search .matching-post {\n border-bottom: 1px solid #eee;\n}\n\n.search .matching-post:last-child {\n border-bottom: 0;\n}\n\n.search p {\n font-size: 14px;\n overflow: hidden;\n text-overflow: ellipsis;\n display: -webkit-box;\n -webkit-line-clamp: 2;\n -webkit-box-orient: vertical;\n}\n\n.search p.empty {\n text-align: center;\n}");Docsify.dom.appendTo(Docsify.dom.head,e)}function s(e,n){void 0===n&&(n="");var t='<input type="search" value="'+n+'" /><div class="results-panel"></div></div>',o=Docsify.dom.create("div",t),i=Docsify.dom.find("aside");Docsify.dom.toggleClass(o,"search"),Docsify.dom.before(i,o)}function c(e){var n=Docsify.dom.find("div.search"),t=Docsify.dom.find(n,".results-panel");if(!e)return t.classList.remove("show"),void(t.innerHTML="");var o=i(e),r="";o.forEach(function(e){r+='<div class="matching-post">\n<h2><a href="'+e.url+'">'+e.title+"</a></h2>\n<p>"+e.content+"</p>\n</div>"}),t.classList.add("show"),t.innerHTML=r||'<p class="empty">'+m+"</p>"}function f(){var e,n=Docsify.dom.find("div.search"),t=Docsify.dom.find(n,"input");Docsify.dom.on(n,"click",function(e){return"A"!==e.target.tagName&&e.stopPropagation()}),Docsify.dom.on(t,"input",function(n){clearTimeout(e),e=setTimeout(function(e){return c(n.target.value.trim())},100)})}function l(e,n){var t=Docsify.dom.getNode('.search input[type="search"]');if(t)if("string"==typeof e)t.placeholder=e;else{var o=Object.keys(e).filter(function(e){return n.indexOf(e)>-1})[0];t.placeholder=e[o]}}function d(e,n){if("string"==typeof e)m=e;else{var t=Object.keys(e).filter(function(e){return n.indexOf(e)>-1})[0];m=e[t]}}function p(e,n){var t=n.router.parse().query.s;a(),s(e,t),f(),t&&setTimeout(function(e){return c(t)},500)}function u(e,n){l(e.placeholder,n.route.path),d(e.noData,n.route.path)}var h,y={},m="",g={placeholder:"Type to search",noData:"No Results!",paths:"auto",depth:2,maxAge:864e5},v=function(e,n){var t=Docsify.util,o=n.config.search||g;Array.isArray(o)?g.paths=o:"object"==typeof o&&(g.paths=Array.isArray(o.paths)?o.paths:"auto",g.maxAge=t.isPrimitive(o.maxAge)?o.maxAge:g.maxAge,g.placeholder=o.placeholder||g.placeholder,g.noData=o.noData||g.noData,g.depth=o.depth||g.depth);var i="auto"===g.paths;e.mounted(function(e){p(g,n),!i&&r(g,n)}),e.doneEach(function(e){u(g,n),i&&r(g,n)})};$docsify.plugins=[].concat(v,$docsify.plugins)}();
|
||||
!function(){"use strict";function e(e){var n={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};return String(e).replace(/[&<>"'\/]/g,function(e){return n[e]})}function n(e){var n=[];return h.dom.findAll("a:not([data-nosearch])").map(function(t){var o=t.href,i=t.getAttribute("href"),r=e.parse(o).path;r&&-1===n.indexOf(r)&&!Docsify.util.isAbsolutePath(i)&&n.push(r)}),n}function t(e){localStorage.setItem("docsify.search.expires",Date.now()+e),localStorage.setItem("docsify.search.index",JSON.stringify(g))}function o(e,n,t,o){void 0===n&&(n="");var i,r=window.marked.lexer(n),a=window.Docsify.slugify,s={};return r.forEach(function(n){if("heading"===n.type&&n.depth<=o)i=t.toURL(e,{id:a(n.text)}),s[i]={slug:i,title:n.text,body:""};else{if(!i)return;s[i]?s[i].body?s[i].body+="\n"+(n.text||""):s[i].body=n.text:s[i]={slug:i,title:"",body:""}}}),a.clear(),s}function i(n){var t=[],o=[];Object.keys(g).forEach(function(e){o=o.concat(Object.keys(g[e]).map(function(n){return g[e][n]}))}),n=[].concat(n,n.trim().split(/[\s\-\,\\\/]+/));for(var i=0;i<o.length;i++)!function(i){var r=o[i],a=!1,s="",c=r.title&&r.title.trim(),l=r.body&&r.body.trim(),f=r.slug||"";if(c&&l&&(n.forEach(function(n,t){var o=new RegExp(n,"gi"),i=-1,r=-1;if(i=c&&c.search(o),r=l&&l.search(o),i<0&&r<0)a=!1;else{a=!0,r<0&&(r=0);var f=0,d=0;f=r<11?0:r-10,d=0===f?70:r+n.length+60,d>l.length&&(d=l.length);var p="..."+e(l).substring(f,d).replace(o,'<em class="search-keyword">'+n+"</em>")+"...";s+=p}}),a)){var d={title:e(c),content:s,url:f};t.push(d)}}(i);return t}function r(e,i){h=Docsify;var r="auto"===e.paths,a=localStorage.getItem("docsify.search.expires")<Date.now();if(g=JSON.parse(localStorage.getItem("docsify.search.index")),a)g={};else if(!r)return;var s=r?n(i.router):e.paths,c=s.length,l=0;s.forEach(function(n){if(g[n])return l++;h.get(i.router.getFile(n)).then(function(r){g[n]=o(n,r,i.router,e.depth),c===++l&&t(e.maxAge)})})}function a(){Docsify.dom.style("\n.sidebar {\n padding-top: 0;\n}\n\n.search {\n margin-bottom: 20px;\n padding: 6px;\n border-bottom: 1px solid #eee;\n}\n\n.search .results-panel {\n display: none;\n}\n\n.search .results-panel.show {\n display: block;\n}\n\n.search input {\n outline: none;\n border: none;\n width: 100%;\n padding: 7px;\n line-height: 22px;\n font-size: 14px;\n -webkit-appearance: none;\n -moz-appearance: none;\n appearance: none;\n}\n\n.search h2 {\n font-size: 17px;\n margin: 10px 0;\n}\n\n.search a {\n text-decoration: none;\n color: inherit;\n}\n\n.search .matching-post {\n border-bottom: 1px solid #eee;\n}\n\n.search .matching-post:last-child {\n border-bottom: 0;\n}\n\n.search p {\n font-size: 14px;\n overflow: hidden;\n text-overflow: ellipsis;\n display: -webkit-box;\n -webkit-line-clamp: 2;\n -webkit-box-orient: vertical;\n}\n\n.search p.empty {\n text-align: center;\n}")}function s(e,n){void 0===n&&(n="");var t='<input type="search" value="'+n+'" /><div class="results-panel"></div></div>',o=Docsify.dom.create("div",t),i=Docsify.dom.find("aside");Docsify.dom.toggleClass(o,"search"),Docsify.dom.before(i,o)}function c(e){var n=Docsify.dom.find("div.search"),t=Docsify.dom.find(n,".results-panel");if(!e)return t.classList.remove("show"),void(t.innerHTML="");var o=i(e),r="";o.forEach(function(e){r+='<div class="matching-post">\n<h2><a href="'+e.url+'">'+e.title+"</a></h2>\n<p>"+e.content+"</p>\n</div>"}),t.classList.add("show"),t.innerHTML=r||'<p class="empty">'+y+"</p>"}function l(){var e,n=Docsify.dom.find("div.search"),t=Docsify.dom.find(n,"input");Docsify.dom.on(n,"click",function(e){return"A"!==e.target.tagName&&e.stopPropagation()}),Docsify.dom.on(t,"input",function(n){clearTimeout(e),e=setTimeout(function(e){return c(n.target.value.trim())},100)})}function f(e,n){var t=Docsify.dom.getNode('.search input[type="search"]');if(t)if("string"==typeof e)t.placeholder=e;else{var o=Object.keys(e).filter(function(e){return n.indexOf(e)>-1})[0];t.placeholder=e[o]}}function d(e,n){if("string"==typeof e)y=e;else{var t=Object.keys(e).filter(function(e){return n.indexOf(e)>-1})[0];y=e[t]}}function p(e,n){var t=n.router.parse().query.s;a(),s(e,t),l(),t&&setTimeout(function(e){return c(t)},500)}function u(e,n){f(e.placeholder,n.route.path),d(e.noData,n.route.path)}var h,g={},y="",m={placeholder:"Type to search",noData:"No Results!",paths:"auto",depth:2,maxAge:864e5},v=function(e,n){var t=Docsify.util,o=n.config.search||m;Array.isArray(o)?m.paths=o:"object"==typeof o&&(m.paths=Array.isArray(o.paths)?o.paths:"auto",m.maxAge=t.isPrimitive(o.maxAge)?o.maxAge:m.maxAge,m.placeholder=o.placeholder||m.placeholder,m.noData=o.noData||m.noData,m.depth=o.depth||m.depth);var i="auto"===m.paths;e.mounted(function(e){p(m,n),!i&&r(m,n)}),e.doneEach(function(e){u(m,n),i&&r(m,n)})};$docsify.plugins=[].concat(v,$docsify.plugins)}();
|
||||
|
||||
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.3.2",
|
||||
"version": "4.3.9",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "docsify",
|
||||
"version": "4.3.2",
|
||||
"version": "4.3.9",
|
||||
"description": "A magical documentation generator.",
|
||||
"author": {
|
||||
"name": "qingwei-li",
|
||||
|
||||
@@ -13,7 +13,9 @@ function cwd (...args) {
|
||||
}
|
||||
|
||||
function mainTpl (config) {
|
||||
let html = `<nav class="app-nav${config.repo ? '' : ' no-badge'}"><!--navbar--></nav>`
|
||||
let html = `<nav class="app-nav${config.repo
|
||||
? ''
|
||||
: ' no-badge'}"><!--navbar--></nav>`
|
||||
|
||||
if (config.repo) {
|
||||
html += tpl.corner(config.repo)
|
||||
@@ -28,11 +30,7 @@ function mainTpl (config) {
|
||||
}
|
||||
|
||||
export default class Renderer {
|
||||
constructor ({
|
||||
template,
|
||||
config,
|
||||
cache
|
||||
}) {
|
||||
constructor ({ template, config, cache }) {
|
||||
this.html = template
|
||||
this.config = config = Object.assign({}, config, {
|
||||
routerMode: 'history'
|
||||
@@ -43,7 +41,10 @@ export default class Renderer {
|
||||
this.compiler = new Compiler(config, this.router)
|
||||
|
||||
this.router.getCurrentPath = () => this.url
|
||||
this._renderHtml('inject-config', `<script>window.$docsify = ${JSON.stringify(config)}</script>`)
|
||||
this._renderHtml(
|
||||
'inject-config',
|
||||
`<script>window.$docsify = ${JSON.stringify(config)}</script>`
|
||||
)
|
||||
this._renderHtml('inject-app', mainTpl(config))
|
||||
|
||||
this.template = this.html
|
||||
@@ -52,9 +53,7 @@ export default class Renderer {
|
||||
_getPath (url) {
|
||||
const file = this.router.getFile(url)
|
||||
|
||||
return isAbsolutePath(file)
|
||||
? file
|
||||
: cwd(`./${file}`)
|
||||
return isAbsolutePath(file) ? file : cwd(`./${file}`)
|
||||
}
|
||||
|
||||
async renderToString (url) {
|
||||
@@ -94,7 +93,8 @@ export default class Renderer {
|
||||
|
||||
switch (type) {
|
||||
case 'sidebar':
|
||||
html = this.compiler.sidebar(html, maxLevel) +
|
||||
html =
|
||||
this.compiler.sidebar(html, maxLevel) +
|
||||
`<script>window.__SUB_SIDEBAR__ = ${JSON.stringify(
|
||||
this.compiler.subSidebar(subMaxLevel)
|
||||
)}</script>`
|
||||
|
||||
+1
-1
@@ -37,5 +37,5 @@
|
||||
"integrity": "sha1-6DWIAbhrg7F1YNTjw4LXrvIQCUQ="
|
||||
}
|
||||
},
|
||||
"version": "4.3.2"
|
||||
"version": "4.3.9"
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "docsify-server-renderer",
|
||||
"version": "4.3.2",
|
||||
"version": "4.3.9",
|
||||
"description": "docsify server renderer",
|
||||
"author": {
|
||||
"name": "qingwei-li",
|
||||
|
||||
+31
-26
@@ -1,32 +1,37 @@
|
||||
import { merge, hyphenate, isPrimitive } from './util/core'
|
||||
|
||||
const config = merge({
|
||||
el: '#app',
|
||||
repo: '',
|
||||
maxLevel: 6,
|
||||
subMaxLevel: 0,
|
||||
loadSidebar: null,
|
||||
loadNavbar: null,
|
||||
homepage: 'README.md',
|
||||
coverpage: '',
|
||||
basePath: '',
|
||||
auto2top: false,
|
||||
name: '',
|
||||
themeColor: '',
|
||||
nameLink: window.location.pathname,
|
||||
autoHeader: false,
|
||||
executeScript: null,
|
||||
noEmoji: false,
|
||||
ga: '',
|
||||
mergeNavbar: false,
|
||||
formatUpdated: '',
|
||||
externalLinkTarget: '_blank',
|
||||
routerModel: 'hash',
|
||||
noCompileLinks: []
|
||||
}, window.$docsify)
|
||||
const config = merge(
|
||||
{
|
||||
el: '#app',
|
||||
repo: '',
|
||||
maxLevel: 6,
|
||||
subMaxLevel: 0,
|
||||
loadSidebar: null,
|
||||
loadNavbar: null,
|
||||
homepage: 'README.md',
|
||||
coverpage: '',
|
||||
basePath: '',
|
||||
auto2top: false,
|
||||
name: '',
|
||||
themeColor: '',
|
||||
nameLink: window.location.pathname,
|
||||
autoHeader: false,
|
||||
executeScript: null,
|
||||
noEmoji: false,
|
||||
ga: '',
|
||||
mergeNavbar: false,
|
||||
formatUpdated: '',
|
||||
externalLinkTarget: '_blank',
|
||||
routerMode: 'hash',
|
||||
noCompileLinks: []
|
||||
},
|
||||
window.$docsify
|
||||
)
|
||||
|
||||
const script = document.currentScript ||
|
||||
[].slice.call(document.getElementsByTagName('script'))
|
||||
const script =
|
||||
document.currentScript ||
|
||||
[].slice
|
||||
.call(document.getElementsByTagName('script'))
|
||||
.filter(n => /docsify\./.test(n.src))[0]
|
||||
|
||||
if (script) {
|
||||
|
||||
+23
-18
@@ -6,18 +6,22 @@ const nav = {}
|
||||
let hoverOver = false
|
||||
let scroller = null
|
||||
let enableScrollEvent = true
|
||||
let coverHeight = 0
|
||||
|
||||
function scrollTo (el) {
|
||||
if (scroller) scroller.stop()
|
||||
enableScrollEvent = false
|
||||
scroller = new Tweezer({
|
||||
start: window.scrollY,
|
||||
end: el.getBoundingClientRect().top + window.scrollY,
|
||||
start: window.pageYOffset,
|
||||
end: el.getBoundingClientRect().top + window.pageYOffset,
|
||||
duration: 500
|
||||
})
|
||||
.on('tick', v => window.scrollTo(0, v))
|
||||
.on('done', () => { enableScrollEvent = true; scroller = null })
|
||||
.begin()
|
||||
.on('tick', v => window.scrollTo(0, v))
|
||||
.on('done', () => {
|
||||
enableScrollEvent = true
|
||||
scroller = null
|
||||
})
|
||||
.begin()
|
||||
}
|
||||
|
||||
function highlight () {
|
||||
@@ -27,7 +31,7 @@ function highlight () {
|
||||
const wrap = dom.find(sidebar, '.sidebar-nav')
|
||||
let active = dom.find(sidebar, 'li.active')
|
||||
const doc = document.documentElement
|
||||
const top = doc && doc.scrollTop || document.body.scrollTop
|
||||
const top = ((doc && doc.scrollTop) || document.body.scrollTop) - coverHeight
|
||||
let last
|
||||
|
||||
for (let i = 0, len = anchors.length; i < len; i += 1) {
|
||||
@@ -55,23 +59,18 @@ function highlight () {
|
||||
const height = sidebar.clientHeight
|
||||
const curOffset = 0
|
||||
const cur = active.offsetTop + active.clientHeight + 40
|
||||
const isInView = (
|
||||
active.offsetTop >= wrap.scrollTop &&
|
||||
cur <= wrap.scrollTop + height
|
||||
)
|
||||
const isInView =
|
||||
active.offsetTop >= wrap.scrollTop && cur <= wrap.scrollTop + height
|
||||
const notThan = cur - curOffset < height
|
||||
const top = isInView
|
||||
? wrap.scrollTop
|
||||
: notThan
|
||||
? curOffset
|
||||
: cur - height
|
||||
const top = isInView ? wrap.scrollTop : notThan ? curOffset : cur - height
|
||||
|
||||
sidebar.scrollTop = top
|
||||
}
|
||||
}
|
||||
|
||||
export function scrollActiveSidebar (router) {
|
||||
if (isMobile) return
|
||||
const cover = dom.find('.cover.show')
|
||||
coverHeight = cover ? cover.offsetHeight : 0
|
||||
|
||||
const sidebar = dom.getNode('.sidebar')
|
||||
const lis = dom.findAll(sidebar, 'li')
|
||||
@@ -89,10 +88,16 @@ export function scrollActiveSidebar (router) {
|
||||
if (href) nav[decodeURIComponent(href)] = li
|
||||
}
|
||||
|
||||
if (isMobile) return
|
||||
|
||||
dom.off('scroll', highlight)
|
||||
dom.on('scroll', highlight)
|
||||
dom.on(sidebar, 'mouseover', () => { hoverOver = true })
|
||||
dom.on(sidebar, 'mouseleave', () => { hoverOver = false })
|
||||
dom.on(sidebar, 'mouseover', () => {
|
||||
hoverOver = true
|
||||
})
|
||||
dom.on(sidebar, 'mouseleave', () => {
|
||||
hoverOver = false
|
||||
})
|
||||
}
|
||||
|
||||
export function scrollIntoView (id) {
|
||||
|
||||
+16
-15
@@ -16,9 +16,12 @@ export function btn (el, router) {
|
||||
|
||||
const sidebar = dom.getNode('.sidebar')
|
||||
|
||||
isMobile && dom.on(dom.body, 'click', _ =>
|
||||
dom.body.classList.contains('close') && toggle()
|
||||
)
|
||||
isMobile &&
|
||||
dom.on(
|
||||
dom.body,
|
||||
'click',
|
||||
_ => dom.body.classList.contains('close') && toggle()
|
||||
)
|
||||
dom.on(sidebar, 'click', _ =>
|
||||
setTimeout((_ => getAndActive(router, sidebar, true, true), 0))
|
||||
)
|
||||
@@ -51,19 +54,17 @@ export function getAndActive (router, el, isParent, autoTitle) {
|
||||
const hash = router.toURL(router.getCurrentPath())
|
||||
let target
|
||||
|
||||
links
|
||||
.sort((a, b) => b.href.length - a.href.length)
|
||||
.forEach(a => {
|
||||
const href = a.getAttribute('href')
|
||||
const node = isParent ? a.parentNode : a
|
||||
links.sort((a, b) => b.href.length - a.href.length).forEach(a => {
|
||||
const href = a.getAttribute('href')
|
||||
const node = isParent ? a.parentNode : a
|
||||
|
||||
if (hash.indexOf(href) === 0 && !target) {
|
||||
target = a
|
||||
dom.toggleClass(node, 'add', 'active')
|
||||
} else {
|
||||
dom.toggleClass(node, 'remove', 'active')
|
||||
}
|
||||
})
|
||||
if (hash.indexOf(href) === 0 && !target) {
|
||||
target = a
|
||||
dom.toggleClass(node, 'add', 'active')
|
||||
} else {
|
||||
dom.toggleClass(node, 'remove', 'active')
|
||||
}
|
||||
})
|
||||
|
||||
if (autoTitle) {
|
||||
dom.$.title = target ? `${target.innerText} - ${title}` : title
|
||||
|
||||
@@ -26,9 +26,13 @@ export function get (url, hasBar = false) {
|
||||
return {
|
||||
then: function (success, error = noop) {
|
||||
if (hasBar) {
|
||||
const id = setInterval(_ => progressbar({
|
||||
step: Math.floor(Math.random() * 5 + 1)
|
||||
}), 500)
|
||||
const id = setInterval(
|
||||
_ =>
|
||||
progressbar({
|
||||
step: Math.floor(Math.random() * 5 + 1)
|
||||
}),
|
||||
500
|
||||
)
|
||||
|
||||
on('progress', progressbar)
|
||||
on('loadend', evt => {
|
||||
@@ -42,12 +46,12 @@ export function get (url, hasBar = false) {
|
||||
if (target.status >= 400) {
|
||||
error(target)
|
||||
} else {
|
||||
const result = cache[url] = {
|
||||
const result = (cache[url] = {
|
||||
content: target.response,
|
||||
opt: {
|
||||
updatedAt: xhr.getResponseHeader('last-modified')
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
success(result.content, result.opt)
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ export function initLifecycle (vm) {
|
||||
vm._hooks = {}
|
||||
vm._lifecycle = {}
|
||||
hooks.forEach(hook => {
|
||||
const arr = vm._hooks[hook] = []
|
||||
const arr = (vm._hooks[hook] = [])
|
||||
vm._lifecycle[hook] = fn => arr.push(fn)
|
||||
})
|
||||
}
|
||||
|
||||
@@ -1,10 +1,16 @@
|
||||
let cache = {}
|
||||
const re = /[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,.\/:;<=>?@\[\]^`{|}~]/g
|
||||
|
||||
function lower (string) {
|
||||
return string.toLowerCase()
|
||||
}
|
||||
|
||||
export function slugify (str) {
|
||||
if (typeof str !== 'string') return ''
|
||||
|
||||
let slug = str.toLowerCase().trim()
|
||||
let slug = str
|
||||
.trim()
|
||||
.replace(/[A-Z]+/g, lower)
|
||||
.replace(/<[^>\d]+>/g, '')
|
||||
.replace(re, '')
|
||||
.replace(/\s/g, '-')
|
||||
@@ -12,7 +18,7 @@ export function slugify (str) {
|
||||
.replace(/^(\d)/, '_$1')
|
||||
let count = cache[slug]
|
||||
|
||||
count = cache.hasOwnProperty(slug) ? (count + 1) : 0
|
||||
count = cache.hasOwnProperty(slug) ? count + 1 : 0
|
||||
cache[slug] = count
|
||||
|
||||
if (count) {
|
||||
|
||||
+29
-23
@@ -10,37 +10,40 @@ export function corner (data) {
|
||||
data = data.replace(/^git\+/, '')
|
||||
|
||||
return (
|
||||
`<a href="${data}" class="github-corner" aria-label="View source on Github">` +
|
||||
`<a href="${data}" class="github-corner" aria-label="View source on Github">` +
|
||||
'<svg viewBox="0 0 250 250" aria-hidden="true">' +
|
||||
'<path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z"></path>' +
|
||||
'<path d="M128.3,109.0 C113.8,99.7 119.0,89.6 119.0,89.6 C122.0,82.7 120.5,78.6 120.5,78.6 C119.2,72.0 123.4,76.3 123.4,76.3 C127.3,80.9 125.5,87.3 125.5,87.3 C122.9,97.6 130.6,101.9 134.4,103.2" fill="currentColor" style="transform-origin: 130px 106px;" class="octo-arm"></path>' +
|
||||
'<path d="M115.0,115.0 C114.9,115.1 118.7,116.5 119.8,115.4 L133.7,101.6 C136.9,99.2 139.9,98.4 142.2,98.6 C133.8,88.0 127.5,74.4 143.8,58.0 C148.5,53.4 154.0,51.2 159.7,51.0 C160.3,49.4 163.2,43.6 171.4,40.1 C171.4,40.1 176.1,42.5 178.8,56.2 C183.1,58.6 187.2,61.8 190.9,65.4 C194.5,69.0 197.7,73.2 200.1,77.6 C213.8,80.2 216.3,84.9 216.3,84.9 C212.7,93.1 206.9,96.0 205.4,96.6 C205.1,102.4 203.0,107.8 198.3,112.5 C181.9,128.9 168.3,122.5 157.7,114.1 C157.9,116.9 156.7,120.9 152.7,124.9 L141.0,136.5 C139.8,137.7 141.6,141.9 141.8,141.8 Z" fill="currentColor" class="octo-body"></path>' +
|
||||
'<path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z"></path>' +
|
||||
'<path d="M128.3,109.0 C113.8,99.7 119.0,89.6 119.0,89.6 C122.0,82.7 120.5,78.6 120.5,78.6 C119.2,72.0 123.4,76.3 123.4,76.3 C127.3,80.9 125.5,87.3 125.5,87.3 C122.9,97.6 130.6,101.9 134.4,103.2" fill="currentColor" style="transform-origin: 130px 106px;" class="octo-arm"></path>' +
|
||||
'<path d="M115.0,115.0 C114.9,115.1 118.7,116.5 119.8,115.4 L133.7,101.6 C136.9,99.2 139.9,98.4 142.2,98.6 C133.8,88.0 127.5,74.4 143.8,58.0 C148.5,53.4 154.0,51.2 159.7,51.0 C160.3,49.4 163.2,43.6 171.4,40.1 C171.4,40.1 176.1,42.5 178.8,56.2 C183.1,58.6 187.2,61.8 190.9,65.4 C194.5,69.0 197.7,73.2 200.1,77.6 C213.8,80.2 216.3,84.9 216.3,84.9 C212.7,93.1 206.9,96.0 205.4,96.6 C205.1,102.4 203.0,107.8 198.3,112.5 C181.9,128.9 168.3,122.5 157.7,114.1 C157.9,116.9 156.7,120.9 152.7,124.9 L141.0,136.5 C139.8,137.7 141.6,141.9 141.8,141.8 Z" fill="currentColor" class="octo-body"></path>' +
|
||||
'</svg>' +
|
||||
'</a>')
|
||||
'</a>'
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* Render main content
|
||||
*/
|
||||
export function main (config) {
|
||||
const aside = (
|
||||
const aside =
|
||||
'<button class="sidebar-toggle">' +
|
||||
'<div class="sidebar-toggle-button">' +
|
||||
'<span></span><span></span><span></span>' +
|
||||
'</div>' +
|
||||
'<div class="sidebar-toggle-button">' +
|
||||
'<span></span><span></span><span></span>' +
|
||||
'</div>' +
|
||||
'</button>' +
|
||||
'<aside class="sidebar">' +
|
||||
(config.name
|
||||
? `<h1><a class="app-name-link" data-nosearch>${config.name}</a></h1>`
|
||||
: '') +
|
||||
'<div class="sidebar-nav"><!--sidebar--></div>' +
|
||||
'</aside>')
|
||||
(config.name
|
||||
? `<h1><a class="app-name-link" data-nosearch>${config.name}</a></h1>`
|
||||
: '') +
|
||||
'<div class="sidebar-nav"><!--sidebar--></div>' +
|
||||
'</aside>'
|
||||
|
||||
return (isMobile ? `${aside}<main>` : `<main>${aside}`) +
|
||||
'<section class="content">' +
|
||||
'<article class="markdown-section" id="main"><!--main--></article>' +
|
||||
'</section>' +
|
||||
return (
|
||||
(isMobile ? `${aside}<main>` : `<main>${aside}`) +
|
||||
'<section class="content">' +
|
||||
'<article class="markdown-section" id="main"><!--main--></article>' +
|
||||
'</section>' +
|
||||
'</main>'
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -48,14 +51,17 @@ export function main (config) {
|
||||
*/
|
||||
export function cover () {
|
||||
const SL = ', 100%, 85%'
|
||||
const bgc = 'linear-gradient(to left bottom, ' +
|
||||
`hsl(${Math.floor(Math.random() * 255) + SL}) 0%,` +
|
||||
`hsl(${Math.floor(Math.random() * 255) + SL}) 100%)`
|
||||
const bgc =
|
||||
'linear-gradient(to left bottom, ' +
|
||||
`hsl(${Math.floor(Math.random() * 255) + SL}) 0%,` +
|
||||
`hsl(${Math.floor(Math.random() * 255) + SL}) 100%)`
|
||||
|
||||
return `<section class="cover" style="background: ${bgc}">` +
|
||||
return (
|
||||
`<section class="cover" style="background: ${bgc}">` +
|
||||
'<div class="cover-main"></div>' +
|
||||
'<div class="mask"></div>' +
|
||||
'</section>'
|
||||
'</section>'
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -4,20 +4,20 @@ import { noop } from '../../util/core'
|
||||
const cached = {}
|
||||
|
||||
function getAlias (path, alias, last) {
|
||||
const match = Object.keys(alias).filter((key) => {
|
||||
const match = Object.keys(alias).filter(key => {
|
||||
const re = cached[key] || (cached[key] = new RegExp(`^${key}$`))
|
||||
return re.test(path) && path !== last
|
||||
})[0]
|
||||
|
||||
return match ? getAlias(path.replace(cached[match], alias[match]), alias, path) : path
|
||||
return match
|
||||
? getAlias(path.replace(cached[match], alias[match]), alias, path)
|
||||
: path
|
||||
}
|
||||
|
||||
function getFileName (path) {
|
||||
return /\.(md|html)$/g.test(path)
|
||||
? path
|
||||
: /\/$/g.test(path)
|
||||
? `${path}README.md`
|
||||
: `${path}.md`
|
||||
: /\/$/g.test(path) ? `${path}README.md` : `${path}.md`
|
||||
}
|
||||
|
||||
export class History {
|
||||
@@ -37,7 +37,7 @@ export class History {
|
||||
|
||||
path = config.alias ? getAlias(path, config.alias) : path
|
||||
path = getFileName(path)
|
||||
path = path === '/README.md' ? (config.homepage || path) : path
|
||||
path = path === '/README.md' ? config.homepage || path : path
|
||||
path = isAbsolutePath(path) ? path : getPath(base, path)
|
||||
|
||||
if (isRelative) {
|
||||
|
||||
@@ -5,9 +5,7 @@ import { parseQuery, stringifyQuery, cleanPath } from '../util'
|
||||
|
||||
function replaceHash (path) {
|
||||
const i = location.href.indexOf('#')
|
||||
location.replace(
|
||||
location.href.slice(0, i >= 0 ? i : 0) + '#' + path
|
||||
)
|
||||
location.replace(location.href.slice(0, i >= 0 ? i : 0) + '#' + path)
|
||||
}
|
||||
|
||||
const replaceSlug = cached(path => {
|
||||
@@ -24,9 +22,7 @@ export class HashHistory extends History {
|
||||
const path = window.location.pathname || ''
|
||||
const base = this.config.basePath
|
||||
|
||||
return /^(\/|https?:)/g.test(base)
|
||||
? base
|
||||
: cleanPath(path + '/' + base)
|
||||
return /^(\/|https?:)/g.test(base) ? base : cleanPath(path + '/' + base)
|
||||
}
|
||||
|
||||
getCurrentPath () {
|
||||
|
||||
@@ -22,9 +22,7 @@ export class HTML5History extends History {
|
||||
|
||||
onchange (cb = noop) {
|
||||
on('click', e => {
|
||||
const el = e.target.tagName === 'A'
|
||||
? e.target
|
||||
: e.target.parentNode
|
||||
const el = e.target.tagName === 'A' ? e.target : e.target.parentNode
|
||||
|
||||
if (el.tagName === 'A' && !/_blank/.test(el.target)) {
|
||||
e.preventDefault()
|
||||
|
||||
@@ -26,9 +26,11 @@ export function stringifyQuery (obj) {
|
||||
const qs = []
|
||||
|
||||
for (const key in obj) {
|
||||
qs.push(obj[key]
|
||||
? `${encode(key)}=${encode(obj[key])}`.toLowerCase()
|
||||
: encode(key))
|
||||
qs.push(
|
||||
obj[key]
|
||||
? `${encode(key)}=${encode(obj[key])}`.toLowerCase()
|
||||
: encode(key)
|
||||
)
|
||||
}
|
||||
|
||||
return qs.length ? `?${qs.join('&')}` : ''
|
||||
@@ -45,13 +47,9 @@ export const isAbsolutePath = cached(path => {
|
||||
export const getParentPath = cached(path => {
|
||||
return /\/$/g.test(path)
|
||||
? path
|
||||
: (path = path.match(/(\S*\/)[^\/]+$/))
|
||||
? path[1]
|
||||
: ''
|
||||
: (path = path.match(/(\S*\/)[^\/]+$/)) ? path[1] : ''
|
||||
})
|
||||
|
||||
export const cleanPath = cached(path => {
|
||||
return path
|
||||
.replace(/^\/+/, '/')
|
||||
.replace(/([^:])\/{2,}/g, '$1/')
|
||||
return path.replace(/^\/+/, '/').replace(/([^:])\/{2,}/g, '$1/')
|
||||
})
|
||||
|
||||
+12
-10
@@ -19,21 +19,23 @@ export const hyphenate = cached(str => {
|
||||
/**
|
||||
* Simple Object.assign polyfill
|
||||
*/
|
||||
export const merge = Object.assign || function (to) {
|
||||
const hasOwn = Object.prototype.hasOwnProperty
|
||||
export const merge =
|
||||
Object.assign ||
|
||||
function (to) {
|
||||
const hasOwn = Object.prototype.hasOwnProperty
|
||||
|
||||
for (let i = 1; i < arguments.length; i++) {
|
||||
const from = Object(arguments[i])
|
||||
for (let i = 1; i < arguments.length; i++) {
|
||||
const from = Object(arguments[i])
|
||||
|
||||
for (const key in from) {
|
||||
if (hasOwn.call(from, key)) {
|
||||
to[key] = from[key]
|
||||
for (const key in from) {
|
||||
if (hasOwn.call(from, key)) {
|
||||
to[key] = from[key]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return to
|
||||
}
|
||||
return to
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if value is primitive
|
||||
|
||||
@@ -81,3 +81,8 @@ export function off (el, type, handler) {
|
||||
export function toggleClass (el, type, val) {
|
||||
el && el.classList[val ? type : 'toggle'](val || type)
|
||||
}
|
||||
|
||||
export function style (content) {
|
||||
appendTo(head, create('style', content))
|
||||
}
|
||||
|
||||
|
||||
+14
-8
@@ -5,11 +5,17 @@ export const isMobile = inBrowser && document.body.clientWidth <= 600
|
||||
/**
|
||||
* @see https://github.com/MoOx/pjax/blob/master/lib/is-supported.js
|
||||
*/
|
||||
export const supportsPushState = inBrowser && (function () {
|
||||
// Borrowed wholesale from https://github.com/defunkt/jquery-pjax
|
||||
return window.history &&
|
||||
window.history.pushState &&
|
||||
window.history.replaceState &&
|
||||
// pushState isn’t reliable on iOS until 5.
|
||||
!navigator.userAgent.match(/((iPod|iPhone|iPad).+\bOS\s+[1-4]\D|WebApps\/.+CFNetwork)/)
|
||||
})()
|
||||
export const supportsPushState =
|
||||
inBrowser &&
|
||||
(function () {
|
||||
// Borrowed wholesale from https://github.com/defunkt/jquery-pjax
|
||||
return (
|
||||
window.history &&
|
||||
window.history.pushState &&
|
||||
window.history.replaceState &&
|
||||
// pushState isn’t reliable on iOS until 5.
|
||||
!navigator.userAgent.match(
|
||||
/((iPod|iPhone|iPad).+\bOS\s+[1-4]\D|WebApps\/.+CFNetwork)/
|
||||
)
|
||||
)
|
||||
})()
|
||||
|
||||
@@ -2,18 +2,17 @@ import * as dom from '../dom'
|
||||
import { get } from '../../fetch/ajax'
|
||||
|
||||
function replaceVar (block, color) {
|
||||
block.innerHTML = block.innerHTML
|
||||
.replace(/var\(\s*--theme-color.*?\)/g, color)
|
||||
block.innerHTML = block.innerHTML.replace(
|
||||
/var\(\s*--theme-color.*?\)/g,
|
||||
color
|
||||
)
|
||||
}
|
||||
|
||||
export default function (color) {
|
||||
// Variable support
|
||||
if (window.CSS &&
|
||||
window.CSS.supports &&
|
||||
window.CSS.supports('(--v:red)')) return
|
||||
if (window.CSS && window.CSS.supports && window.CSS.supports('(--v:red)')) { return }
|
||||
|
||||
const styleBlocks = dom.findAll('style:not(.inserted),link')
|
||||
|
||||
;[].forEach.call(styleBlocks, block => {
|
||||
if (block.nodeName === 'STYLE') {
|
||||
replaceVar(block, color)
|
||||
|
||||
@@ -0,0 +1,86 @@
|
||||
const DEFAULT_OPTIONS = {
|
||||
theme: 'light',
|
||||
image: 'show'
|
||||
}
|
||||
|
||||
function tpl (id, options) {
|
||||
const qs = []
|
||||
|
||||
for (const key in options) {
|
||||
qs.push(`${key}=${options[key]}`)
|
||||
}
|
||||
|
||||
const div = Docsify.dom.create('div')
|
||||
|
||||
Docsify.dom.toggleClass(div, 'codesponsor')
|
||||
div.innerHTML = `<iframe
|
||||
scrolling=0
|
||||
frameborder=0
|
||||
width=250
|
||||
height=250
|
||||
id="code-sponsor-embed-iframe"
|
||||
src="https://app.codesponsor.io/widgets/${id}?${qs.join('&')}">
|
||||
</iframe>`
|
||||
|
||||
return div
|
||||
}
|
||||
|
||||
function appIframe (id, opts) {
|
||||
const html = tpl(id, opts)
|
||||
|
||||
Docsify.dom.before(Docsify.dom.find('section.content'), html)
|
||||
}
|
||||
|
||||
function appendStyle () {
|
||||
Docsify.dom.style(`
|
||||
.codesponsor {
|
||||
position: relative;
|
||||
float: right;
|
||||
right: 10px;
|
||||
top: 10px;
|
||||
}
|
||||
|
||||
@media screen and (min-width: 1600px) {
|
||||
body.sticky .codesponsor {
|
||||
position: fixed;
|
||||
}
|
||||
|
||||
.codesponsor {
|
||||
position: absolute;
|
||||
bottom: 10px;
|
||||
top: auto;
|
||||
float: none;
|
||||
}
|
||||
}
|
||||
`)
|
||||
}
|
||||
|
||||
const install = function (hook, vm) {
|
||||
let config = vm.config.codesponsor
|
||||
let id
|
||||
|
||||
if (typeof config === 'string') {
|
||||
id = config
|
||||
config = {}
|
||||
} else {
|
||||
id = config.id
|
||||
}
|
||||
|
||||
const opts = Docsify.util.merge(DEFAULT_OPTIONS, config)
|
||||
|
||||
if (!id) {
|
||||
throw Error('codesponsor plugin need id')
|
||||
}
|
||||
|
||||
if (Docsify.util.isMobile) {
|
||||
return
|
||||
}
|
||||
|
||||
// Append style
|
||||
hook.ready(() => {
|
||||
appendStyle()
|
||||
appIframe(id, opts)
|
||||
})
|
||||
}
|
||||
|
||||
window.$docsify.plugins = [].concat(install, window.$docsify.plugins)
|
||||
+893
-146
File diff suppressed because it is too large
Load Diff
@@ -5,7 +5,8 @@
|
||||
import parser from './yaml'
|
||||
|
||||
var optionalByteOrderMark = '\\ufeff?'
|
||||
var pattern = '^(' +
|
||||
var pattern =
|
||||
'^(' +
|
||||
optionalByteOrderMark +
|
||||
'(= yaml =|---)' +
|
||||
'$([\\s\\S]*?)' +
|
||||
@@ -17,7 +18,7 @@ var pattern = '^(' +
|
||||
// need to be moved down into the functions that use it.
|
||||
var regex = new RegExp(pattern, 'm')
|
||||
|
||||
function extractor (string) {
|
||||
function extractor(string) {
|
||||
string = string || ''
|
||||
|
||||
var lines = string.split(/(\r?\n)/)
|
||||
@@ -28,7 +29,7 @@ function extractor (string) {
|
||||
}
|
||||
}
|
||||
|
||||
function parse (string) {
|
||||
function parse(string) {
|
||||
var match = regex.exec(string)
|
||||
|
||||
if (!match) {
|
||||
@@ -45,10 +46,10 @@ function parse (string) {
|
||||
return { attributes: attributes, body: body, frontmatter: yaml }
|
||||
}
|
||||
|
||||
function test (string) {
|
||||
function test(string) {
|
||||
string = string || ''
|
||||
|
||||
return regex.test(string)
|
||||
}
|
||||
|
||||
export default extractor
|
||||
export default extractor
|
||||
|
||||
+350
-353
@@ -29,415 +29,412 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* @namespace
|
||||
*/
|
||||
|
||||
|
||||
var errors = [],
|
||||
reference_blocks = [],
|
||||
processing_time = 0,
|
||||
regex =
|
||||
{
|
||||
"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("([^\\\'\\\"#]+([\\\'\\\"][^\\\'\\\"]*[\\\'\\\"])*)*(#.*)?")
|
||||
};
|
||||
reference_blocks = [],
|
||||
processing_time = 0,
|
||||
regex = {
|
||||
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('([^\\\'\\"#]+([\\\'\\"][^\\\'\\"]*[\\\'\\"])*)*(#.*)?')
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* @class A block of lines of a given level.
|
||||
* @param {int} lvl The block's level.
|
||||
* @private
|
||||
*/
|
||||
function Block(lvl) {
|
||||
return {
|
||||
/* The block's parent */
|
||||
parent: null,
|
||||
/* Number of children */
|
||||
length: 0,
|
||||
/* Block's level */
|
||||
level: lvl,
|
||||
/* Lines of code to process */
|
||||
lines: [],
|
||||
/* Blocks with greater level */
|
||||
children : [],
|
||||
/* Add a block to the children collection */
|
||||
addChild : function(obj) {
|
||||
this.children.push(obj);
|
||||
obj.parent = this;
|
||||
++this.length;
|
||||
}
|
||||
};
|
||||
return {
|
||||
/* The block's parent */
|
||||
parent: null,
|
||||
/* Number of children */
|
||||
length: 0,
|
||||
/* Block's level */
|
||||
level: lvl,
|
||||
/* Lines of code to process */
|
||||
lines: [],
|
||||
/* Blocks with greater level */
|
||||
children: [],
|
||||
/* Add a block to the children collection */
|
||||
addChild: function(obj) {
|
||||
this.children.push(obj)
|
||||
obj.parent = this
|
||||
++this.length
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// function to create an XMLHttpClient in a cross-browser manner
|
||||
function createXMLHTTPRequest() {
|
||||
var xmlhttp;
|
||||
var xmlhttp
|
||||
|
||||
try {
|
||||
// Mozilla / Safari / IE7
|
||||
xmlhttp = new XMLHttpRequest();
|
||||
} catch (e) {
|
||||
// IE
|
||||
var XMLHTTP_IDS = new Array('MSXML2.XMLHTTP.5.0',
|
||||
'MSXML2.XMLHTTP.4.0',
|
||||
'MSXML2.XMLHTTP.3.0',
|
||||
'MSXML2.XMLHTTP',
|
||||
'Microsoft.XMLHTTP' );
|
||||
var success = false;
|
||||
for (var i=0;i < XMLHTTP_IDS.length && !success; i++) {
|
||||
try {
|
||||
xmlhttp = new ActiveXObject(XMLHTTP_IDS[i]);
|
||||
success = true;
|
||||
} catch (e) {}
|
||||
}
|
||||
if (!success) {
|
||||
throw new Error('Unable to create XMLHttpRequest.');
|
||||
}
|
||||
try {
|
||||
// Mozilla / Safari / IE7
|
||||
xmlhttp = new XMLHttpRequest()
|
||||
} catch (e) {
|
||||
// IE
|
||||
var XMLHTTP_IDS = new Array(
|
||||
'MSXML2.XMLHTTP.5.0',
|
||||
'MSXML2.XMLHTTP.4.0',
|
||||
'MSXML2.XMLHTTP.3.0',
|
||||
'MSXML2.XMLHTTP',
|
||||
'Microsoft.XMLHTTP'
|
||||
)
|
||||
var success = false
|
||||
for (var i = 0; i < XMLHTTP_IDS.length && !success; i++) {
|
||||
try {
|
||||
xmlhttp = new ActiveXObject(XMLHTTP_IDS[i])
|
||||
success = true
|
||||
} catch (e) {}
|
||||
}
|
||||
if (!success) {
|
||||
throw new Error('Unable to create XMLHttpRequest.')
|
||||
}
|
||||
}
|
||||
|
||||
return xmlhttp;
|
||||
return xmlhttp
|
||||
}
|
||||
|
||||
function parser(str) {
|
||||
var regLevel = regex["regLevel"];
|
||||
var invalidLine = regex["invalidLine"];
|
||||
var lines = str.split("\n");
|
||||
var m;
|
||||
var level = 0, curLevel = 0;
|
||||
var regLevel = regex['regLevel']
|
||||
var invalidLine = regex['invalidLine']
|
||||
var lines = str.split('\n')
|
||||
var m
|
||||
var level = 0,
|
||||
curLevel = 0
|
||||
|
||||
var blocks = [];
|
||||
var blocks = []
|
||||
|
||||
var result = new Block(-1);
|
||||
var currentBlock = new Block(0);
|
||||
result.addChild(currentBlock);
|
||||
var levels = [];
|
||||
var line = "";
|
||||
var result = new Block(-1)
|
||||
var currentBlock = new Block(0)
|
||||
result.addChild(currentBlock)
|
||||
var levels = []
|
||||
var line = ''
|
||||
|
||||
blocks.push(currentBlock);
|
||||
levels.push(level);
|
||||
blocks.push(currentBlock)
|
||||
levels.push(level)
|
||||
|
||||
for(var i = 0, len = lines.length; i < len; ++i) {
|
||||
line = lines[i];
|
||||
for (var i = 0, len = lines.length; i < len; ++i) {
|
||||
line = lines[i]
|
||||
|
||||
if(line.match(invalidLine)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if(m = regLevel.exec(line)) {
|
||||
level = m[1].length;
|
||||
} else
|
||||
level = 0;
|
||||
|
||||
if(level > curLevel) {
|
||||
var oldBlock = currentBlock;
|
||||
currentBlock = new Block(level);
|
||||
oldBlock.addChild(currentBlock);
|
||||
blocks.push(currentBlock);
|
||||
levels.push(level);
|
||||
} else if(level < curLevel) {
|
||||
var added = false;
|
||||
|
||||
var k = levels.length - 1;
|
||||
for(; k >= 0; --k) {
|
||||
if(levels[k] == level) {
|
||||
currentBlock = new Block(level);
|
||||
blocks.push(currentBlock);
|
||||
levels.push(level);
|
||||
if(blocks[k].parent!= null)
|
||||
blocks[k].parent.addChild(currentBlock);
|
||||
added = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(!added) {
|
||||
errors.push("Error: Invalid indentation at line " + i + ": " + line);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
currentBlock.lines.push(line.replace(regex["trim"], ""));
|
||||
curLevel = level;
|
||||
if (line.match(invalidLine)) {
|
||||
continue
|
||||
}
|
||||
|
||||
return result;
|
||||
if ((m = regLevel.exec(line))) {
|
||||
level = m[1].length
|
||||
} else level = 0
|
||||
|
||||
if (level > curLevel) {
|
||||
var oldBlock = currentBlock
|
||||
currentBlock = new Block(level)
|
||||
oldBlock.addChild(currentBlock)
|
||||
blocks.push(currentBlock)
|
||||
levels.push(level)
|
||||
} else if (level < curLevel) {
|
||||
var added = false
|
||||
|
||||
var k = levels.length - 1
|
||||
for (; k >= 0; --k) {
|
||||
if (levels[k] == level) {
|
||||
currentBlock = new Block(level)
|
||||
blocks.push(currentBlock)
|
||||
levels.push(level)
|
||||
if (blocks[k].parent != null) blocks[k].parent.addChild(currentBlock)
|
||||
added = true
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if (!added) {
|
||||
errors.push('Error: Invalid indentation at line ' + i + ': ' + line)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
currentBlock.lines.push(line.replace(regex['trim'], ''))
|
||||
curLevel = level
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
function processValue(val) {
|
||||
val = val.replace(regex["trim"], "");
|
||||
var m = null;
|
||||
val = val.replace(regex['trim'], '')
|
||||
var m = null
|
||||
|
||||
if(val == 'true') {
|
||||
return true;
|
||||
} else if(val == 'false') {
|
||||
return false;
|
||||
} else if(val == '.NaN') {
|
||||
return Number.NaN;
|
||||
} else if(val == 'null') {
|
||||
return null;
|
||||
} else if(val == '.inf') {
|
||||
return Number.POSITIVE_INFINITY;
|
||||
} else if(val == '-.inf') {
|
||||
return Number.NEGATIVE_INFINITY;
|
||||
} else if(m = val.match(regex["dashesString"])) {
|
||||
return m[1];
|
||||
} else if(m = val.match(regex["quotesString"])) {
|
||||
return m[1];
|
||||
} else if(m = val.match(regex["float"])) {
|
||||
return parseFloat(m[0]);
|
||||
} else if(m = val.match(regex["integer"])) {
|
||||
return parseInt(m[0]);
|
||||
} else if( !isNaN(m = Date.parse(val))) {
|
||||
return new Date(m);
|
||||
} else if(m = val.match(regex["single_key_value"])) {
|
||||
var res = {};
|
||||
res[m[1]] = processValue(m[2]);
|
||||
return res;
|
||||
} else if(m = val.match(regex["array"])){
|
||||
var count = 0, c = ' ';
|
||||
var res = [];
|
||||
var content = "";
|
||||
var str = false;
|
||||
for(var j = 0, lenJ = m[1].length; j < lenJ; ++j) {
|
||||
c = m[1][j];
|
||||
if(c == '\'' || c == '"') {
|
||||
if(str === false) {
|
||||
str = c;
|
||||
content += c;
|
||||
continue;
|
||||
} else if((c == '\'' && str == '\'') || (c == '"' && str == '"')) {
|
||||
str = false;
|
||||
content += c;
|
||||
continue;
|
||||
}
|
||||
} else if(str === false && (c == '[' || c == '{')) {
|
||||
++count;
|
||||
} else if(str === false && (c == ']' || c == '}')) {
|
||||
--count;
|
||||
} else if(str === false && count == 0 && c == ',') {
|
||||
res.push(processValue(content));
|
||||
content = "";
|
||||
continue;
|
||||
}
|
||||
|
||||
content += c;
|
||||
if (val == 'true') {
|
||||
return true
|
||||
} else if (val == 'false') {
|
||||
return false
|
||||
} else if (val == '.NaN') {
|
||||
return Number.NaN
|
||||
} else if (val == 'null') {
|
||||
return null
|
||||
} else if (val == '.inf') {
|
||||
return Number.POSITIVE_INFINITY
|
||||
} else if (val == '-.inf') {
|
||||
return Number.NEGATIVE_INFINITY
|
||||
} else if ((m = val.match(regex['dashesString']))) {
|
||||
return m[1]
|
||||
} else if ((m = val.match(regex['quotesString']))) {
|
||||
return m[1]
|
||||
} else if ((m = val.match(regex['float']))) {
|
||||
return parseFloat(m[0])
|
||||
} else if ((m = val.match(regex['integer']))) {
|
||||
return parseInt(m[0])
|
||||
} else if (!isNaN((m = Date.parse(val)))) {
|
||||
return new Date(m)
|
||||
} else if ((m = val.match(regex['single_key_value']))) {
|
||||
var res = {}
|
||||
res[m[1]] = processValue(m[2])
|
||||
return res
|
||||
} else if ((m = val.match(regex['array']))) {
|
||||
var count = 0,
|
||||
c = ' '
|
||||
var res = []
|
||||
var content = ''
|
||||
var str = false
|
||||
for (var j = 0, lenJ = m[1].length; j < lenJ; ++j) {
|
||||
c = m[1][j]
|
||||
if (c == "'" || c == '"') {
|
||||
if (str === false) {
|
||||
str = c
|
||||
content += c
|
||||
continue
|
||||
} else if ((c == "'" && str == "'") || (c == '"' && str == '"')) {
|
||||
str = false
|
||||
content += c
|
||||
continue
|
||||
}
|
||||
} else if (str === false && (c == '[' || c == '{')) {
|
||||
++count
|
||||
} else if (str === false && (c == ']' || c == '}')) {
|
||||
--count
|
||||
} else if (str === false && count == 0 && c == ',') {
|
||||
res.push(processValue(content))
|
||||
content = ''
|
||||
continue
|
||||
}
|
||||
|
||||
if(content.length > 0)
|
||||
res.push(processValue(content));
|
||||
return res;
|
||||
} else if(m = val.match(regex["map"])){
|
||||
var count = 0, c = ' ';
|
||||
var res = [];
|
||||
var content = "";
|
||||
var str = false;
|
||||
for(var j = 0, lenJ = m[1].length; j < lenJ; ++j) {
|
||||
c = m[1][j];
|
||||
if(c == '\'' || c == '"') {
|
||||
if(str === false) {
|
||||
str = c;
|
||||
content += c;
|
||||
continue;
|
||||
} else if((c == '\'' && str == '\'') || (c == '"' && str == '"')) {
|
||||
str = false;
|
||||
content += c;
|
||||
continue;
|
||||
}
|
||||
} else if(str === false && (c == '[' || c == '{')) {
|
||||
++count;
|
||||
} else if(str === false && (c == ']' || c == '}')) {
|
||||
--count;
|
||||
} else if(str === false && count == 0 && c == ',') {
|
||||
res.push(content);
|
||||
content = "";
|
||||
continue;
|
||||
}
|
||||
content += c
|
||||
}
|
||||
|
||||
content += c;
|
||||
if (content.length > 0) res.push(processValue(content))
|
||||
return res
|
||||
} else if ((m = val.match(regex['map']))) {
|
||||
var count = 0,
|
||||
c = ' '
|
||||
var res = []
|
||||
var content = ''
|
||||
var str = false
|
||||
for (var j = 0, lenJ = m[1].length; j < lenJ; ++j) {
|
||||
c = m[1][j]
|
||||
if (c == "'" || c == '"') {
|
||||
if (str === false) {
|
||||
str = c
|
||||
content += c
|
||||
continue
|
||||
} else if ((c == "'" && str == "'") || (c == '"' && str == '"')) {
|
||||
str = false
|
||||
content += c
|
||||
continue
|
||||
}
|
||||
} else if (str === false && (c == '[' || c == '{')) {
|
||||
++count
|
||||
} else if (str === false && (c == ']' || c == '}')) {
|
||||
--count
|
||||
} else if (str === false && count == 0 && c == ',') {
|
||||
res.push(content)
|
||||
content = ''
|
||||
continue
|
||||
}
|
||||
|
||||
if(content.length > 0)
|
||||
res.push(content);
|
||||
content += c
|
||||
}
|
||||
|
||||
var newRes = {};
|
||||
for(var j = 0, lenJ = res.length; j < lenJ; ++j) {
|
||||
if(m = res[j].match(regex["key_value"])) {
|
||||
newRes[m[1]] = processValue(m[2]);
|
||||
}
|
||||
}
|
||||
if (content.length > 0) res.push(content)
|
||||
|
||||
return newRes;
|
||||
} else
|
||||
return val;
|
||||
var newRes = {}
|
||||
for (var j = 0, lenJ = res.length; j < lenJ; ++j) {
|
||||
if ((m = res[j].match(regex['key_value']))) {
|
||||
newRes[m[1]] = processValue(m[2])
|
||||
}
|
||||
}
|
||||
|
||||
return newRes
|
||||
} else return val
|
||||
}
|
||||
|
||||
function processFoldedBlock(block) {
|
||||
var lines = block.lines;
|
||||
var children = block.children;
|
||||
var str = lines.join(" ");
|
||||
var chunks = [str];
|
||||
for(var i = 0, len = children.length; i < len; ++i) {
|
||||
chunks.push(processFoldedBlock(children[i]));
|
||||
}
|
||||
return chunks.join("\n");
|
||||
var lines = block.lines
|
||||
var children = block.children
|
||||
var str = lines.join(' ')
|
||||
var chunks = [str]
|
||||
for (var i = 0, len = children.length; i < len; ++i) {
|
||||
chunks.push(processFoldedBlock(children[i]))
|
||||
}
|
||||
return chunks.join('\n')
|
||||
}
|
||||
|
||||
function processLiteralBlock(block) {
|
||||
var lines = block.lines;
|
||||
var children = block.children;
|
||||
var str = lines.join("\n");
|
||||
for(var i = 0, len = children.length; i < len; ++i) {
|
||||
str += processLiteralBlock(children[i]);
|
||||
}
|
||||
return str;
|
||||
var lines = block.lines
|
||||
var children = block.children
|
||||
var str = lines.join('\n')
|
||||
for (var i = 0, len = children.length; i < len; ++i) {
|
||||
str += processLiteralBlock(children[i])
|
||||
}
|
||||
return str
|
||||
}
|
||||
|
||||
function processBlock(blocks) {
|
||||
var m = null;
|
||||
var res = {};
|
||||
var lines = null;
|
||||
var children = null;
|
||||
var currentObj = null;
|
||||
var m = null
|
||||
var res = {}
|
||||
var lines = null
|
||||
var children = null
|
||||
var currentObj = null
|
||||
|
||||
var level = -1;
|
||||
var level = -1
|
||||
|
||||
var processedBlocks = [];
|
||||
var processedBlocks = []
|
||||
|
||||
var isMap = true;
|
||||
var isMap = true
|
||||
|
||||
for(var j = 0, lenJ = blocks.length; j < lenJ; ++j) {
|
||||
for (var j = 0, lenJ = blocks.length; j < lenJ; ++j) {
|
||||
if (level != -1 && level != blocks[j].level) continue
|
||||
|
||||
if(level != -1 && level != blocks[j].level)
|
||||
continue;
|
||||
processedBlocks.push(j)
|
||||
|
||||
processedBlocks.push(j);
|
||||
level = blocks[j].level
|
||||
lines = blocks[j].lines
|
||||
children = blocks[j].children
|
||||
currentObj = null
|
||||
|
||||
level = blocks[j].level;
|
||||
lines = blocks[j].lines;
|
||||
children = blocks[j].children;
|
||||
currentObj = null;
|
||||
for (var i = 0, len = lines.length; i < len; ++i) {
|
||||
var line = lines[i]
|
||||
|
||||
for(var i = 0, len = lines.length; i < len; ++i) {
|
||||
var line = lines[i];
|
||||
if ((m = line.match(regex['key']))) {
|
||||
var key = m[1]
|
||||
|
||||
if(m = line.match(regex["key"])) {
|
||||
var key = m[1];
|
||||
|
||||
if(key[0] == '-') {
|
||||
key = key.replace(regex["item"], "");
|
||||
if (isMap) {
|
||||
isMap = false;
|
||||
if (typeof(res.length) === "undefined") {
|
||||
res = [];
|
||||
}
|
||||
}
|
||||
if(currentObj != null) res.push(currentObj);
|
||||
currentObj = {};
|
||||
isMap = true;
|
||||
}
|
||||
|
||||
if(typeof m[2] != "undefined") {
|
||||
var value = m[2].replace(regex["trim"], "");
|
||||
if(value[0] == '&') {
|
||||
var nb = processBlock(children);
|
||||
if(currentObj != null) currentObj[key] = nb;
|
||||
else res[key] = nb;
|
||||
reference_blocks[value.substr(1)] = nb;
|
||||
} else if(value[0] == '|') {
|
||||
if(currentObj != null) currentObj[key] = processLiteralBlock(children.shift());
|
||||
else res[key] = processLiteralBlock(children.shift());
|
||||
} else if(value[0] == '*') {
|
||||
var v = value.substr(1);
|
||||
var no = {};
|
||||
|
||||
if(typeof reference_blocks[v] == "undefined") {
|
||||
errors.push("Reference '" + v + "' not found!");
|
||||
} else {
|
||||
for(var k in reference_blocks[v]) {
|
||||
no[k] = reference_blocks[v][k];
|
||||
}
|
||||
|
||||
if(currentObj != null) currentObj[key] = no;
|
||||
else res[key] = no;
|
||||
}
|
||||
} else if(value[0] == '>') {
|
||||
if(currentObj != null) currentObj[key] = processFoldedBlock(children.shift());
|
||||
else res[key] = processFoldedBlock(children.shift());
|
||||
} else {
|
||||
if(currentObj != null) currentObj[key] = processValue(value);
|
||||
else res[key] = processValue(value);
|
||||
}
|
||||
} else {
|
||||
if(currentObj != null) currentObj[key] = processBlock(children);
|
||||
else res[key] = processBlock(children);
|
||||
}
|
||||
} else if(line.match(/^-\s*$/)) {
|
||||
if (isMap) {
|
||||
isMap = false;
|
||||
if (typeof(res.length) === "undefined") {
|
||||
res = [];
|
||||
}
|
||||
}
|
||||
if(currentObj != null) res.push(currentObj);
|
||||
currentObj = {};
|
||||
isMap = true;
|
||||
continue;
|
||||
} else if(m = line.match(/^-\s*(.*)/)) {
|
||||
if(currentObj != null)
|
||||
currentObj.push(processValue(m[1]));
|
||||
else {
|
||||
if (isMap) {
|
||||
isMap = false;
|
||||
if (typeof(res.length) === "undefined") {
|
||||
res = [];
|
||||
}
|
||||
}
|
||||
res.push(processValue(m[1]));
|
||||
}
|
||||
continue;
|
||||
if (key[0] == '-') {
|
||||
key = key.replace(regex['item'], '')
|
||||
if (isMap) {
|
||||
isMap = false
|
||||
if (typeof res.length === 'undefined') {
|
||||
res = []
|
||||
}
|
||||
}
|
||||
if (currentObj != null) res.push(currentObj)
|
||||
currentObj = {}
|
||||
isMap = true
|
||||
}
|
||||
|
||||
if(currentObj != null) {
|
||||
if (isMap) {
|
||||
isMap = false;
|
||||
if (typeof(res.length) === "undefined") {
|
||||
res = [];
|
||||
}
|
||||
if (typeof m[2] != 'undefined') {
|
||||
var value = m[2].replace(regex['trim'], '')
|
||||
if (value[0] == '&') {
|
||||
var nb = processBlock(children)
|
||||
if (currentObj != null) currentObj[key] = nb
|
||||
else res[key] = nb
|
||||
reference_blocks[value.substr(1)] = nb
|
||||
} else if (value[0] == '|') {
|
||||
if (currentObj != null)
|
||||
currentObj[key] = processLiteralBlock(children.shift())
|
||||
else res[key] = processLiteralBlock(children.shift())
|
||||
} else if (value[0] == '*') {
|
||||
var v = value.substr(1)
|
||||
var no = {}
|
||||
|
||||
if (typeof reference_blocks[v] == 'undefined') {
|
||||
errors.push("Reference '" + v + "' not found!")
|
||||
} else {
|
||||
for (var k in reference_blocks[v]) {
|
||||
no[k] = reference_blocks[v][k]
|
||||
}
|
||||
|
||||
if (currentObj != null) currentObj[key] = no
|
||||
else res[key] = no
|
||||
}
|
||||
res.push(currentObj);
|
||||
} else if (value[0] == '>') {
|
||||
if (currentObj != null)
|
||||
currentObj[key] = processFoldedBlock(children.shift())
|
||||
else res[key] = processFoldedBlock(children.shift())
|
||||
} else {
|
||||
if (currentObj != null) currentObj[key] = processValue(value)
|
||||
else res[key] = processValue(value)
|
||||
}
|
||||
} else {
|
||||
if (currentObj != null) currentObj[key] = processBlock(children)
|
||||
else res[key] = processBlock(children)
|
||||
}
|
||||
} else if (line.match(/^-\s*$/)) {
|
||||
if (isMap) {
|
||||
isMap = false
|
||||
if (typeof res.length === 'undefined') {
|
||||
res = []
|
||||
}
|
||||
}
|
||||
if (currentObj != null) res.push(currentObj)
|
||||
currentObj = {}
|
||||
isMap = true
|
||||
continue
|
||||
} else if ((m = line.match(/^-\s*(.*)/))) {
|
||||
if (currentObj != null) currentObj.push(processValue(m[1]))
|
||||
else {
|
||||
if (isMap) {
|
||||
isMap = false
|
||||
if (typeof res.length === 'undefined') {
|
||||
res = []
|
||||
}
|
||||
}
|
||||
res.push(processValue(m[1]))
|
||||
}
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
||||
for(var j = processedBlocks.length - 1; j >= 0; --j) {
|
||||
blocks.splice.call(blocks, processedBlocks[j], 1);
|
||||
if (currentObj != null) {
|
||||
if (isMap) {
|
||||
isMap = false
|
||||
if (typeof res.length === 'undefined') {
|
||||
res = []
|
||||
}
|
||||
}
|
||||
res.push(currentObj)
|
||||
}
|
||||
}
|
||||
|
||||
return res;
|
||||
for (var j = processedBlocks.length - 1; j >= 0; --j) {
|
||||
blocks.splice.call(blocks, processedBlocks[j], 1)
|
||||
}
|
||||
|
||||
return res
|
||||
}
|
||||
|
||||
function semanticAnalysis(blocks) {
|
||||
var res = processBlock(blocks.children);
|
||||
return res;
|
||||
var res = processBlock(blocks.children)
|
||||
return res
|
||||
}
|
||||
|
||||
function preProcess(src) {
|
||||
var m;
|
||||
var lines = src.split("\n");
|
||||
var m
|
||||
var lines = src.split('\n')
|
||||
|
||||
var r = regex["comment"];
|
||||
var r = regex['comment']
|
||||
|
||||
for(var i in lines) {
|
||||
if(m = lines[i].match(r)) {
|
||||
/* var cmt = "";
|
||||
for (var i in lines) {
|
||||
if ((m = lines[i].match(r))) {
|
||||
/* var cmt = "";
|
||||
if(typeof m[3] != "undefined")
|
||||
lines[i] = m[1];
|
||||
else if(typeof m[3] != "undefined")
|
||||
@@ -445,25 +442,25 @@ function preProcess(src) {
|
||||
else
|
||||
lines[i] = "";
|
||||
*/
|
||||
if(typeof m[3] !== "undefined") {
|
||||
lines[i] = m[0].substr(0, m[0].length - m[3].length);
|
||||
}
|
||||
}
|
||||
if (typeof m[3] !== 'undefined') {
|
||||
lines[i] = m[0].substr(0, m[0].length - m[3].length)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return lines.join("\n");
|
||||
return lines.join('\n')
|
||||
}
|
||||
|
||||
function load(str) {
|
||||
errors = [];
|
||||
reference_blocks = [];
|
||||
processing_time = (new Date()).getTime();
|
||||
var pre = preProcess(str)
|
||||
var doc = parser(pre);
|
||||
var res = semanticAnalysis(doc);
|
||||
processing_time = (new Date()).getTime() - processing_time;
|
||||
errors = []
|
||||
reference_blocks = []
|
||||
processing_time = new Date().getTime()
|
||||
var pre = preProcess(str)
|
||||
var doc = parser(pre)
|
||||
var res = semanticAnalysis(doc)
|
||||
processing_time = new Date().getTime() - processing_time
|
||||
|
||||
return res;
|
||||
return res
|
||||
}
|
||||
|
||||
export default load
|
||||
export default load
|
||||
|
||||
+5
-3
@@ -8,9 +8,11 @@ function appendScript () {
|
||||
|
||||
function init (id) {
|
||||
appendScript()
|
||||
window.ga = window.ga || function () {
|
||||
(window.ga.q = window.ga.q || []).push(arguments)
|
||||
}
|
||||
window.ga =
|
||||
window.ga ||
|
||||
function () {
|
||||
;(window.ga.q = window.ga.q || []).push(arguments)
|
||||
}
|
||||
window.ga.l = Number(new Date())
|
||||
window.ga('create', id, 'auto')
|
||||
}
|
||||
|
||||
@@ -64,14 +64,14 @@ function style () {
|
||||
.search p.empty {
|
||||
text-align: center;
|
||||
}`
|
||||
const style = Docsify.dom.create('style', code)
|
||||
Docsify.dom.appendTo(Docsify.dom.head, style)
|
||||
|
||||
Docsify.dom.style(code)
|
||||
}
|
||||
|
||||
function tpl (opts, defaultValue = '') {
|
||||
const html =
|
||||
`<input type="search" value="${defaultValue}" />` +
|
||||
'<div class="results-panel"></div>' +
|
||||
'<div class="results-panel"></div>' +
|
||||
'</div>'
|
||||
const el = Docsify.dom.create('div', html)
|
||||
const aside = Docsify.dom.find('aside')
|
||||
@@ -109,8 +109,11 @@ function bindEvents () {
|
||||
|
||||
let timeId
|
||||
// Prevent to Fold sidebar
|
||||
Docsify.dom.on($search, 'click',
|
||||
e => e.target.tagName !== 'A' && e.stopPropagation())
|
||||
Docsify.dom.on(
|
||||
$search,
|
||||
'click',
|
||||
e => e.target.tagName !== 'A' && e.stopPropagation()
|
||||
)
|
||||
Docsify.dom.on($input, 'input', e => {
|
||||
clearTimeout(timeId)
|
||||
timeId = setTimeout(_ => doSearch(e.target.value.trim()), 100)
|
||||
@@ -151,4 +154,3 @@ export function update (opts, vm) {
|
||||
updatePlaceholder(opts.placeholder, vm.route.path)
|
||||
updateNoData(opts.noData, vm.route.path)
|
||||
}
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ section.cover {
|
||||
|
||||
&.has-mask .mask {
|
||||
background-color: $color-bg;
|
||||
opacity: .8;
|
||||
opacity: 0.8;
|
||||
position: absolute;
|
||||
size: 100%;
|
||||
}
|
||||
@@ -42,7 +42,7 @@ section.cover {
|
||||
color: inherit;
|
||||
font-size: 2.5rem;
|
||||
font-weight: 300;
|
||||
margin: .625rem 0 2.5rem;
|
||||
margin: 0.625rem 0 2.5rem;
|
||||
position: relative;
|
||||
text-align: center;
|
||||
|
||||
@@ -92,7 +92,7 @@ section.cover {
|
||||
|
||||
&:hover {
|
||||
color: inherit;
|
||||
opacity: .8;
|
||||
opacity: 0.8;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -103,7 +103,7 @@ section.cover {
|
||||
|
||||
blockquote > p > a {
|
||||
border-bottom: 2px solid var(--theme-color, $color-primary);
|
||||
transition: color .3s;
|
||||
transition: color 0.3s;
|
||||
|
||||
&:hover {
|
||||
color: var(--theme-color, $color-primary);
|
||||
|
||||
@@ -10,7 +10,9 @@
|
||||
body:not(.ready) {
|
||||
overflow: hidden;
|
||||
|
||||
[data-cloak], .app-nav, > nav {
|
||||
[data-cloak],
|
||||
.app-nav,
|
||||
> nav {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
@@ -22,7 +24,7 @@ div#app {
|
||||
text-align: center;
|
||||
|
||||
&:empty::before {
|
||||
content: "Loading...";
|
||||
content: 'Loading...';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,7 +54,8 @@ div#app {
|
||||
font-style: normal;
|
||||
}
|
||||
|
||||
html, body {
|
||||
html,
|
||||
body {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
@@ -77,7 +80,7 @@ kbd {
|
||||
display: inline-block;
|
||||
font-size: 12px !important;
|
||||
line-height: 12px;
|
||||
margin-bottom : 3px;
|
||||
margin-bottom: 3px;
|
||||
padding: 3px 5px;
|
||||
vertical-align: middle;
|
||||
}
|
||||
@@ -99,12 +102,13 @@ kbd {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
>a {
|
||||
> a {
|
||||
margin: 0 1rem;
|
||||
padding: 5px 0;
|
||||
}
|
||||
|
||||
ul, li {
|
||||
ul,
|
||||
li {
|
||||
display: inline-block;
|
||||
list-style: none;
|
||||
margin: 0;
|
||||
@@ -114,7 +118,7 @@ kbd {
|
||||
color: inherit;
|
||||
font-size: 16px;
|
||||
text-decoration: none;
|
||||
transition: color .3s;
|
||||
transition: color 0.3s;
|
||||
|
||||
&:hover {
|
||||
color: var(--theme-color, $color-primary);
|
||||
@@ -186,7 +190,7 @@ kbd {
|
||||
z-index: 1;
|
||||
|
||||
&:hover .octo-arm {
|
||||
animation:octocat-wave 560ms ease-in-out;
|
||||
animation: octocat-wave 560ms ease-in-out;
|
||||
}
|
||||
|
||||
svg {
|
||||
@@ -207,7 +211,7 @@ main {
|
||||
.anchor {
|
||||
display: inline-block;
|
||||
text-decoration: none;
|
||||
transition: all .3s;
|
||||
transition: all 0.3s;
|
||||
|
||||
span {
|
||||
color: $color-text;
|
||||
@@ -220,7 +224,7 @@ main {
|
||||
|
||||
/* sidebar */
|
||||
.sidebar {
|
||||
border-right: 1px solid rgba(0, 0, 0, .07);
|
||||
border-right: 1px solid rgba(0, 0, 0, 0.07);
|
||||
overflow-y: auto;
|
||||
padding: 40px 0;
|
||||
position: absolute 0 * 0 0;
|
||||
@@ -254,12 +258,13 @@ main {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
li>p {
|
||||
li > p {
|
||||
font-weight: 700;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
ul, ul li {
|
||||
ul,
|
||||
ul li {
|
||||
list-style: none;
|
||||
}
|
||||
|
||||
@@ -293,20 +298,20 @@ main {
|
||||
/* sidebar toggle */
|
||||
.sidebar-toggle {
|
||||
background-color: transparent;
|
||||
background-color: rgba($color-bg, .8);
|
||||
background-color: rgba($color-bg, 0.8);
|
||||
border: 0;
|
||||
outline: none;
|
||||
outline: none;
|
||||
padding: 10px;
|
||||
position: absolute * * 0 0;
|
||||
text-align: center;
|
||||
transition: opacity .3s;
|
||||
transition: opacity 0.3s;
|
||||
width: 30px;
|
||||
width: calc($sidebar-width - 16px);
|
||||
z-index: 30;
|
||||
|
||||
.sidebar-toggle-button:hover {
|
||||
opacity: .4;
|
||||
opacity: 0.4;
|
||||
}
|
||||
|
||||
span {
|
||||
@@ -318,14 +323,15 @@ main {
|
||||
}
|
||||
|
||||
body.sticky {
|
||||
.sidebar, .sidebar-toggle {
|
||||
.sidebar,
|
||||
.sidebar-toggle {
|
||||
position: fixed;
|
||||
}
|
||||
}
|
||||
|
||||
/* main content */
|
||||
.content {
|
||||
padding-top: 20px;
|
||||
padding-top: 60px;
|
||||
position: absolute 0 0 0 $sidebar-width;
|
||||
transition: left 250ms ease;
|
||||
}
|
||||
@@ -342,8 +348,8 @@ body.sticky {
|
||||
font-size: inherit;
|
||||
}
|
||||
|
||||
>:first-child {
|
||||
margin-top: 0!important;
|
||||
> :first-child {
|
||||
margin-top: 0 !important;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -393,7 +399,7 @@ body.sticky {
|
||||
background-color: #f66;
|
||||
border-radius: 100%;
|
||||
color: $color-bg;
|
||||
content: "!";
|
||||
content: '!';
|
||||
font-family: 'Dosis', 'Source Sans Pro', 'Helvetica Neue', Arial, sans-serif;
|
||||
font-size: 14px;
|
||||
font-weight: bold;
|
||||
@@ -435,7 +441,9 @@ body.close {
|
||||
}
|
||||
|
||||
@media print {
|
||||
.github-corner, .sidebar-toggle, .sidebar {
|
||||
.github-corner,
|
||||
.sidebar-toggle,
|
||||
.sidebar {
|
||||
display: none;
|
||||
}
|
||||
|
||||
@@ -445,7 +453,9 @@ body.close {
|
||||
}
|
||||
|
||||
@media screen and (max-width: 768px) {
|
||||
.github-corner, .sidebar-toggle, .sidebar {
|
||||
.github-corner,
|
||||
.sidebar-toggle,
|
||||
.sidebar {
|
||||
position: fixed;
|
||||
}
|
||||
|
||||
@@ -471,10 +481,12 @@ body.close {
|
||||
left: 0;
|
||||
max-width: 100vw;
|
||||
position: static;
|
||||
padding-top: 20px;
|
||||
transition: transform 250ms ease;
|
||||
}
|
||||
|
||||
.app-nav, .github-corner {
|
||||
.app-nav,
|
||||
.github-corner {
|
||||
transition: transform 250ms ease-out;
|
||||
}
|
||||
|
||||
@@ -489,7 +501,7 @@ body.close {
|
||||
}
|
||||
|
||||
.sidebar-toggle {
|
||||
background-color: rgba($color-bg, .8);
|
||||
background-color: rgba($color-bg, 0.8);
|
||||
transition: 1s background-color;
|
||||
width: calc($sidebar-width - 16px);
|
||||
}
|
||||
@@ -498,7 +510,8 @@ body.close {
|
||||
transform: translateX($sidebar-width);
|
||||
}
|
||||
|
||||
.app-nav, .github-corner {
|
||||
.app-nav,
|
||||
.github-corner {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
@@ -514,7 +527,16 @@ body.close {
|
||||
}
|
||||
|
||||
@keyframes octocat-wave {
|
||||
0%,100% { transform: rotate(0); }
|
||||
20%,60% { transform: rotate(-25deg); }
|
||||
40%,80% { transform: rotate(10deg); }
|
||||
0%,
|
||||
100% {
|
||||
transform: rotate(0);
|
||||
}
|
||||
20%,
|
||||
60% {
|
||||
transform: rotate(-25deg);
|
||||
}
|
||||
40%,
|
||||
80% {
|
||||
transform: rotate(10deg);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
@import url('https://fonts.googleapis.com/css?family=Inconsolata|Inconsolata-Bold');
|
||||
|
||||
$color-primary: #0074D9;
|
||||
$color-primary: #0074d9;
|
||||
$color-bg: #fff;
|
||||
$color-text: #34495e;
|
||||
$sidebar-width: 16rem;
|
||||
|
||||
@import "basic/layout";
|
||||
@import "basic/coverpage";
|
||||
@import 'basic/layout';
|
||||
@import 'basic/coverpage';
|
||||
|
||||
/* sidebar */
|
||||
.sidebar {
|
||||
@@ -160,7 +160,7 @@ $sidebar-width: 16rem;
|
||||
}
|
||||
|
||||
.namespace {
|
||||
opacity: .7;
|
||||
opacity: 0.7;
|
||||
}
|
||||
|
||||
.token.property,
|
||||
@@ -216,7 +216,7 @@ $sidebar-width: 16rem;
|
||||
cursor: help;
|
||||
}
|
||||
|
||||
.markdown-section pre>code {
|
||||
.markdown-section pre > code {
|
||||
background-color: #f8f8f8;
|
||||
border-radius: 2px;
|
||||
display: block;
|
||||
@@ -226,9 +226,11 @@ $sidebar-width: 16rem;
|
||||
overflow: inherit;
|
||||
padding: 20px 0.8em 20px;
|
||||
position: relative;
|
||||
white-space: inherit;
|
||||
}
|
||||
|
||||
.markdown-section code::after, .markdown-section code::before {
|
||||
.markdown-section code::after,
|
||||
.markdown-section code::before {
|
||||
letter-spacing: 0.05rem;
|
||||
}
|
||||
|
||||
|
||||
+9
-8
@@ -5,8 +5,8 @@ $color-bg: #3f3f3f;
|
||||
$color-text: #c8c8c8;
|
||||
$sidebar-width: 300px;
|
||||
|
||||
@import "basic/layout";
|
||||
@import "basic/coverpage";
|
||||
@import 'basic/layout';
|
||||
@import 'basic/coverpage';
|
||||
|
||||
body {
|
||||
background-color: $color-bg;
|
||||
@@ -38,7 +38,7 @@ body {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
ul li.active>a {
|
||||
ul li.active > a {
|
||||
color: var(--theme-color, $color-primary);
|
||||
font-weight: 600;
|
||||
}
|
||||
@@ -71,7 +71,7 @@ body {
|
||||
|
||||
.markdown-section h3 {
|
||||
font-size: 1.5rem;
|
||||
margin: 40px 0 .6rem;
|
||||
margin: 40px 0 0.6rem;
|
||||
}
|
||||
|
||||
.markdown-section h4 {
|
||||
@@ -159,7 +159,7 @@ body {
|
||||
}
|
||||
|
||||
.token.namespace {
|
||||
opacity: .7;
|
||||
opacity: 0.7;
|
||||
}
|
||||
|
||||
.token.boolean,
|
||||
@@ -246,7 +246,7 @@ body {
|
||||
cursor: help;
|
||||
}
|
||||
|
||||
.markdown-section pre>code {
|
||||
.markdown-section pre > code {
|
||||
-moz-osx-font-smoothing: initial;
|
||||
-webkit-font-smoothing: initial;
|
||||
background-color: #282828;
|
||||
@@ -263,7 +263,8 @@ body {
|
||||
white-space: inherit;
|
||||
}
|
||||
|
||||
.markdown-section code::after, .markdown-section code::before {
|
||||
.markdown-section code::after,
|
||||
.markdown-section code::before {
|
||||
letter-spacing: 0.05rem;
|
||||
}
|
||||
|
||||
@@ -292,7 +293,7 @@ pre::after {
|
||||
color: #657b83;
|
||||
}
|
||||
|
||||
input[type="search"] {
|
||||
input[type='search'] {
|
||||
background: #4f4f4f;
|
||||
border-color: #4f4f4f;
|
||||
color: #c8c8c8;
|
||||
|
||||
+2
-2
@@ -2,5 +2,5 @@ $color-primary: #000;
|
||||
$color-bg: #fff;
|
||||
$color-text: #000;
|
||||
$sidebar-width: 300px;
|
||||
@import "basic/layout";
|
||||
@import "basic/coverpage";
|
||||
@import 'basic/layout';
|
||||
@import 'basic/coverpage';
|
||||
|
||||
+8
-7
@@ -5,8 +5,8 @@ $color-bg: #fff;
|
||||
$color-text: #34495e;
|
||||
$sidebar-width: 300px;
|
||||
|
||||
@import "basic/layout";
|
||||
@import "basic/coverpage";
|
||||
@import 'basic/layout';
|
||||
@import 'basic/coverpage';
|
||||
|
||||
body {
|
||||
background-color: $color-bg;
|
||||
@@ -39,7 +39,7 @@ body {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
ul li.active>a {
|
||||
ul li.active > a {
|
||||
border-right: 2px solid;
|
||||
color: var(--theme-color, $color-primary);
|
||||
font-weight: 600;
|
||||
@@ -82,7 +82,7 @@ body {
|
||||
|
||||
.markdown-section h3 {
|
||||
font-size: 1.5rem;
|
||||
margin: 40px 0 .6rem;
|
||||
margin: 40px 0 0.6rem;
|
||||
}
|
||||
|
||||
.markdown-section h4 {
|
||||
@@ -170,7 +170,7 @@ body {
|
||||
}
|
||||
|
||||
.token.namespace {
|
||||
opacity: .7;
|
||||
opacity: 0.7;
|
||||
}
|
||||
|
||||
.token.boolean,
|
||||
@@ -257,7 +257,7 @@ body {
|
||||
cursor: help;
|
||||
}
|
||||
|
||||
.markdown-section pre>code {
|
||||
.markdown-section pre > code {
|
||||
-moz-osx-font-smoothing: initial;
|
||||
-webkit-font-smoothing: initial;
|
||||
background-color: #f8f8f8;
|
||||
@@ -274,7 +274,8 @@ body {
|
||||
white-space: inherit;
|
||||
}
|
||||
|
||||
.markdown-section code::after, .markdown-section code::before {
|
||||
.markdown-section code::after,
|
||||
.markdown-section code::before {
|
||||
letter-spacing: 0.05rem;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user