Compare commits

...
74 Commits
Author SHA1 Message Date
qingwei.li 6cbed4b4d8 -> v3.7.1 2017-05-19 08:39:13 +08:00
qingwei.li b948cb06d7 bump: 3.7.1 2017-05-19 08:39:09 +08:00
qingwei.li b2b474264f fix: docsify-updated is undefined 2017-05-19 08:36:45 +08:00
qingwei.li a8c73ee2b9 update yarnlock 2017-05-17 10:41:48 +08:00
qingwei.li eda9bb8343 -> v3.7.0 2017-05-16 23:11:56 +08:00
qingwei.li 50e771e6a8 bump: 3.7.0 2017-05-16 23:11:50 +08:00
qingwei.li 2d73285de5 feat: add externalLinkTarget, close #149 2017-05-16 23:09:41 +08:00
qingwei.li d2be5aecf8 feat: add docsify-updated, close #158 2017-05-16 23:03:22 +08:00
qingwei.li ca0d6182b9 -> v3.6.6 2017-05-06 21:13:10 +08:00
qingwei.li dacea8a39b bump: 3.6.6 2017-05-06 21:13:05 +08:00
qingwei.li da75d70dee feat: support query string for the search, fixed #156 2017-05-06 21:11:04 +08:00
qingwei.li 6ed25cebe5 -> v3.6.5 2017-04-28 09:57:02 +08:00
qingwei.li ee54141776 bump: 3.6.5 2017-04-28 09:56:58 +08:00
qingwei.li 51832d3506 fix(util): fix crash, fixed #154 2017-04-28 09:56:07 +08:00
qingwei.li 25ccc79e56 -> v3.6.4 2017-04-28 08:03:56 +08:00
qingwei.li 890d29f982 bump: 3.6.4 2017-04-28 08:03:49 +08:00
qingwei.li 76c041ad48 fix(util): correctly clean up duplicate slashes, fixed #153 2017-04-28 08:02:54 +08:00
qingwei.li 2c277b8f79 -> v3.6.3 2017-04-25 12:41:29 +08:00
qingwei.li a5f6ccd1d1 bump: 3.6.3 2017-04-25 12:41:16 +08:00
qingwei.li 11c94b2149 changelog 3.6.3 2017-04-25 12:41:02 +08:00
qingwei.li 2653849a3e fix(external-script): script attrs 2017-04-25 12:39:58 +08:00
qingwei.li d7b0d1b949 docs: update cdn 2017-04-25 12:13:56 +08:00
Frances Coronelandcinwell.li 6911fb879b Add hire-me to showcase section 2017-04-21 08:14:22 +08:00
Kiko Beatsandcinwell.li 137a93c7b2 Add JS MythBusters to showcase (#148) 2017-04-17 20:32:38 +08:00
qingwei.li 5d5caa1f89 -> v3.6.2 2017-04-12 23:53:18 +08:00
qingwei.li 1dfd6cdcfe docs: add changelog 2017-04-12 23:53:11 +08:00
qingwei.li 91c6db2902 bump: 3.6.2 2017-04-12 23:52:25 +08:00
qingwei.li 94d6603c06 feat(external-script): detect more than one script dom, fixed #146 2017-04-12 23:51:16 +08:00
qingwei.li 920f624b5c -> v3.6.1 2017-04-12 23:46:46 +08:00
qingwei.li 8fb1350728 bump: 3.6.1 2017-04-12 23:46:46 +08:00
Mehdy Daraandcinwell.li c1df94662a GA: Send hash instead of complete href (#147)
On https://docsify.js.org/#/quickstart

send "#/quickstart" instead of "https://docsify.js.org/#/quickstart"
2017-04-12 23:45:58 +08:00
qingwei.li 9b7e5f5814 feat(event): Collapse the sidebar when click outside element in the small screen 2017-04-09 12:44:23 +08:00
qingwei.li 432bcfb54b -> v3.6.0 2017-04-09 12:12:32 +08:00
qingwei.li 4f98497284 bump: 3.6.0 2017-04-09 12:12:21 +08:00
cinwell.liandGitHub 9220523a40 feat(render): add mergeNavbar option, close #125, #124 (#145) 2017-04-09 12:10:37 +08:00
qingwei.li b8100c0755 -> v3.5.2 2017-04-05 21:31:27 +08:00
qingwei.li be0230ebe9 bump: 3.5.2 2017-04-05 21:31:22 +08:00
cinwell.liandGitHub aa6d2afce8 Merge pull request #143 from bojand/master
Properly handle anchor links local within a file. Fix #142
2017-04-01 10:26:36 +08:00
Bojan Djurkovic a706203879 add optional current route param to toURL and use it to properly compose local anchor links 2017-03-31 09:08:05 -03:00
Bojan Djurkovic fbc75bdb95 fix code style by removing semicolons 2017-03-30 20:37:26 -03:00
Bojan Djurkovic 5af174bd20 in toURL test for anchor links and if so prepend the currentPath to the generated path. fixes #142 2017-03-30 20:26:53 -03:00
qingwei.li e70327ab2b -> v3.5.1 2017-03-25 16:26:11 +08:00
qingwei.li 7209b82982 bump: 3.5.1 2017-03-25 16:26:07 +08:00
qingwei.li 594299ffbd fix: .md file extension regex 2017-03-25 16:25:03 +08:00
qingwei.li e9bbfd4c53 -> v3.5.0 2017-03-25 15:53:32 +08:00
qingwei.li 96bc09211e bump: 3.5.0 2017-03-25 15:53:23 +08:00
qingwei.li 8f11653b41 feat(route): auto remove .md extension 2017-03-25 15:52:21 +08:00
cinwell.liandGitHub 6aae64fd54 Merge pull request #138 from jrappen/master
Fixing some minor issues
2017-03-19 18:45:43 +08:00
Johannes Rappen 33b7c512bb fix QingWei-Li/docsify#126 2017-03-18 23:22:25 +01:00
Johannes Rappen bf35471a2b fix: adjust display on small screens 2017-03-18 19:09:24 +01:00
Johannes Rappen b022aaf14e fix: navbar labels for German 2017-03-18 18:01:44 +01:00
Johannes Rappen 03d8281868 update helper files 2017-03-18 17:21:59 +01:00
Johannes Rappen 4a0cfa799e move settings into a single object 2017-03-18 17:11:07 +01:00
qingwei.li 2c2ac5f461 -> v3.4.4 2017-03-17 17:12:47 +08:00
qingwei.li 1edcd63cdb bump: 3.4.4 2017-03-17 17:12:41 +08:00
qingwei.li 2d6a51b057 fix(search): fix input style 2017-03-17 17:11:46 +08:00
cinwell.liandGitHub bf1ae7802d Merge pull request #135 from xsdlr/master
fix search plugin match bug
2017-03-17 16:45:49 +08:00
xsdlr cf9b7c99e4 fix search plugin match bug 2017-03-16 18:29:02 +08:00
qingwei.li c20f3298d8 -> v3.4.3 2017-03-16 08:51:01 +08:00
qingwei.li dd7d9aa4ad bump: 3.4.3 2017-03-16 08:50:51 +08:00
qingwei.li bba957d3bc docs: add docsify-ignore 2017-03-16 08:48:21 +08:00
cinwell.liandGitHub 28b3cb4249 Merge pull request #133 from jrappen/master
fix erroneously removal of "themes" from files, fix #132
2017-03-16 07:06:26 +08:00
Johannes Rappen 97e730d7e3 fix erroneously removal of "themes" from files, fix QingWei-Li/docsify#132 2017-03-16 00:00:02 +01:00
cinwell.liandGitHub 65a6b3c659 Merge pull request #132 from jrappen/master
fix some minor issues
2017-03-16 06:37:26 +08:00
Johannes Rappen f6b827f7bc fix some links 2017-03-15 22:32:33 +01:00
Johannes Rappen 24d1b0feb6 use rem instead of em, fix QingWei-Li/docsify#116 2017-03-15 22:23:48 +01:00
Johannes Rappen 54da5fb6c8 update package.json
* remove "themes" from "files" as it is a subfolder of "src"
* reorder elements
* update dependencies
* update devDependencies
* make author a dictionary
2017-03-15 22:07:28 +01:00
Chris Anselmoandcinwell.li d57b80e224 Add ability to ignore headers when generating toc (#127)
* Added ability to ignore some or all headings when generating toc in sidebar

* Added documentation for ignoring sub headers

* Fixed minor test issues
2017-03-15 15:50:26 +08:00
cinwell.liandGitHub 788bbb36b4 Merge pull request #122 from Leopoldthecoder/master
fix external-script not inserting script at right place
2017-03-12 20:54:17 +08:00
Leopoldthecoder 92070e3099 fix external-script not inserting script at right place 2017-03-12 20:18:46 +08:00
qingwei.li de0ad0f04c docs(index.html): update languages 2017-03-12 08:44:52 +08:00
qingwei.li ceafc37bb3 docs(index.html): update config 2017-03-12 08:27:29 +08:00
cinwell.liandGitHub 1f19cb2ade Merge pull request #121 from jrappen/master
add German docs
2017-03-12 08:10:42 +08:00
Johannes Rappen 33393ef0f6 add German docs 2017-03-11 22:13:25 +01:00
83 changed files with 2619 additions and 869 deletions
+1
View File
@@ -0,0 +1 @@
.git/
+3 -1
View File
@@ -1,5 +1,7 @@
{
"extends": ["vue"],
"extends": [
"vue"
],
"env": {
"browser": true
},
+5
View File
@@ -0,0 +1,5 @@
Please makes sure these boxes are checked before submitting your PR, thank you!
* [ ] Make sure you are merging your commits to `master` branch.
* [ ] Add some descriptions and refer relative issues for you PR.
* [ ] DO NOT include files inside lib directory.
+2 -2
View File
@@ -1,4 +1,4 @@
.DS_Store
*.log
.DS_Store
/themes
node_modules
/themes
+5
View File
@@ -0,0 +1,5 @@
.eslintignore
.eslintrc
.github/
.gitignore
.travis.yml
+4 -1
View File
@@ -1,6 +1,9 @@
sudo: false
cache:
directories:
- $HOME/.yarn-cache
- $HOME/.yarn-cache
language: node_js
node_js: stable
os:
- linux
- osx
+83 -16
View File
@@ -1,79 +1,146 @@
# Changelog
# 3.4.2 / 2017-03-11
## 3.7.1 / 2017-05-19
* fix: docsify-updated is undefined
## 3.7.0 / 2017-05-16
* feat: add externalLinkTarget, close ([#149](https://github.com/QingWei-Li/docsify/issues/149)
* feat: add **{docsify-updated<span>}</span>**, close ([#158](https://github.com/QingWei-Li/docsify/issues/158)
## 3.6.6 / 2017-05-06
* feat: support query string for the search, likes `https://docsify.js.org/#/?s=navbar`, fixed ([#156](https://github.com/QingWei-Li/docsify/issues/156)
## 3.6.5 / 2017-04-28
* fix(util): fix crash, fixed ([#154](https://github.com/QingWei-Li/docsify/issues/154)
## 3.6.4 / 2017-04-28
* fix(util): correctly clean up duplicate slashes, fixed ([#153](https://github.com/QingWei-Li/docsify/issues/153)
## 3.6.3 / 2017-04-25
* fix(external-script): script attrs
## 3.6.2/ 2017-04-12
* feat(external-script): detect more than one script dom, fixed ([#146](https://github.com/QingWei-Li/docsify/issues/146)
* GA: Send hash instead of complete href ([#147](https://github.com/QingWei-Li/docsify/issues/147)
## 3.6.1 / 2017-04-09
* feat(event): Collapse the sidebar when click outside element in the small screen
## 3.6.0 / 2017-04-09
* feat(render): add mergeNavbar option, close ([#125](https://github.com/QingWei-Li/docsify/issues/125)
## 3.5.2/ 2017-04-05
* add optional current route param to toURL and use it to properly compose local anchor links
* fix code style by removing semicolons
* in toURL test for anchor links and if so prepend the currentPath to the generated path. fixes ([#142](https://github.com/QingWei-Li/docsify/issues/142))
## 3.5.1 / 2017-03-25
* fix: .md file extension regex
## 3.5.0 / 2017-03-25
* feat(route): auto remove .md extension
* fix: adjust display on small screens [@jrappen](https://github.com/jrappen)
* fix: navbar labels for German [@jrappen](https://github.com/jrappen)
## 3.4.4 / 2017-03-17
* fix(search): fix input style
* fix search plugin match bug
## 3.4.3 / 2017-03-16
* Add ability to ignore headers when generating toc ([#127](https://github.com/QingWei-Li/docsify/issues/127) [@christopherwk210](https://github.com/christopherwk210))
* fix external-script not inserting script at right place [@Leopoldthecoder](https://github.com/Leopoldthecoder)
* add German docs [@jrappen](https://github.com/jrappen)
## 3.4.2 / 2017-03-11
* feat(emojify): add no-emoji option
# 3.4.1 / 2017-03-10
## 3.4.1 / 2017-03-10
* fix(dom): Disable the dom cache when vue is present, fixed [#119](https://github.com/QingWei-Li/docsify/issues/119)
* update english docs, [@jrappen](https://github.com/jrappen)
# 3.4.0 / 2017-03-09
## 3.4.0 / 2017-03-09
* feat(zoom-image): add plugin
# 3.3.0 / 2017-03-07
## 3.3.0 / 2017-03-07
* add front-matter plugin
* add external-script plugin, [@Leopoldthecoder](https://github.com/Leopoldthecoder)
* Fix nav showing while loading ([#112](https://github.com/QingWei-Li/docsify/issues/112))
# 3.2.0 / 2017-02-28
## 3.2.0 / 2017-02-28
* fix(render): Toc rendering error, fixed [#106](https://github.com/QingWei-Li/docsify/issues/106)
* feat(search): Localization for no data tip, close [#103](https://github.com/QingWei-Li/docsify/issues/103)
* fix(fetch): load sidebar and navbar for parent path, fixed [#100](https://github.com/QingWei-Li/docsify/issues/100)
* feat(render) nameLink for each route, fixed [#99](https://github.com/QingWei-Li/docsify/issues/99)
# 3.1.2 / 2017-02-27
## 3.1.2 / 2017-02-27
* fix(search): dont search nameLink, fixed [#102](https://github.com/QingWei-Li/docsify/issues/102)
# 3.1.1 / 2017-02-24
## 3.1.1 / 2017-02-24
* fix(search): dont search nameLink, fixed [#102](https://github.com/QingWei-Li/docsify/issues/102)
* fix(render): custom cover background image
* fix(tpl): extra character, fixed [#101](https://github.com/QingWei-Li/docsify/issues/101)
# 3.1.0 / 2017-02-22
## 3.1.0 / 2017-02-22
* fix(search): incorrect anchor link, fixed [#90](https://github.com/QingWei-Li/docsify/issues/90)
* feat(emoji): add emoji plugin
# 3.0.5 / 2017-02-21
## 3.0.5 / 2017-02-21
* feat(pwa): add sw.js
* fix(layout.css): loading style
* fix(event): highlight sidebar when clicked, fixed [#86](https://github.com/QingWei-Li/docsify/issues/86)
* fix(gen-tree): cache toc list, fixed [#88](https://github.com/QingWei-Li/docsify/issues/88)
# 3.0.4 / 2017-02-20
## 3.0.4 / 2017-02-20
* fix(render): execute script
* fix(render): disable rendering sub list when loadSidebar is false
# 3.0.3 / 2017-02-19
## 3.0.3 / 2017-02-19
* fixed look of links in blockquote
* fix(scroll) highlight bug
# 3.0.2 / 2017-02-19
## 3.0.2 / 2017-02-19
* fix(search): add lazy input
* fix(compiler): link
# 3.0.1 / 2017-02-19
## 3.0.1 / 2017-02-19
* fix(route): empty alias
# 3.0.0 / 2017-02-19
## 3.0.0 / 2017-02-19
#### Breaking change
##### Breaking change
* Not support IE9
* The route becomes: `/#/page?id=slug`. The previous route will be redirected
#### Features
##### Features
* Faster rendering
* Clearer source code
+5 -3
View File
@@ -9,7 +9,7 @@
</p>
<p align="center">
<a href="https://travis-ci.org/QingWei-Li/docsify"><img alt="Travis Status" src="https://img.shields.io/travis/rust-lang/rust/master.svg?style=flat-square"></a>
<a href="https://travis-ci.org/QingWei-Li/docsify"><img alt="Travis Status" src="https://img.shields.io/travis/QingWei-Li/docsify/master.svg?style=flat-square"></a>
<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://github.com/QingWei-Li/donate"><img alt="donate" src="https://img.shields.io/badge/%24-donate-ff69b4.svg?style=flat-square"></a>
</p>
@@ -39,12 +39,12 @@ Create an `index.html`.
<html>
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="//unpkg.com/docsify/themes/vue.css">
<link rel="stylesheet" href="//unpkg.com/docsify/lib/themes/vue.css">
</head>
<body>
<div id="app"></div>
</body>
<script src="//unpkg.com/docsify"></script>
<script src="//unpkg.com/docsify/lib/docsify.min.js"></script>
</html>
```
@@ -64,6 +64,8 @@ These open-source projects are using docsify to generate their sites. Pull reque
| [Vudash](http://vudash.github.io/vudash/) | Powerful, Flexible, Open Source dashboards for anything |
| [Trilogy](http://trilogy.js.org) | No-hassle SQLite with a Promise-based, document store style API. |
| [Mybatis-Plus](http://mp.baomidou.com/) | An enhanced toolkit of Mybatis to simplify development |
| [JS MythBusters](https://mythbusters.js.org) | An optimization handbook from a high level point of view. |
| [hire-me](https://fvcproductions.github.io/hire-me) | A path to getting an awesome tech gig. |
## Similar projects
+1 -1
View File
@@ -4,7 +4,7 @@ var fs = require('fs')
http.createServer(function (req, res) {
serveStatic('.')(req, res, function () {
res.writeHead(404, { 'Content-Type': 'text/html' })
res.writeHead(200, { 'Content-Type': 'text/html' })
res.end(fs.readFileSync('dev.html'))
})
}).listen(3000, '0.0.0.0')
+23 -12
View File
@@ -7,28 +7,39 @@
<link rel="stylesheet" href="/themes/vue.css" title="vue">
<link rel="stylesheet" href="/themes/dark.css" title="dark" disabled>
<link rel="stylesheet" href="/themes/buble.css" title="buble" disabled>
<style>
nav.app-nav li ul {
min-width: 100px;
}
</style>
</head>
<body>
<nav data-cloak>
<a href="#/">EN</a>
<a href="#/zh-cn/">中文</a>
</nav>
<div id="app"></div>
</body>
<script>
window.$docsify = {
alias: {
'/de-de/changelog': '/changelog',
'/zh-cn/changelog': '/changelog',
'/changelog': 'https://raw.githubusercontent.com/QingWei-Li/docsify/master/CHANGELOG'
},
executeScript: true
auto2top: true,
basePath: '/docs/',
executeScript: true,
loadNavbar: true,
loadSidebar: true,
name: 'docsify',
subMaxLevel: 2,
mergeNavbar: true,
formatUpdated: '{MM}/{DD} {HH}:{mm}',
plugins: [
function(hook) {
hook.beforeEach(function (html) {
return html += '> Last modified {docsify-updated}'
})
}
]
}
</script>
<script
src="/lib/docsify.js"
data-name="docsify"
data-base-path="/docs/"
data-load-sidebar
data-sub-max-level="2"
data-auto2top></script>
<script src="/lib/docsify.js"></script>
</html>
+2 -2
View File
@@ -4,9 +4,9 @@
## What is it
docsify generates your documentation website on the fly. Unlike GitBook, it does not generate static html files. Instead, it smartly loads and parses your Markdown files and displays them as website. All you need to do is create an `index.html` to start and [deploy it on GitHub Pages](/deploy).
docsify generates your documentation website on the fly. Unlike GitBook, it does not generate static html files. Instead, it smartly loads and parses your Markdown files and displays them as website. All you need to do is create an `index.html` to start and [deploy it on GitHub Pages](deploy.md).
See the [Quick start](/quickstart) for more details.
See the [Quick start](quickstart.md) for more details.
## Features
+1 -1
View File
@@ -1,6 +1,6 @@
![logo](_media/icon.svg)
# docsify <small>3.4</small>
# docsify <small>3.7</small>
> A magical documentation site generator.
+4
View File
@@ -0,0 +1,4 @@
- Translations
- [:cn: 中文](/zh-cn/)
- [:de: Deutsch](/de-de/)
- [:uk: English](/)
+16 -16
View File
@@ -1,22 +1,22 @@
- Getting started
- [Quick start](/quickstart)
- [Writing more pages](/more-pages)
- [Custom navbar](/custom-navbar)
- [Cover page](/cover)
- [Quick start](quickstart.md)
- [Writing more pages](more-pages.md)
- [Custom navbar](custom-navbar.md)
- [Cover page](cover.md)
- Customization
- [Configuration](/configuration)
- [Themes](/themes)
- [List of Plugins](/plugins)
- [Write a Plugin](/write-a-plugin)
- [Markdown configuration](/markdown)
- [Language highlighting](/language-highlight)
- [Configuration](configuration.md)
- [Themes](themes.md)
- [List of Plugins](plugins.md)
- [Write a Plugin](write-a-plugin.md)
- [Markdown configuration](markdown.md)
- [Language highlighting](language-highlight.md)
- Guide
- [Deploy](/deploy)
- [Helpers](/helpers)
- [Vue compatibility](/vue)
- [CDN](/cdn)
- [Offline Mode(PWA)](/pwa)
- [Deploy](deploy.md)
- [Helpers](helpers.md)
- [Vue compatibility](vue.md)
- [CDN](cdn.md)
- [Offline Mode(PWA)](pwa.md)
- [Changelog](/changelog)
- [Changelog](changelog.md)
+4 -1
View File
@@ -44,4 +44,7 @@ Alternatively, use [compressed files](#compressed-files).
## Other CDN
[jsDelivr](http://www.jsdelivr.com/projects/docsify) is available.
- http://www.bootcdn.cn/docsify
- http://www.jsdelivr.com/projects/docsify
- https://cdnjs.com/libraries/docsify
+38 -3
View File
@@ -166,7 +166,7 @@ window.$docsify = {
- Type: `Boolean|String`
- Default: `false`
Activate the [cover feature](/cover). If true, it will load from `_coverpage.md`.
Activate the [cover feature](cover.md). If true, it will load from `_coverpage.md`.
```js
window.$docsify = {
@@ -212,7 +212,7 @@ window.$docsify = {
- Type: `Function`
See [Markdown configuration](/markdown).
See [Markdown configuration](markdown.md).
```js
window.$docsify = {
@@ -294,7 +294,7 @@ window.$docsify = {
</script>
```
Note that if you are running an external script, e.g. an embedded jsfiddle demo, make sure to include the [external-script](plugins?id=external-script) plugin.
Note that if you are running an external script, e.g. an embedded jsfiddle demo, make sure to include the [external-script](plugins.md?id=external-script) plugin.
## no-emoji
@@ -305,3 +305,38 @@ window.$docsify = {
noEmoji: true
}
```
## merge-navbar
Navbar will be merged with the sidebar on smaller screens.
```js
window.$docsify = {
mergeNavbar: true
}
```
## format-updated
We can display the file update date through **{docsify-updated<span>}</span>** variable. And format it by `formatUpdated`.
See https://github.com/lukeed/tinydate#patterns
```js
window.$docsify = {
formatUpdated: '{MM}/{DD} {HH}:{mm}',
formatUpdated: function (time) {
// ...
return time
}
}
```
## external-link-target
Currently it defaults to _blank, would be nice if configurable:
```js
window.$docsify = {
externalLinkTarget: '_self' // default: '_blank'
}
```
+1 -1
View File
@@ -1,6 +1,6 @@
# Cover
Activate the cover feature by setting `coverpage` to **true**, compare [coverpage configuration](configuration#coverpage).
Activate the cover feature by setting `coverpage` to **true**, compare [coverpage configuration](configuration.md#coverpage).
## Basic usage
+10 -10
View File
@@ -20,7 +20,7 @@ If you need custom navigation, you can create a HTML-based navigation bar.
## Markdown
Alternatively, you can create a custom markdown-based navigation file by setting `loadNavbar` to **true** and creating `_navbar.md`, compare [load-navbar configuration](configuration#load-navbar).
Alternatively, you can create a custom markdown-based navigation file by setting `loadNavbar` to **true** and creating `_navbar.md`, compare [load-navbar configuration](configuration.md#load-navbar).
```html
<!-- index.html -->
@@ -52,17 +52,17 @@ You can create sub-lists by indenting items that are under a certain parent.
<!-- _navbar.md -->
- Getting started
- [Quick start](/quickstart)
- [Writing more pages](/more-pages)
- [Custom navbar](/custom-navbar)
- [Cover page](/cover)
- [Quick start](quickstart.md)
- [Writing more pages](more-pages.md)
- [Custom navbar](custom-navbar.md)
- [Cover page](cover.md)
- Configuration
- [Configuration](/configuration)
- [Themes](/themes)
- [Using plugins](/plugins)
- [Markdown configuration](/markdown)
- [Language highlight](/language-highlight)
- [Configuration](configuration.md)
- [Themes](themes.md)
- [Using plugins](plugins.md)
- [Markdown configuration](markdown.md)
- [Language highlight](language-highlight.md)
```
renders as
+27
View File
@@ -0,0 +1,27 @@
## docsify
> Ein magischer Generator für Dokumentationen.
## Was ist das
**docsify** generiert deine Dokumentationswebseite zeitgleich (mit der Darstellung). Im Gegensatz zu GitBook, werden keine statischen HTML Seiten generiert. Stattdessen, werden im Hintergrund Markdown Dateien geladen und umgewandelt, und als Webseite dargestellt. Alles, was du brauchst, ist eine Datei namens `index.html`, um sie über [GitHub Pages zu veröffentlichen](de-de/deploy.md).
Siehe [Schnellstart](de-de/quickstart.md) für weitere Informationen.
## Features
* keine generierten, statischen HTML Dateien
* einfach und klein (~16kB gzipped)
* smarte Erweiterung mit Volltextsuche
* mehrere Themes
* praktische API für Erweiterungen
* Unterstützung für Emoji
* Kompatibel mit IE10+
## Beispiele
Vergleiche die Liste namens [Showcase](https://github.com/QingWei-Li/docsify/#showcase) mit Beispielen, wie **docsify** verwendet wird.
## Spenden
Bitte ziehe eine Spende in Erwägung, sollte **docsify** dir hilfreich oder meine Arbeit dir wertvoll erscheinen. Ich freue mich, wenn du mir [eine Tasse Kaffee kaufst](https://github.com/QingWei-Li/donate). :heart:
+22
View File
@@ -0,0 +1,22 @@
- Loslegen
- [Schnellstart](de-de/quickstart.md)
- [Schreiben weiterer Seiten](de-de/more-pages.md)
- [Navigationsleiste anpassen](de-de/custom-navbar.md)
- [Titelseite](de-de/cover.md)
- Anpassen
- [Einstellungen](de-de/configuration.md)
- [Themen](de-de/themes.md)
- [Liste der Erweiterungen](de-de/plugins.md)
- [Schreiben eigener Erweiterungen](de-de/write-a-plugin.md)
- [Markdown-Einstellungen](de-de/markdown.md)
- [Hervorheben von Sprachen](de-de/language-highlight.md)
- Guide
- [Inbetriebnahme](de-de/deploy.md)
- [Helfer](de-de/helpers.md)
- [Vue Kompatibilität](de-de/vue.md)
- [CDN](de-de/cdn.md)
- [Offline Modus (PWA)](de-de/pwa.md)
- [Changelog](de-de/changelog.md)
+49
View File
@@ -0,0 +1,49 @@
# CDN
Empfohlen: [unpkg](//unpkg.com), welches jeweils die aktuelle Version liefert, wie sie über npm veröffentlicht wurde. Du kannst auch den Quellcode des npm Packets über [unpkg.com/docsify/](//unpkg.com/docsify/) anschauen.
## Aktuelle Version
```html
<!-- lade CSS -->
<link rel="stylesheet" href="//unpkg.com/docsify/themes/vue.css">
<!-- lade Script -->
<script src="//unpkg.com/docsify/lib/docsify.js"></script>
```
Alternativ kannst du auch die [komprimierten Dateien](#komprimierte-dateien) verwenden.
## Spezielle Version
```html
<!-- lade CSS -->
<link rel="stylesheet" href="//unpkg.com/docsify@2.0.0/themes/vue.css">
<!-- lade Script -->
<script src="//unpkg.com/docsify@2.0.0/lib/docsify.js"></script>
```
## Komprimierte Dateien
```html
<!-- lade CSS -->
<link rel="stylesheet" href="//unpkg.com/docsify/lib/themes/vue.css">
<!-- lade Script -->
<script src="//unpkg.com/docsify/lib/docsify.min.js"></script>
```
```html
<!-- lade CSS -->
<link rel="stylesheet" href="//unpkg.com/docsify@2.0.0/lib/themes/vue.css">
<!-- lade Script -->
<script src="//unpkg.com/docsify@2.0.0/lib/docsify.min.js"></script>
```
## Andere CDN
- http://www.bootcdn.cn/docsify
- http://www.jsdelivr.com/projects/docsify
- https://cdnjs.com/libraries/docsify
+342
View File
@@ -0,0 +1,342 @@
# Einstellungen
**docsify** unterstützt zwei verschiedene Arten, um die Einstellungen anzupassen. Du kannst das `window.$docsify` anpassen, oder die Einstellungen über das script tag im `data-*` Attribut vornehmen.
```html
<!-- über $docsify -->
<script>
window.$docsify = {
repo: 'QingWei-Li/docsify',
maxLevel: 3,
coverpage: true
}
</script>
<!-- oder data-* -->
<script
src="//unpkg.com/docsify"
data-repo="QingWei-Li/docsify"
data-max-level="3"
data-coverpage>
</script>
```
Beide Arten sind miteinander kompatibel, wobei die erste jedoch empfohlen wird. Sie ist deutlicher und kann in einer separaten Datei geführt werden.
!> Innerhalb des `window.$docsfiy` sollten die Optionen mit camelCase geschrieben werden.
## el
- Typ: `String`
- Standard: `#app`
Das DOM Element kann bei der Initialisierung gesetzt werden. Es kann ein CSS selector string oder ein richtiges HTMLElement sein.
```js
window.$docsify = {
el: '#app'
}
```
## repo
- Typ: `String`
- Standard: `null`
Verwende die repository URL oder eine Zeichenfolge aus `Benutzername/repo`, um das [GitHub Corner](http://tholman.com/github-corners/) widget in die obere rechte Ecke der Seite zu implementieren.
```js
window.$docsify = {
repo: 'QingWei-Li/docsify',
// oder
repo: 'https://github.com/QingWei-Li/docsify/'
}
```
## max-level
- Typ: `Number`
- Standard: `6`
Maximale Anzahl der Inhaltsübersichtebenen.
```js
window.$docsify = {
maxLevel: 4
}
```
## load-navbar
- Typ: `Boolean|String`
- Standard: `false`
Lädt die Navigationsleiste von der Markdown Datei `_navbar.md` falls **true**, oder vom gewählten Pfad.
```js
window.$docsify = {
// lade von _navbar.md
loadNavbar: true,
// lade von nav.md
loadNavbar: 'nav.md'
}
```
## load-sidebar
- Typ: `Boolean|String`
- Standard: `false`
Lädt das seitliche Inhaltsverzeichnis von der Markdown Datei `_sidebar.md` falls **true**, oder vom gewählten Pfad.
```js
window.$docsify = {
// lade von _sidebar.md
loadSidebar: true,
// lade von summary.md
loadSidebar: 'summary.md'
}
```
## sub-max-level
- Typ: `Number`
- Standard: `0`
Wähle die maximale Anzahl der Unterpunkte pro Datei in der Inhaltsübersicht.
```js
window.$docsify = {
subMaxLevel: 2
}
```
## auto2top
- Typ: `Boolean`
- Standard: `false`
Scrolle zum Anfang der Seite, wenn die Route gewechselt wird.
```js
window.$docsify = {
auto2top: true
}
```
## homepage
- Typ: `String`
- Standard: `README.md`
`README.md` in deinem Ordner für die Dokumentation wird als Startseite für deine Webseite gesetzt, aber manchmal musst du das vielleicht ändern.
```js
window.$docsify = {
// Wähle /home.md
homepage: 'home.md',
// Oder verwende das README in deinem repo
homepage: 'https://raw.githubusercontent.com/QingWei-Li/docsify/master/README.md'
}
```
## base-path
- Typ: `String`
Der Basispfad der Webseite. Du kannst einen anderen Ordner wählen, oder eine andere Domain.
```js
window.$docsify = {
basePath: '/path/',
// Lade die Dateien von einer anderen Domain
basePath: 'https://docsify.js.org/',
// Oder lade Dateien von einem anderen repo
basePath: 'https://raw.githubusercontent.com/ryanmcdermott/clean-code-javascript/master/'
}
```
## coverpage
- Typ: `Boolean|String`
- Standard: `false`
Aktiviere das [Titelseitenfeature](de-de/cover.md). Falls `true`, wird sie von `_coverpage.md` geladen.
```js
window.$docsify = {
coverpage: true,
// Anderer Dateiname
coverpage: 'cover.md'
}
```
## name
- Typ: `String`
Webseitenname, wie er in der Inhaltsübersicht in der Seitenleiste angezeigt wird.
```js
window.$docsify = {
name: 'docsify'
}
```
## name-link
- Typ: `String`
- Standard: `window.location.pathname`
Der Name der Links.
```js
window.$docsify = {
nameLink: '/',
// Für jede Route
nameLink: {
'/zh-cn/': '/zh-cn/',
'/': '/'
}
}
```
## markdown
- Typ: `Function`
Siehe [Markdown Konfiguration](de-de/markdown.md).
```js
window.$docsify = {
// Objekt
markdown: {
smartypants: true,
renderer: {
link: function() {
// ...
}
}
},
// Funktion
markdown: function (marked, renderer) {
// ...
return marked
}
}
```
## theme-color
- Typ: `String`
Passe die Farbe der Themen an. Verwende [CSS3 Variablen](https://developer.mozilla.org/en-US/docs/Web/CSS/Using_CSS_variables) und polyfill in älteren Browsern.
```js
window.$docsify = {
themeColor: '#3F51B5'
}
```
## alias
- Typ: `Object`
Verwende alternative Routen. Du kannst sie ungehindert anpassen.
```js
window.$docsify = {
alias: {
'/zh-cn/changelog': '/changelog',
'/changelog': 'https://raw.githubusercontent.com/QingWei-Li/docsify/master/CHANGELOG'
}
}
```
## auto-header
- Typ: `Boolean`
Sollten `loadSidebar` und `autoHeader` beide aktiviert sein, setze einen Header vor die Seite in jedem Link in `_sidebar.md`, bevor sie in HTML umgewandelt wird. Vergleiche [#78](https://github.com/QingWei-Li/docsify/issues/78).
```js
window.$docsify = {
loadSidebar: true,
autoHeader: true
}
```
## execute-script
- Typ: `Boolean`
Führe das Skript auf der Seite aus. Analysiere nur das erste script tag ([demo](de-de/themes.md)). Sollte Vue verwendet sein, wird es in der Standardeinstellung ausgeführt.
```js
window.$docsify = {
executeScript: true
}
```
```markdown
## Dies ist ein Test
<script>
console.log(2333)
</script>
```
?> Nehme zur Kenntnis, dass, solltest du ein externes Skript ausführen, z.B. ein eingebettete jsfiddle demo, du sicher gehen solltest, das [external-script](de-de/plugins.md?id=external-script) plugin zu verwenden.
## no-emoji
Verhindere die Umwandlung in Emojis:
```js
window.$docsify = {
noEmoji: true
}
```
## merge-navbar
Navbar will be merged with the sidebar on smaller screens.
```js
window.$docsify = {
mergeNavbar: true
}
```
## format-updated
We can display the file update date through **{docsify-updated<span>}</span>** variable. And format it by `formatUpdated`.
See https://github.com/lukeed/tinydate#patterns
```js
window.$docsify = {
formatUpdated: '{MM}/{DD} {HH}:{mm}',
formatUpdated: function (time) {
// ...
return time
}
}
```
## external-link-target
Currently it defaults to _blank, would be nice if configurable:
```js
window.$docsify = {
externalLinkTarget: '_self' // default: '_blank'
}
```
+56
View File
@@ -0,0 +1,56 @@
# Titelseite
Aktiviere die Unterstützung für Titelseiten, indem du `coverpage` auf **true** einstellst, vergleiche [coverpage Einstellungen](configuration.md#coverpage).
## Einfache Verwendung
Setze `coverpage` auf **true**, und erstelle `_coverpage.md`:
```html
<!-- index.html -->
<script>
window.$docsify = {
coverpage: true
}
</script>
<script src="//unpkg.com/docsify/lib/docsify.min.js"></script>
```
```markdown
<!-- _coverpage.md -->
![logo](_media/icon.svg)
# docsify <small>3.5</small>
> Ein magischer Generator für Dokumentationsseiten.
- Einfach und wenig Speicherbedarf (~16kB gzipped)
- Keine statischen HTML Dateien
- Mehrere Themes
[GitHub](https://github.com/QingWei-Li/docsify/)
[Schnellstart](#docsify)
```
!> Die Dokumentationsseiten können nur eine Titelseite haben!
## Eigener Hintergrund
Die Hintergrundfarbe wird in der Standardeinstellung zufällig generiert. Du kannst sie anpassen, oder auch ein Hintergrundbild verwenden:
```markdown
<!-- _coverpage.md -->
# docsify <small>3.5</small>
[GitHub](https://github.com/QingWei-Li/docsify/)
[Schnellstart](#quick-start)
<!-- Hintegrundbild -->
![](_media/bg.png)
<!-- Hintegrundfarbe -->
![color](#f0f0f0)
```
+95
View File
@@ -0,0 +1,95 @@
# Navigationsleiste anpassen
## HTML
Solltest du eine Navigationsleiste benötigen, so kannst du eine HTML-basierte erstellen.
!> Die Links der Dokumentation fangen alle mit `#/` an.
```html
<!-- index.html -->
<body>
<nav>
<a href="#/">EN</a>
<a href="#/de-de/">DE</a>
</nav>
<div id="app"></div>
</body>
```
## Markdown
Oder du kannst deine Navigationsleiste mit einer Datei basierend auf Markdown erstellen, indem du `loadNavbar` auf **true** setzt und eine Datei namens `_navbar.md` erstellst, vergleiche [load-navbar Einstellungen](configuration.md#load-navbar).
```html
<!-- index.html -->
<script>
window.$docsify = {
loadNavbar: true
}
</script>
<script src="//unpkg.com/docsify/lib/docsify.min.js"></script>
```
```markdown
<!-- _navbar.md -->
- [En](/)
- [Deutsch](/de-de/)
```
!> Solltest du Github Pages verwenden, musst du zusätzlich eine Datei namens `.nojekyll` in `./docs` erstellen, um zu verhindern, dass Github Dateien ignoriert, die mit einem Unterstrich anfangen.
`_navbar.md` wird in jedem Verzeichnislevel geladen. Sollte das aktuelle Verzeichnis keine Datei namens `_navbar.md` haben, so sucht **docsify** in den übergeordneten Ordnern. Wenn du z.B. im Moment im Verzeichnis `/guide/quick-start` bist, so wird `_navbar.md` von der Datei `/guide/_navbar.md` geladen.
## Aufbauen von Strukturen
Du kannst untergeordnete Listen erstellen, indem du untergeordnete Punkte einem übergeordneten Punkt gegenüber einrückst.
```markdown
<!-- _navbar.md -->
- Getting started
- [Quick start](de-de/quickstart.md)
- [Writing more pages](de-de/more-pages.md)
- [Custom navbar](de-de/custom-navbar.md)
- [Cover page](de-de/cover.md)
- Configuration
- [Configuration](de-de/configuration.md)
- [Themes](de-de/themes.md)
- [Using plugins](de-de/plugins.md)
- [Markdown configuration](de-de/markdown.md)
- [Language highlight](de-de/language-highlight.md)
```
wird also wie folgt aussehen
![Nesting navbar](_images/nested-navbar.png "Nesting navbar")
## Angepasste Navigationsleisten in Verbindung mit dem emoji Erweiterung
Solltest du die [emoji Erweiterung](plugins.md#emoji) verwenden:
```html
<!-- index.html -->
<script>
window.$docsify = {
// ...
}
</script>
<script src="//unpkg.com/docsify/lib/docsify.min.js"></script>
<script src="//unpkg.com/docsify/lib/plugins/emoji.min.js"></script>
```
so kannst du z.B. auch die Flaggenemojis in der Markdown Datei für deine angepasste Navigationsleiste verwenden:
```markdown
<!-- _navbar.md -->
- [:us:, :uk:](/)
- [:de:](/de-de/)
```
+33
View File
@@ -0,0 +1,33 @@
# Inbetriebnahme
Ähnlich wie bei [GitBook](https://www.gitbook.com), kannst du deine Dateien über GitHub Pages oder VPS erstellen.
## GitHub Pages
Du kannst folgende drei Orte verwenden, um die Dokumentation für dein Github repository zu verwalten:
* `docs/` Ordner
* master branch
* gh-pages branch
Es wird empfohlen, deine Dateien im `./docs` Unterordner im `master` branch deines repository zu speichern. Wechsle dann zu den Einstellungen deines repository und wähle `master branch /docs folder` als deine Github Pages Quelle.
![github pages](_images/deploy-github-pages.png)
!> Du kannst die Dateien auch im Hauptverzeichnis speichern und dann `master branch` in den Einstellungen auswählen.
## VPS
Verwende folgende nginx config.
```nginx
server {
listen 80;
server_name your.domain.com;
location / {
alias /path/to/dir/of/docs;
index index.html;
}
}
```
+27
View File
@@ -0,0 +1,27 @@
# Dokumentationshelfer
docsify erweitert die Markdownsyntax, um deine Dokumente besser lesbar zu machen.
## Wichtiger Inhalt
Wichtiger Inhalt wie:
```markdown
!> **Zeit** ist Geld, mein Freund!
```
wird wie folgt gerendert:
!> **Zeit** ist Geld, mein Freund!
## Generelle Tipps
Generelle Tipps wie:
```markdown
?> *TODO* unit test
```
wird wie folgt gerendert:
?> *TODO* unit test
+11
View File
@@ -0,0 +1,11 @@
# Hervorheben von Sprachen
**docsify** verwendet [Prism](https://github.com/PrismJS/prism) um Quellcodeabschnitte in deinen Seiten hervorzuheben. Als Standardeinstellung werden nur CSS, JavaScipt und HTML unterstützt. Du kannst **Prism** auch mit weiteren Sprachen verwenden:
```html
<script src="//unpkg.com/docsify/lib/docsify.min.js"></script>
<script src="//unpkg.com/prismjs/components/prism-bash.min.js"></script>
<script src="//unpkg.com/prismjs/components/prism-php.min.js"></script>
```
?> Vergleiche die [component files](https://github.com/PrismJS/prism/tree/gh-pages/components) Liste für weitere Optionen.
+30
View File
@@ -0,0 +1,30 @@
# Markdown Einstellungen
**docsify** verwendet [marked](https://github.com/chjj/marked), um Markdown umzuwandeln. Du kannst einstellen, wie es deine Markdown Seiten in HTML umwandelt, indem du `renderer` konfigurierst:
```js
window.$docsify = {
markdown: {
smartypants: true,
renderer: {
link: function() {
// ...
}
}
}
}
```
?> Für mögliche Einstellungen, siehe [marked Dokumentation](https://github.com/chjj/marked#options-1)
Du kannst die Regeln auch beliebig anpassen.
```js
window.$docsify = {
markdown: function(marked, renderer) {
// ...
return marked
}
}
```
+92
View File
@@ -0,0 +1,92 @@
# Noch mehr Seiten
Wenn du mehr Seiten für deine Dokumentation brauchst, so kannst du weitere Markdown Dateien in deinem **docsify** Ordner erstellen. Eine Datei namens `guide.md` ist dann über `/#/guide` erreichbar.
Nehmen wir als Beispiel folgende Verzeichnisstruktur:
```text
.
├── docs
| └── README.md
| └── guide.md
| └── de-de
| └──README.md
| └──guide.md
```
Die passenden Routen sind dann
```text
docs/README.md => http://domain.com
docs/guide.md => http://domain.com/guide
docs/de-de/README.md => http://domain.com/de-de/
docs/de-de/guide.md => http://domain.com/de-de/guide
```
## Seitenleiste mit Inhaltsverzeichnis anpassen
Als Standardeinstellung wird das Inhaltsverzeichnis in der Seitenleiste automatisch basierend auf vorhandenen Markdown Dateien generiert. Wenn du das seitliche Inhaltsverzeichnis anpassen willst, kannst du eine Datei namens `_sidebar.md` erstellen (vergleiche [das seitliche Inhaltsverzeichnis für diese Dokumentation](https://github.com/QingWei-Li/docsify/blob/master/docs/de-de/_sidebar.md) als Beispiel):
Als Erstes musst du `loadSidebar` auf **true** setzen, vergleiche [Einstellungen für das seitliche Inhaltsverzeichnis](configuration.md#load-sidebar).
```html
<!-- index.html -->
<script>
window.$docsify = {
loadSidebar: true
}
</script>
<script src="//unpkg.com/docsify/lib/docsify.min.js"></script>
```
Als Zweites erstellst du eine Datei namens `_sidebar.md`:
```markdown
<!-- docs/_sidebar.md -->
- [Home](/)
- [Guide](de-de/guide.md)
```
!> Solltest du Github Pages verwenden, musst du zusätzlich eine Datei namens `.nojekyll` in `./docs` erstellen, um zu verhindern, dass Github Dateien ignoriert, die mit einem Unterstrich anfangen.
`_sidebar.md` wird in jedem Verzeichnislevel geladen. Sollte das aktuelle Verzeichnis keine Datei namens `_sidebar.md` haben, so sucht **docsify** in den übergeordneten Ordnern. Wenn du z.B. im Moment im Verzeichnis `/guide/quick-start` bist, so wird `_sidebar.md` von der Datei `/guide/_sidebar.md` geladen.
## Inhaltsverzeichnis
Eine angepasste Seitenleist kann auch automatisch ein Inhaltsverzeichnis generieren, indem ein `subMaxLevel` gesetzt wird, vergleiche [sub-max-level Einstellungen](configuration.md#sub-max-level).
```html
<!-- index.html -->
<script>
window.$docsify = {
loadSidebar: true,
subMaxLevel: 2
}
</script>
<script src="//unpkg.com/docsify/lib/docsify.min.js"></script>
```
## Ignoring Subheaders
When `subMaxLevel` is set, each header is automatically added to the table of contents by default. If you want to ignore a specific header, add `{docsify-ignore}` to it.
```markdown
# Getting Started
## Header {docsify-ignore}
This header won't appear in the sidebar table of contents.
```
To ignore all headers on a specific page, you can use `{docsify-ignore-all}` on the first header of the page.
```markdown
# Getting Started {docsify-ignore-all}
## Header
This header won't appear in the sidebar table of contents.
```
Both `{docsify-ignore}` and `{docsify-ignore-all}` will not be rendered on the page when used.
+95
View File
@@ -0,0 +1,95 @@
# Liste der Erweiterungen
## Volltextsuche
Als Standardeinstellung werden Hyperlinks auf der aktuellen Seite erkannt und der Inhalt in `localStorage` gespeichert. Du kannst den Pfad zu den Dateien auch anpassen:
```html
<script>
window.$docsify = {
search: 'auto', // Standard
search : [
'/', // => /README.md
'/guide', // => /guide.md
'/get-started', // => /get-started.md
'/de-de/', // => /de-de/README.md
],
// vollständige Parameter für die Einstellungen
search: {
maxAge: 86400000, // Verfallszeit, als Standard ein Tag
paths: [], // oder 'auto'
placeholder: 'Type to search',
// Lokalisation
placeholder: {
'/de-de/': 'Suche',
'/': 'Search'
},
noData: 'No Results!',
// Lokalisation
noData: {
'/de-de/': 'Keine Ergebnisse',
'/': 'No Results'
}
}
}
</script>
<script src="//unpkg.com/docsify/lib/docsify.min.js"></script>
<script src="//unpkg.com/docsify/lib/plugins/search.min.js"></script>
```
## Google Analytics
Installiere diese Erweiterung und passe die track id an:
```html
<script>
window.$docsify = {
ga: 'UA-XXXXX-Y'
}
</script>
<script src="//unpkg.com/docsify/lib/docsify.min.js"></script>
<script src="//unpkg.com/docsify/lib/plugins/ga.min.js"></script>
```
Konfiguration über `data-ga`:
```html
<script src="//unpkg.com/docsify/lib/docsify.min.js" data-ga="UA-XXXXX-Y"></script>
<script src="//unpkg.com/docsify/lib/plugins/ga.min.js"></script>
```
## front matter
```html
<script src="//unpkg.com/docsify/lib/plugins/front-matter.min.js"></script>
```
## emoji
Als Standardeinstellung werden emojis umgewandelt. Als Beispiel wird `:100:` umgewandelt in :100:. Aber das ist nicht genau, das es keine passende Nicht-emoji Zeichenfolge gibt. Solltest du emojis richtig umwandeln wollen, musst du diese Erweiterung verwenden.
```html
<script src="//unpkg.com/docsify/lib/plugins/emoji.min.js"></script>
```
## Externes Skript
Wenn das Skript auf der Seite ein externes ist (eine Javascript Datei über das `src` Attribut importiert), brauchst du diese Erweiterung, damit das funktioniert.
```html
<script src="//unpkg.com/docsify/lib/plugins/external-script.min.js"></script>
```
## Bilder zoomen
Medium's Bilderzoom. Basierend auf [zoom-image](https://github.com/egoist/zoom-image).
```html
<script src="//unpkg.com/docsify/lib/plugins/zoom-image.min.js"></script>
```
+32 -1
View File
@@ -1,3 +1,16 @@
# Offline Modus
[Progressive Web Apps](https://developers.google.com/web/progressive-web-apps/) (PWA) sind Erfahrungen die Vorzüge des Internets mit den Vorzügen von Apps verbinden. Wir können unsere Webseite verbessern, indem wir sie mit Hilfe von service workers auch **offline** und in schlechten Netzen interagierbar machen.
Sie sind sehr einfach zu verwenden.
## serviceWorker erstellen
Erstelle eine Datei namens `sw.js` in deinem **docsify** Verzeichnis und kopiere folgenden Code:
*sw.js*
```js
/* ===========================================================
* docsify sw.js
* ===========================================================
@@ -9,7 +22,6 @@
const RUNTIME = 'docsify'
const HOSTNAME_WHITELIST = [
self.location.hostname,
'raw.githubusercontent.com',
'fonts.gstatic.com',
'fonts.googleapis.com',
'unpkg.com'
@@ -82,3 +94,22 @@ self.addEventListener('fetch', event => {
)
}
})
```
## Registrieren
Jetzt registrieren wir die Funktion in der Datei `index.html`. Nur manche aktuellen Browser unterstützen die Funktion, wir müssen also prüfen:
*index.html*
```html
<script>
if (typeof navigator.serviceWorker !== 'undefined') {
navigator.serviceWorker.register('sw.js')
}
</script>
```
## Geniessen
Du kannst die Website jetzt veröffentlichen und Benutzer können sie dann vollständig offline verwenden, sobald sie einmal geladen wurde :ghost: Du kannst das jetzt ausprobieren, indem du deine Internetverbindung ausschaltest und diese Seite neu lädst.
+87
View File
@@ -0,0 +1,87 @@
# Schnellstart
Es wird empfohlen, `docsify-cli` global zu installieren, welches bei der Inbetriebnahme und der lokalen Vorschau hilft.
```bash
npm i docsify-cli -g
```
## Inbetriebnahme
Wenn du die Dokumentation in dem Unterordner `./docs` erstellen willst, kannst du den Befehl `init` verwenden.
```bash
docsify init ./docs
```
## Inhalt schreiben
Nachdem der Befehl `init` vollständig ausgeführt wurde, kannst du folgende Dateien im Unterordner `./docs` finden:
* `index.html` als zentrale Datei
* `README.md` als die Startseite für die Dokumentation
* `.nojekyll` verhindert, dass Github Pages Dateien ignoriert, die mit einem Unterstrich beginnen.
Du kannst die Dokumentation über die Datei `./docs/README.md` nach Belieben ändern, und natürlich [weitere Seiten](de-de/more-pages.md) hinzufügen.
## Vorschau der eigenen Seiten
Du kannst einen lokalen Server mit dem Befehl `docsify serve` laufen lassen, und auf eine Vorschau deiner Webseite über `http://localhost:3000` zugreifen.
```bash
docsify serve docs
```
?> Für weitere Informationen hinsichtlich der Verwendung von `docsify-cli`, siehe [docsify-cli Dokumentation](https://github.com/QingWei-Li/docsify-cli).
## Manuelle Inbetriebnahme
Wenn du `npm` nicht verwenden möchtest, oder Probleme bei der Installation des Tools hast, kannst du auch manuell die Datei namens `index.html` erstellen:
```html
<!-- index.html -->
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">dict.
<link rel="stylesheet" href="//unpkg.com/docsify/themes/vue.css">
</head>
<body>
<div id="app"></div>
</body>
<script src="//unpkg.com/docsify/lib/docsify.min.js"></script>
</html>
```
Solltest du Python installiert haben, kannst du einen statischen Server laufen lassen, um eine Vorschau deiner Webseite anzuschauen:
```bash
cd docs && python -m SimpleHTTPServer 3000
```
## Ladedialog
Wenn du möchtest, kann **docsify** einen Ladedialog anzeigen, während es deine Dokumentation umwandelt:
```html
<!-- index.html -->
<div id="app">Please wait...</div>
```
Du solltest das `data-app` Attribut anpassen, wenn du `el` geändert hast:
```html
<!-- index.html -->
<div data-app id="main">Please wait...</div>
<script>
window.$docsify = {
el: '#main'
}
</script>
```
Vergleiche [el Einstellungen](configuration.md#el).
+56
View File
@@ -0,0 +1,56 @@
# Themes
Es gibt im Moment vier Themes zur Auswahl, ähnlich wie die Webseiten von [Vue](//vuejs.org) oder [buble](//buble.surge.sh), sowie eine weitere, dunkle von [@liril-net](https://github.com/liril-net).
```html
<link rel="stylesheet" href="//unpkg.com/docsify/themes/vue.css">
<link rel="stylesheet" href="//unpkg.com/docsify/themes/buble.css">
<link rel="stylesheet" href="//unpkg.com/docsify/themes/dark.css">
<link rel="stylesheet" href="//unpkg.com/docsify/themes/pure.css">
```
!> Komprimierte Dateien sind über `/lib/themes/` verfügbar.
```html
<!-- komprimierte Versionen -->
<link rel="stylesheet" href="//unpkg.com/docsify/lib/themes/vue.css">
<link rel="stylesheet" href="//unpkg.com/docsify/lib/themes/buble.css">
<link rel="stylesheet" href="//unpkg.com/docsify/lib/themes/dark.css">
<link rel="stylesheet" href="//unpkg.com/docsify/lib/themes/pure.css">
```
Solltest du weitere Themes erstellen, kannst du sie gerne der Allgemeinheit mit einem [pull request](https://github.com/QingWei-Li/docsify/pulls) zur Verfügung stellen.
#### Klicke hier für eine Vorschau
<div class="demo-theme-preview">
<a data-theme="vue">vue.css</a>
<a data-theme="buble">buble.css</a>
<a data-theme="dark">dark.css</a>
<a data-theme="pure">pure.css</a>
</div>
<style>
.demo-theme-preview a {
padding-right: 10px;
}
.demo-theme-preview a:hover {
cursor: pointer;
text-decoration: underline;
}
</style>
<script>
var preview = Docsify.dom.find('.demo-theme-preview');
var themes = Docsify.dom.findAll('[rel="stylesheet"]');
preview.onclick = function (e) {
var title = e.target.getAttribute('data-theme')
themes.forEach(function (theme) {
theme.disabled = theme.title !== title
});
};
</script>
+100
View File
@@ -0,0 +1,100 @@
# Kompatibel mit Vue
Du kannst Vue Komponenten direkt in den Markdown Dateien verwenden, und sie werden umgewandelt. Du kannst dies zum Beispiel verwenden, um Vue Komponenten gleichzeitig zu demonstrieren und zu dokumentieren.
## Einfache Verwendung
Lade Vue in `./index.html`.
```html
<script src="//unpkg.com/vue"></script>
<script src="//unpkg.com/docsify"></script>
<!-- oder verwende die komprimierten Dateien -->
<script src="//unpkg.com/vue/dist/vue.min.js"></script>
<script src="//unpkg.com/docsify/lib/docsify.min.js"></script>
```
Dann kannst du sofort Vue Code in deinen Markdown Dateien verwenden. `new Vue({ el: '#main' })` wird als Standard ausgeführt, um Instanzen zu erschaffen.
*README.md*
```markdown
# Vue guide
`v-for` usage.
```html
<ul>
<li v-for="i in 10">{{ i }}</li>
</ul>
``
<ul>
<li v-for="i in 10">{{ i }}</li>
</ul>
```
Du kannst manuell eine Vue Instanz initialisieren.
*README.md*
```markdown
# Vue demo
<div>hello {{ msg }}</div>
<script>
new Vue({
el: '#main',
data: { msg: 'Vue' }
})
</script>
```
!> In Markdown Dateien wird nur das Skript innerhalb des ersten script tag Blocks ausgeführt.
## Kombiniere Vuep um Demos zu erschaffen
[Vuep](https://github.com/QingWei-Li/vuep) ist eine Komponente zur Darstellung von Vue Komponenten mit einem Liveeditor und einer Vorschau.Unterstützt die Vue Komponenten spec und JSX.
*index.html*
```html
<!-- injizieren von CSS -->
<link rel="stylesheet" href="//unpkg.com/vuep/dist/vuep.css">
<!-- injizieren von JS -->
<script src="//unpkg.com/vue"></script>
<script src="//unpkg.com/vuep"></script>
<script src="//unpkg.com/docsify"></script>
<!-- oder verwende die komprimierten Dateien -->
<script src="//unpkg.com/vue/dist/vue.min.js"></script>
<script src="//unpkg.com/vuep/dist/vuep.min.js"></script>
<script src="//unpkg.com/docsify/lib/docsify.min.js"></script>
```
*README.md*
```markdown
# Vuep
<vuep template="#example"></vuep>
<script v-pre type="text/x-template" id="example">
<template>
<div>Hello, {{ name }}!</div>
</template>
<script>
module.exports = {
data: function () {
return { name: 'Vue' }
}
}
</script>
</script>
```
?> Zum Beispiel vergleich auch die [vuep Dokumentation](https://qingwei-li.github.io/vuep/).
+70
View File
@@ -0,0 +1,70 @@
# Schreiben einer Erweiterung
Eine Erweiterung ist schlicht eine Funktion, welche `hook` als Argument nimmt. hook unterstützt dabei das Verwalten von asynchrononen Tasks.
## Volle Konfiguration
```js
window.$docsify = {
plugins: [
function (hook, vm) {
hook.init(function() {
// Called when the script starts running, only trigger once, no arguments,
})
hook.beforeEach(function(content) {
// Invoked each time before parsing the Markdown file.
// ...
return content
})
hook.afterEach(function(html, next) {
// Invoked each time after the Markdown file is parsed.
// beforeEach and afterEach support asynchronous。
// ...
// call `next(html)` when task is done.
next(html)
})
hook.doneEach(function() {
// Invoked each time after the data is fully loaded, no arguments,
// ...
})
hook.mounted(function() {
// Called after initial completion. Only trigger once, no arguments.
})
hook.ready(function() {
// Called after initial completion, no arguments.
})
}
]
}
```
!> Du kannst auf interne Methoden über `window.Docsify` zugreifen. Greife auf die aktuelle Instanz über das zweite Argument zu.
## Beispiel
Füge jeder Seite eine footer Komponente hinzu:
```js
window.$docsify = {
plugins: [
function (hook) {
var footer = [
'<hr/>',
'<footer>',
'<span><a href="https://github.com/QingWei-Li">cinwell</a> &copy;2017.</span>',
'<span>Proudly published with <a href="https://github.com/QingWei-Li/docsify" target="_blank">docsify</a>.</span>',
'</footer>'
].join('')
hook.afterEach(function (html) {
return html + footer
})
}
]
}
```
+39 -18
View File
@@ -6,36 +6,57 @@
<link rel="icon" href="_media/favicon.ico">
<meta name="keywords" content="doc,docs,documentation,gitbook,creator,generator,github,jekyll,github-pages">
<meta name="description" content="A magical documentation generator.">
<meta name="google-site-verification" content="6t0LoIeFksrjF4c9sqUEsVXiQNxLp2hgoqo0KryT-sE" />
<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="//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;
}
</style>
</head>
<body>
<nav data-cloak>
<a href="#/">En</a>
<a href="#/zh-cn/">中文</a>
</nav>
<div id="app"></div>
<div id="app">Loading ...</div>
</body>
<script>
window.$docsify = {
name: 'docsify',
maxLevel: 4,
subMaxLevel: 2,
auto2top: true,
coverpage: true,
loadSidebar: true,
executeScript: true,
alias: {
'/de-de/changelog': '/changelog',
'/zh-cn/changelog': '/changelog',
'/changelog': 'https://raw.githubusercontent.com/QingWei-Li/docsify/master/CHANGELOG'
}
}
if (typeof navigator.serviceWorker !== 'undefined') {
navigator.serviceWorker.register('sw.js')
},
auto2top: true,
coverpage: true,
executeScript: true,
loadSidebar: true,
loadNavbar: true,
mergeNavbar: true,
maxLevel: 4,
subMaxLevel: 2,
name: 'docsify',
search: {
noData: {
'/de-de/': 'Keine Ergebnisse!',
'/zh-cn/': '没有结果!',
'/': 'No results!'
},
paths: 'auto',
placeholder: {
'/de-de/': 'Suche',
'/zh-cn/': '搜索',
'/': 'Search'
}
},
formatUpdated: '{MM}/{DD} {HH}:{mm}',
plugins: [
function(hook) {
hook.beforeEach(function (html) {
return html += '> Last modified {docsify-updated}'
})
}
]
}
</script>
<script src="//unpkg.com/docsify/lib/docsify.min.js"></script>
+25 -3
View File
@@ -27,7 +27,7 @@ docs/zh-cn/guide.md => http://domain.com/zh-cn/guide
By default, the table of contents in the sidebar is automatically generated based on your markdown files. If you need a custom sidebar, then you can create your own `_sidebar.md` (see [this documentation's sidebar](https://github.com/QingWei-Li/docsify/blob/master/docs/_sidebar.md) for an example):
First, you need to set `loadSidebar` to **true**. Details are available in the [configuration paragraph](configuration#load-sidebar).
First, you need to set `loadSidebar` to **true**. Details are available in the [configuration paragraph](configuration.md#load-sidebar).
```html
<!-- index.html -->
@@ -46,7 +46,7 @@ Create the `_sidebar.md`:
<!-- docs/_sidebar.md -->
- [Home](/)
- [Guide](/guide)
- [Guide](guide.md)
```
!> You need to create a `.nojekyll` in `./docs` to prevent GitHub Pages from ignoring files that begin with an underscore.
@@ -55,7 +55,7 @@ Create the `_sidebar.md`:
## Table of Contents
A custom sidebar can also automatically generate a table of contents by setting a `subMaxLevel`, compare [sub-max-level configuration](configuration#sub-max-level).
A custom sidebar can also automatically generate a table of contents by setting a `subMaxLevel`, compare [sub-max-level configuration](configuration.md#sub-max-level).
```html
<!-- index.html -->
@@ -68,3 +68,25 @@ A custom sidebar can also automatically generate a table of contents by setting
</script>
<script src="//unpkg.com/docsify/lib/docsify.min.js"></script>
```
## Ignoring Subheaders
When `subMaxLevel` is set, each header is automatically added to the table of contents by default. If you want to ignore a specific header, add `{docsify-ignore}` to it.
```markdown
# Getting Started
## Header {docsify-ignore}
This header won't appear in the sidebar table of contents.
```
To ignore all headers on a specific page, you can use `{docsify-ignore-all}` on the first header of the page.
```markdown
# Getting Started {docsify-ignore-all}
## Header
This header won't appear in the sidebar table of contents.
```
Both `{docsify-ignore}` and `{docsify-ignore-all}` will not be rendered on the page when used.
+2 -2
View File
@@ -22,7 +22,7 @@ After the `init` is complete, you can see the file list in the `./docs` subdirec
* `README.md` as the home page
* `.nojekyll` prevents GitHub Pages from ignoring files that begin with an underscore
You can easily update the documentation in `./docs/README.md`, of course you can add [more pages](more-pages).
You can easily update the documentation in `./docs/README.md`, of course you can add [more pages](more-pages.md).
## Preview your site
@@ -84,4 +84,4 @@ You should set the `data-app` attribute if you changed `el`:
</script>
```
Compare [el configuration](/configuration#el).
Compare [el configuration](configuration.md#el).
+3
View File
@@ -6,6 +6,7 @@ There are currently three themes available. Copy [Vue](//vuejs.org) and [buble](
<link rel="stylesheet" href="//unpkg.com/docsify/themes/vue.css">
<link rel="stylesheet" href="//unpkg.com/docsify/themes/buble.css">
<link rel="stylesheet" href="//unpkg.com/docsify/themes/dark.css">
<link rel="stylesheet" href="//unpkg.com/docsify/themes/pure.css">
```
!> Compressed files are available in `/lib/themes/`.
@@ -16,6 +17,7 @@ There are currently three themes available. Copy [Vue](//vuejs.org) and [buble](
<link rel="stylesheet" href="//unpkg.com/docsify/lib/themes/vue.css">
<link rel="stylesheet" href="//unpkg.com/docsify/lib/themes/buble.css">
<link rel="stylesheet" href="//unpkg.com/docsify/lib/themes/dark.css">
<link rel="stylesheet" href="//unpkg.com/docsify/lib/themes/pure.css">
```
If you have any ideas or would like to develop a new theme, you are welcome to submit a [pull request](https://github.com/QingWei-Li/docsify/pulls).
@@ -26,6 +28,7 @@ If you have any ideas or would like to develop a new theme, you are welcome to s
<a data-theme="vue">vue.css</a>
<a data-theme="buble">buble.css</a>
<a data-theme="dark">dark.css</a>
<a data-theme="pure">pure.css</a>
</div>
<style>
+2 -2
View File
@@ -6,9 +6,9 @@
docsify 是一个动态生成文档网站的工具。不同于 GitBook、Hexo 的地方是它不会生成将 `.md` 转成 `.html` 文件,所有转换工作都是在运行时进行。
这将非常实用,如果只是需要快速的搭建一个小型的文档网站,或者不想因为生成的一堆 `.html` 文件“污染” commit 记录,只需要创建一个 `index.html` 就可以开始写文档而且直接[部署在 GitHub Pages](zh-cn/deploy)。
这将非常实用,如果只是需要快速的搭建一个小型的文档网站,或者不想因为生成的一堆 `.html` 文件“污染” commit 记录,只需要创建一个 `index.html` 就可以开始写文档而且直接[部署在 GitHub Pages](zh-cn/deploy.md)。
查看[快速开始](zh-cn/quickstart)了解详情。
查看[快速开始](zh-cn/quickstart.md)了解详情。
## 特性
- 无需构建,写完文档直接发布
+16 -16
View File
@@ -1,22 +1,22 @@
- 入门
- [快速开始](zh-cn/quickstart)
- [多页文档](zh-cn/more-pages)
- [定制导航栏](zh-cn/custom-navbar)
- [封面](zh-cn/cover)
- [快速开始](zh-cn/quickstart.md)
- [多页文档](zh-cn/more-pages.md)
- [定制导航栏](zh-cn/custom-navbar.md)
- [封面](zh-cn/cover.md)
- 定制化
- [配置项](zh-cn/configuration)
- [主题](zh-cn/themes)
- [插件列表](zh-cn/plugins)
- [开发插件](zh-cn/write-a-plugin)
- [Markdown 配置](zh-cn/markdown)
- [代码高亮](zh-cn/language-highlight)
- [配置项](zh-cn/configuration.md)
- [主题](zh-cn/themes.md)
- [插件列表](zh-cn/plugins.md)
- [开发插件](zh-cn/write-a-plugin.md)
- [Markdown 配置](zh-cn/markdown.md)
- [代码高亮](zh-cn/language-highlight.md)
- 指南
- [部署](zh-cn/deploy)
- [文档助手](zh-cn/helpers)
- [兼容 Vue](zh-cn/vue)
- [CDN](zh-cn/cdn)
- [离线模式(PWA)](zh-cn/pwa)
- [部署](zh-cn/deploy.md)
- [文档助手](zh-cn/helpers.md)
- [兼容 Vue](zh-cn/vue.md)
- [CDN](zh-cn/cdn.md)
- [离线模式(PWA)](zh-cn/pwa.md)
- [Changelog](zh-cn/changelog)
- [Changelog](zh-cn/changelog.md)
+3 -2
View File
@@ -44,5 +44,6 @@ JS 的压缩文件是原有文件路径的基础上加 `.min`后缀
## 其他 CDN
[jsDelivr](http://www.jsdelivr.com/projects/docsify) 也是可用的,具体用法参考其文档。
- http://www.bootcdn.cn/docsify
- http://www.jsdelivr.com/projects/docsify
- https://cdnjs.com/libraries/docsify
+41 -6
View File
@@ -74,7 +74,7 @@ window.$docsify = {
- 类型:`Boolean|String`
- 默认值: `false`
加载自定义导航栏,参考[定制导航栏](zh-cn/custom-navbar) 了解用法。设置为 `true` 后会加载 `_navbar.md` 文件,也可以自定义加载的文件名。
加载自定义导航栏,参考[定制导航栏](zh-cn/custom-navbar.md) 了解用法。设置为 `true` 后会加载 `_navbar.md` 文件,也可以自定义加载的文件名。
```js
window.$docsify = {
@@ -91,7 +91,7 @@ window.$docsify = {
- 类型:`Boolean|String`
- 默认值: `false`
加载自定义侧边栏,参考[多页文档](zh-cn/more-pages)。设置为 `true` 后会加载 `_sidebar.md` 文件,也可以自定义加载的文件名。
加载自定义侧边栏,参考[多页文档](zh-cn/more-pages.md)。设置为 `true` 后会加载 `_sidebar.md` 文件,也可以自定义加载的文件名。
```js
window.$docsify = {
@@ -173,7 +173,7 @@ window.$docsify = {
- 类型:`Boolean|String`
- 默认值: `false`
启用[封面页](/zh-cn/cover)。开启后是加载 `_coverpage.md` 文件,也可以自定义文件名。
启用[封面页](zh-cn/cover.md)。开启后是加载 `_coverpage.md` 文件,也可以自定义文件名。
```js
window.$docsify = {
@@ -220,7 +220,7 @@ window.$docsify = {
- 类型: `Object|Function`
参考 [Markdown 配置](/zh-cn/markdown)。
参考 [Markdown 配置](zh-cn/markdown.md)。
```js
window.$docsify = {
@@ -287,7 +287,7 @@ window.$docsify = {
- 类型:`Boolean`
执行文档里的 script 标签里的脚本,只执行第一个 script ([demo](zh-cn/themes))。 如果 Vue 存在,则自动开启。
执行文档里的 script 标签里的脚本,只执行第一个 script ([demo](zh-cn/themes.md))。 如果 Vue 存在,则自动开启。
```js
window.$docsify = {
@@ -304,7 +304,7 @@ window.$docsify = {
```
注意如果执行的是一个外链脚本,比如 jsfiddle 的内嵌 demo,请确保引入 [external-script](zh-cn/plugins?id=外链脚本-external-script) 插件。
注意如果执行的是一个外链脚本,比如 jsfiddle 的内嵌 demo,请确保引入 [external-script](plugins.md?id=外链脚本-external-script) 插件。
## no-emoji
@@ -315,3 +315,38 @@ window.$docsify = {
noEmoji: true
}
```
## merge-navbar
小屏设备下合并导航栏到侧边栏。
```js
window.$docsify = {
mergeNavbar: true
}
```
## format-updated
我们可以显示文档更新日期通过 **{docsify-updated<span>}</span>** 变量. 并且格式化日期通过 `formatUpdated`.
参考 https://github.com/lukeed/tinydate#patterns
```js
window.$docsify = {
formatUpdated: '{MM}/{DD} {HH}:{mm}',
formatUpdated: function (time) {
// ...
return time
}
}
```
## external-link-target
Currently it defaults to _blank, would be nice if configurable:
```js
window.$docsify = {
externalLinkTarget: '_self' // default: '_blank'
}
```
+1 -1
View File
@@ -1,6 +1,6 @@
# 封面
通过设置 `coverpage` 参数,可以开启渲染封面的功能。具体用法见[配置项#coverpage](zh-cn/configuration#coverpage)。
通过设置 `coverpage` 参数,可以开启渲染封面的功能。具体用法见[配置项#coverpage](configuration.md#coverpage)。
## 基本用法
+10 -10
View File
@@ -17,7 +17,7 @@
## 配置文件
那我们可以通过 Markdown 文件来配置导航。首先配置 `loadNavbar`,默认加载的文件为 `_navbar.md`。具体配置规则见[配置项#load-navbar](zh-cn/configuration#load-navbar)。
那我们可以通过 Markdown 文件来配置导航。首先配置 `loadNavbar`,默认加载的文件为 `_navbar.md`。具体配置规则见[配置项#load-navbar](configuration.md#load-navbar)。
*index.html*
@@ -49,17 +49,17 @@
```markdown
- 基础
- [快速开始](zh-cn/quickstart)
- [多页文档](zh-cn/more-pages)
- [定制导航栏](zh-cn/custom-navbar)
- [封面](zh-cn/cover)
- [快速开始](zh-cn/quickstart.md)
- [多页文档](zh-cn/more-pages.md)
- [定制导航栏](zh-cn/custom-navbar.md)
- [封面](zh-cn/cover.md)
- 配置
- [配置项](zh-cn/configuration)
- [主题](zh-cn/themes)
- [使用插件](zh-cn/plugins)
- [Markdown 配置](zh-cn/markdown)
- [代码高亮](zh-cn/language-highlight)
- [配置项](zh-cn/configuration.md)
- [主题](zh-cn/themes.md)
- [使用插件](zh-cn/plugins.md)
- [Markdown 配置](zh-cn/markdown.md)
- [代码高亮](zh-cn/language-highlight.md)
```
效果图
+22 -1
View File
@@ -26,7 +26,7 @@ docs/zh-cn/guide.md => http://domain.com/zh-cn/guide
默认情况下,侧边栏会根据当前文档的标题生成目录。也可以设置文档链接,通过 Markdown 文件生成,效果如当前的文档的侧边栏。
首先配置 `loadSidebar` 选项,具体配置规则见[配置项#load-sidebar](zh-cn/configuration#load-sidebar)。
首先配置 `loadSidebar` 选项,具体配置规则见[配置项#load-sidebar](configuration.md#load-sidebar)。
```html
<script>
@@ -63,4 +63,25 @@ docs/zh-cn/guide.md => http://domain.com/zh-cn/guide
<script src="//unpkg.com/docsify"></script>
```
## Ignoring Subheaders
When `subMaxLevel` is set, each header is automatically added to the table of contents by default. If you want to ignore a specific header, add `{docsify-ignore}` to it.
```markdown
# Getting Started
## Header {docsify-ignore}
This header won't appear in the sidebar table of contents.
```
To ignore all headers on a specific page, you can use `{docsify-ignore-all}` on the first header of the page.
```markdown
# Getting Started {docsify-ignore-all}
## Header
This header won't appear in the sidebar table of contents.
```
Both `{docsify-ignore}` and `{docsify-ignore-all}` will not be rendered on the page when used.
+1 -1
View File
@@ -22,7 +22,7 @@ docsify init ./docs
- `README.md` 会做为主页内容渲染
- `.nojekyll` 用于阻止 GitHub Pages 会忽略掉下划线开头的文件
直接编辑 `docs/README.md` 就能更新网站内容,当然也可以[写多个页面](zh-cn/more-pages)。
直接编辑 `docs/README.md` 就能更新网站内容,当然也可以[写多个页面](zh-cn/more-pages.md)。
## 本地预览网站
+9
View File
@@ -6,10 +6,18 @@
<link rel="stylesheet" href="//unpkg.com/docsify/themes/vue.css">
<link rel="stylesheet" href="//unpkg.com/docsify/themes/buble.css">
<link rel="stylesheet" href="//unpkg.com/docsify/themes/dark.css">
<link rel="stylesheet" href="//unpkg.com/docsify/themes/pure.css">
```
!> CSS 的压缩文件位于 `/lib/themes/`
```html
<link rel="stylesheet" href="//unpkg.com/docsify/lib/themes/vue.css">
<link rel="stylesheet" href="//unpkg.com/docsify/lib/themes/buble.css">
<link rel="stylesheet" href="//unpkg.com/docsify/lib/themes/dark.css">
<link rel="stylesheet" href="//unpkg.com/docsify/lib/themes/pure.css">
```
如果你有其他想法或者想开发别的主题,欢迎提 [PR](https://github.com/QingWei-Li/docsify/pulls)。
#### 点击切换主题
@@ -19,6 +27,7 @@
<a data-theme="vue">vue.css</a>
<a data-theme="buble">buble.css</a>
<a data-theme="dark">dark.css</a>
<a data-theme="pure">pure.css</a>
</div>
+134 -31
View File
@@ -76,7 +76,10 @@ var config = merge({
autoHeader: false,
executeScript: null,
noEmoji: false,
ga: ''
ga: '',
mergeNavbar: false,
formatUpdated: '',
externalLinkTarget: '_blank'
}, window.$docsify);
var script = document.currentScript ||
@@ -313,7 +316,9 @@ var getParentPath = cached(function (path) {
});
var cleanPath = cached(function (path) {
return path.replace(/\/+/g, '/')
return path
.replace(/^\/+/, '/')
.replace(/([^:])\/{2,}/g, '$1/')
});
function replaceHash (path) {
@@ -326,7 +331,7 @@ function replaceHash (path) {
var replaceSlug = cached(function (path) {
return path
.replace('#', '?id=')
.replace(/\?(\w+)=/g, function (_, slug) { return slug === 'id' ? '?id=' : ("&" + slug + "="); })
// .replace(/\?(\w+)=/g, (_, slug) => slug === 'id' ? '?id=' : `&${slug}=`)
});
/**
* Normalize the current url
@@ -380,12 +385,17 @@ function parse (path) {
* to URL
* @param {string} path
* @param {object} qs query params
* @param {string} currentRoute optional current route
*/
function toURL (path, params) {
function toURL (path, params, currentRoute) {
var local = currentRoute && path[0] === '#';
var route = parse(replaceSlug(path));
route.query = merge({}, route.query, params);
path = route.path + stringifyQuery(route.query);
path = path.replace(/\.md(\?)|\.md$/, '$1');
if (local) { path = currentRoute + path; }
return cleanPath('#/' + path)
}
@@ -410,17 +420,20 @@ var title = $.title;
* Toggle button
*/
function btn (el) {
var toggle = function () { return body.classList.toggle('close'); };
var toggle = function (_) { return body.classList.toggle('close'); };
el = getNode(el);
on(el, 'click', toggle);
on(el, 'click', function (e) {
e.stopPropagation();
toggle();
});
var sidebar = getNode('.sidebar');
on(sidebar, 'click', function () {
isMobile && toggle();
setTimeout(function () { return getAndActive(sidebar, true, true); }, 0);
});
isMobile && on(body, 'click', function (_) { return body.classList.contains('close') && toggle(); }
);
on(sidebar, 'click', function (_) { return setTimeout((function (_) { return getAndActive(sidebar, true, true); }, 0)); }
);
}
function sticky () {
@@ -618,9 +631,10 @@ function get (url, hasBar) {
var on = function () {
xhr.addEventListener.apply(xhr, arguments);
};
var cached$$1 = cache[url];
if (cache[url]) {
return { then: function (cb) { return cb(cache[url]); }, abort: noop }
if (cached$$1) {
return { then: function (cb) { return cb(cached$$1.content, cached$$1.opt); }, abort: noop }
}
xhr.open('GET', url);
@@ -649,8 +663,15 @@ function get (url, hasBar) {
if (target.status >= 400) {
error(target);
} else {
cache[url] = target.response;
success(target.response);
var result = cache[url] = {
content: target.response,
opt: {
updatedAt: xhr.getResponseHeader('last-modified') ||
xhr.getResponseHeader('expires')
}
};
success(result.content, result.opt);
}
});
},
@@ -2948,6 +2969,7 @@ function emojify (text) {
var markdownCompiler = marked;
var contentBase = '';
var currentPath = '';
var linkTarget = '_blank';
var renderer = new marked.Renderer();
var cacheTree = {};
var toc = [];
@@ -2969,11 +2991,13 @@ var markdown = cached(function (text) {
markdown.renderer = renderer;
markdown.init = function (config, base) {
markdown.init = function (config, ref) {
if ( config === void 0 ) config = {};
if ( base === void 0 ) base = window.location.pathname;
var base = ref.base; if ( base === void 0 ) base = window.location.pathname;
var externalLinkTarget = ref.externalLinkTarget;
contentBase = getBasePath(base);
linkTarget = externalLinkTarget || linkTarget;
if (isFn(config)) {
markdownCompiler = config(marked, renderer);
@@ -2992,10 +3016,24 @@ markdown.update = function () {
* @link https://github.com/chjj/marked#overriding-renderer-methods
*/
renderer.heading = function (text, level) {
var nextToc = { level: level, title: text };
if (/{docsify-ignore}/g.test(text)) {
text = text.replace('{docsify-ignore}', '');
nextToc.title = text;
nextToc.ignoreSubHeading = true;
}
if (/{docsify-ignore-all}/g.test(text)) {
text = text.replace('{docsify-ignore-all}', '');
nextToc.title = text;
nextToc.ignoreAllSubs = true;
}
var slug = slugify(text);
var url = toURL(currentPath, { id: slug });
toc.push({ level: level, slug: url, title: text });
nextToc.slug = url;
toc.push(nextToc);
return ("<h" + level + " id=\"" + slug + "\"><a href=\"" + url + "\" data-id=\"" + slug + "\" class=\"anchor\"><span>" + text + "</span></a></h" + level + ">")
};
@@ -3010,14 +3048,14 @@ renderer.code = function (code, lang) {
renderer.link = function (href, title, text) {
var blank = '';
if (!/:|(\/{2})/.test(href)) {
href = toURL(href);
href = toURL(href, null, currentPath);
} else {
blank = ' target="_blank"';
blank = " target=\"" + linkTarget + "\"";
}
if (title) {
title = " title=\"" + title + "\"";
}
return ("<a href=\"" + href + "\"" + title + blank + ">" + text + "</a>")
return ("<a href=\"" + href + "\"" + (title || '') + blank + ">" + text + "</a>")
};
renderer.paragraph = function (text) {
if (/^!&gt;/.test(text)) {
@@ -3061,7 +3099,11 @@ function sidebar (text, level) {
*/
function subSidebar (el, level) {
if (el) {
toc[0] && toc[0].ignoreAllSubs && (toc = []);
toc[0] && toc[0].level === 1 && toc.shift();
toc.forEach(function (node, i) {
node.ignoreSubHeading && toc.splice(i, 1);
});
var tree$$1 = cacheTree[currentPath] || genTree(toc, level);
el.parentNode.innerHTML += tree(tree$$1, '<ul class="app-sub-sidebar">');
cacheTree[currentPath] = tree$$1;
@@ -3089,6 +3131,45 @@ var render = Object.freeze({
cover: cover$1
});
var RGX = /([^{]*?)\w(?=\})/g;
var dict = {
YYYY: 'getFullYear',
YY: 'getYear',
MM: function (d) {
return d.getMonth() + 1;
},
DD: 'getDate',
HH: 'getHours',
mm: 'getMinutes',
ss: 'getSeconds'
};
var tinydate = function (str) {
var parts=[], offset=0;
str.replace(RGX, function (key, _, idx) {
// save preceding string
parts.push(str.substring(offset, idx - 1));
offset = idx += key.length + 1;
// save function
parts.push(function(d){
return ('00' + (typeof dict[key]==='string' ? d[dict[key]]() : dict[key](d))).slice(-key.length);
});
});
if (offset !== str.length) {
parts.push(str.substring(offset));
}
return function (arg) {
var out='', i=0, d=arg||new Date();
for (; i<parts.length; i++) {
out += (typeof parts[i]==='string') ? parts[i] : parts[i](d);
}
return out;
};
};
function executeScript () {
var script = findAll('.markdown-section>script')
.filter(function (s) { return !/template/.test(s.type); })[0];
@@ -3101,6 +3182,16 @@ function executeScript () {
}, 0);
}
function formatUpdated (html, updated, fn) {
updated = typeof fn === 'function'
? fn(updated)
: typeof fn === 'string'
? tinydate(fn)(new Date(updated))
: updated;
return html.replace(/{docsify-updated}/g, updated)
}
function renderMain (html) {
if (!html) {
// TODO: Custom 404 page
@@ -3181,11 +3272,16 @@ function renderMixin (proto) {
getAndActive('nav');
};
proto._renderMain = function (text) {
proto._renderMain = function (text, opt) {
var this$1 = this;
if ( opt === void 0 ) opt = {};
callHook(this, 'beforeEach', text, function (result) {
var html = this$1.isHTML ? result : markdown(result);
if (opt.updatedAt) {
html = formatUpdated(html, opt.updatedAt, this$1.config.formatUpdated);
}
callHook(this$1, 'afterEach', html, function (text) { return renderMain.call(this$1, text); });
});
};
@@ -3233,19 +3329,15 @@ function initRender (vm) {
var config = vm.config;
// Init markdown compiler
markdown.init(config.markdown, config.basePath);
markdown.init(config.markdown, config);
var id = config.el || '#app';
var navEl = find('nav') || create('nav');
var el = find(id);
var html = '';
var navAppendToTarget = body;
navEl.classList.add('app-nav');
if (!config.repo) {
navEl.classList.add('no-badge');
}
if (!el) {
el = create(id);
appendTo(body, el);
@@ -3260,8 +3352,19 @@ function initRender (vm) {
html += main(config);
// Render main app
vm._renderTo(el, html, true);
if (config.mergeNavbar && isMobile) {
navAppendToTarget = find('.sidebar');
} else {
navEl.classList.add('app-nav');
if (!config.repo) {
navEl.classList.add('no-badge');
}
}
// Add nav
before(body, navEl);
before(navAppendToTarget, navEl);
if (config.themeColor) {
$.head.innerHTML += theme(config.themeColor);
@@ -3370,8 +3473,8 @@ function fetchMixin (proto) {
this.isHTML = /\.html$/g.test(path);
// Load main content
last.then(function (text) {
this$1._renderMain(text);
last.then(function (text, opt) {
this$1._renderMain(text, opt);
if (!loadSidebar) { return cb() }
var fn = function (result) { this$1._renderSidebar(result); cb(); };
+2 -2
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
+13 -7
View File
@@ -4,15 +4,21 @@ this.D = this.D || {};
function handleExternalScript () {
var container = Docsify.dom.getNode('#main');
var script = Docsify.dom.find(container, 'script');
var scripts = Docsify.dom.findAll(container, 'script');
if (script && script.src) {
var newScript = document.createElement('script');['src', 'async', 'defer'].forEach(function (attribute) {
newScript[attribute] = script[attribute];
});
for (var i = scripts.length; i--;) {
var script = scripts[i];
script.parentNode.removeChild(script);
container.appendChild(newScript);
if (script && script.src) {
var newScript = document.createElement('script');
Array.prototype.slice.call(script.attributes).forEach(function (attribute) {
newScript[attribute.name] = attribute.value;
});
script.parentNode.insertBefore(newScript, script);
script.parentNode.removeChild(script);
}
}
}
+1 -1
View File
@@ -1 +1 @@
this.D=this.D||{},function(){"use strict";function i(){var i=Docsify.dom.getNode("#main"),n=Docsify.dom.find(i,"script");if(n&&n.src){var c=document.createElement("script");["src","async","defer"].forEach(function(i){c[i]=n[i]}),n.parentNode.removeChild(n),i.appendChild(c)}}var n=function(n){n.doneEach(i)};window.$docsify.plugins=[].concat(n,window.$docsify.plugins)}();
this.D=this.D||{},function(){"use strict";function e(){for(var e=Docsify.dom.getNode("#main"),i=Docsify.dom.findAll(e,"script"),o=i.length;o--;){var t=i[o];if(t&&t.src){var n=document.createElement("script");Array.prototype.slice.call(t.attributes).forEach(function(e){n[e.name]=e.value}),t.parentNode.insertBefore(n,t),t.parentNode.removeChild(t)}}}var i=function(i){i.doneEach(e)};window.$docsify.plugins=[].concat(i,window.$docsify.plugins)}();
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -23,7 +23,7 @@ function init (id) {
function collect () {
init(window.$docsify.ga);
window.ga('set', 'page', location.href);
window.ga('set', 'page', location.hash);
window.ga('send', 'pageview');
}
+1 -1
View File
@@ -1 +1 @@
this.D=this.D||{},function(){"use strict";function n(){var n=document.createElement("script");n.async=!0,n.src="https://www.google-analytics.com/analytics.js",document.body.appendChild(n)}function o(o){window.ga||(n(),window.ga=window.ga||function(){(window.ga.q=window.ga.q||[]).push(arguments)},window.ga.l=Number(new Date),window.ga("create",o,"auto"))}function i(){o(window.$docsify.ga),window.ga("set","page",location.href),window.ga("send","pageview")}var w=function(n){return window.$docsify.ga?void n.beforeEach(i):void console.error("[Docsify] ga is required.")};window.$docsify.plugins=[].concat(w,window.$docsify.plugins)}();
this.D=this.D||{},function(){"use strict";function n(){var n=document.createElement("script");n.async=!0,n.src="https://www.google-analytics.com/analytics.js",document.body.appendChild(n)}function i(i){window.ga||(n(),window.ga=window.ga||function(){(window.ga.q=window.ga.q||[]).push(arguments)},window.ga.l=Number(new Date),window.ga("create",i,"auto"))}function o(){i(window.$docsify.ga),window.ga("set","page",location.hash),window.ga("send","pageview")}var w=function(n){if(!window.$docsify.ga)return void console.error("[Docsify] ga is required.");n.beforeEach(o)};window.$docsify.plugins=[].concat(w,window.$docsify.plugins)}();
+30 -22
View File
@@ -79,7 +79,7 @@ function search (keywords) {
data = data.concat(Object.keys(INDEXS[key]).map(function (page) { return INDEXS[key][page]; }));
});
keywords = keywords.trim().split(/[\s\-\\\/]+/);
keywords = [].concat(keywords, keywords.trim().split(/[\s\-\\\/]+/));
var loop = function ( i ) {
var post = data[i];
@@ -173,14 +173,16 @@ var dom;
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}\n\n.search h2 {\n font-size: 17px;\n margin: 10px 0;\n}\n\n.search a {\n text-decoration: none;\n color: inherit;\n}\n\n.search .matching-post {\n border-bottom: 1px solid #eee;\n}\n\n.search .matching-post:last-child {\n border-bottom: 0;\n}\n\n.search p {\n font-size: 14px;\n overflow: hidden;\n text-overflow: ellipsis;\n display: -webkit-box;\n -webkit-line-clamp: 2;\n -webkit-box-orient: vertical;\n}\n\n.search p.empty {\n text-align: center;\n}";
var code = "\n.sidebar {\n padding-top: 0;\n}\n\n.search {\n margin-bottom: 20px;\n padding: 6px;\n border-bottom: 1px solid #eee;\n}\n\n.search .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 = dom.create('style', code);
dom.appendTo(dom.head, style);
}
function tpl (opts) {
function tpl (opts, defaultValue) {
if ( defaultValue === void 0 ) defaultValue = '';
var html =
"<input type=\"search\" />" +
"<input type=\"search\" value=\"" + defaultValue + "\" />" +
'<div class="results-panel"></div>' +
'</div>';
var el = dom.create('div', html);
@@ -190,26 +192,29 @@ function tpl (opts) {
dom.before(aside, el);
}
function doSearch (value) {
var $search = dom.find('div.search');
var $panel = dom.find($search, '.results-panel');
if (!value) {
$panel.classList.remove('show');
$panel.innerHTML = '';
return
}
var matchs = search(value);
var html = '';
matchs.forEach(function (post) {
html += "<div class=\"matching-post\">\n<h2><a href=\"" + (post.url) + "\">" + (post.title) + "</a></h2>\n<p>" + (post.content) + "</p>\n</div>";
});
$panel.classList.add('show');
$panel.innerHTML = html || ("<p class=\"empty\">" + NO_DATA_TEXT + "</p>");
}
function bindEvents () {
var $search = dom.find('div.search');
var $input = dom.find($search, 'input');
var $panel = dom.find($search, '.results-panel');
var doSearch = function (value) {
if (!value) {
$panel.classList.remove('show');
$panel.innerHTML = '';
return
}
var matchs = search(value);
var html = '';
matchs.forEach(function (post) {
html += "<div class=\"matching-post\">\n <h2><a href=\"" + (post.url) + "\">" + (post.title) + "</a></h2>\n <p>" + (post.content) + "</p>\n</div>";
});
$panel.classList.add('show');
$panel.innerHTML = html || ("<p class=\"empty\">" + NO_DATA_TEXT + "</p>");
};
var timeId;
// Prevent to Fold sidebar
@@ -243,9 +248,12 @@ function updateNoData (text, path) {
function init$$1 (opts) {
dom = Docsify.dom;
var keywords = Docsify.route.parse().query.s;
style();
tpl(opts);
tpl(opts, keywords);
bindEvents();
keywords && setTimeout(function (_) { return doSearch(keywords); }, 500);
}
function update (opts, vm) {
+1 -1
View File
@@ -1 +1 @@
this.D=this.D||{},function(){"use strict";function e(e){var n={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;"};return String(e).replace(/[&<>"'\/]/g,function(e){return n[e]})}function n(){var e=[];return d.dom.findAll("a:not([data-nosearch])").map(function(n){var t=n.href,o=n.getAttribute("href"),a=d.route.parse(t).path;a&&e.indexOf(a)===-1&&!d.route.isAbsolutePath(o)&&e.push(a)}),e}function t(e){localStorage.setItem("docsify.search.expires",Date.now()+e),localStorage.setItem("docsify.search.index",JSON.stringify(g))}function o(e,n){void 0===n&&(n="");var t,o=window.marked.lexer(n),a=window.Docsify.slugify,i=Docsify.route.toURL,r={};return o.forEach(function(n){if("heading"===n.type&&n.depth<=2)t=i(e,{id:a(n.text)}),r[t]={slug:t,title:n.text,body:""};else{if(!t)return;r[t]?r[t].body?r[t].body+="\n"+(n.text||""):r[t].body=n.text:r[t]={slug:t,title:"",body:""}}}),a.clear(),r}function a(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=n.trim().split(/[\s\-\\\\/]+/);for(var a=function(a){var i=o[a],r=!1,s="",c=i.title&&i.title.trim(),l=i.body&&i.body.trim(),u=i.slug||"";if(c&&l&&(n.forEach(function(n,t){var o=new RegExp(n,"gi"),a=-1,i=-1;if(a=c&&c.search(o),i=l&&l.search(o),a<0&&i<0)r=!1;else{r=!0,i<0&&(i=0);var u=0,f=0;u=i<11?0:i-10,f=0===u?70:i+n.length+60,f>l.length&&(f=l.length);var p="..."+e(l).substring(u,f).replace(o,'<em class="search-keyword">'+n+"</em>")+"...";s+=p}}),r)){var f={title:e(c),content:s,url:u};t.push(f)}},i=0;i<o.length;i++)a(i);return t}function i(e,a){d=Docsify;var i="auto"===e.paths,r=localStorage.getItem("docsify.search.expires")<Date.now();if(g=JSON.parse(localStorage.getItem("docsify.search.index")),r)g={};else if(!i)return;var s=i?n():e.paths,c=s.length,l=0;s.forEach(function(n){return g[n]?l++:void d.get(a.$getFile(n)).then(function(a){g[n]=o(n,a),c===++l&&t(e.maxAge)})})}function r(){var e="\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}\n\n.search h2 {\n font-size: 17px;\n margin: 10px 0;\n}\n\n.search a {\n text-decoration: none;\n color: inherit;\n}\n\n.search .matching-post {\n border-bottom: 1px solid #eee;\n}\n\n.search .matching-post:last-child {\n border-bottom: 0;\n}\n\n.search p {\n font-size: 14px;\n overflow: hidden;\n text-overflow: ellipsis;\n display: -webkit-box;\n -webkit-line-clamp: 2;\n -webkit-box-orient: vertical;\n}\n\n.search p.empty {\n text-align: center;\n}",n=h.create("style",e);h.appendTo(h.head,n)}function s(e){var n='<input type="search" /><div class="results-panel"></div></div>',t=h.create("div",n),o=h.find("aside");h.toggleClass(t,"search"),h.before(o,t)}function c(){var e,n=h.find("div.search"),t=h.find(n,"input"),o=h.find(n,".results-panel"),i=function(e){if(!e)return o.classList.remove("show"),void(o.innerHTML="");var n=a(e),t="";n.forEach(function(e){t+='<div class="matching-post">\n <h2><a href="'+e.url+'">'+e.title+"</a></h2>\n <p>"+e.content+"</p>\n</div>"}),o.classList.add("show"),o.innerHTML=t||'<p class="empty">'+y+"</p>"};h.on(n,"click",function(e){return"A"!==e.target.tagName&&e.stopPropagation()}),h.on(t,"input",function(n){clearTimeout(e),e=setTimeout(function(e){return i(n.target.value.trim())},100)})}function l(e,n){var t=h.getNode('.search input[type="search"]');if("string"==typeof e)t.placeholder=e;else{var o=Object.keys(e).find(function(e){return n.indexOf(e)>-1});t.placeholder=e[o]}}function u(e,n){if("string"==typeof e)y=e;else{var t=Object.keys(e).find(function(e){return n.indexOf(e)>-1});y=e[t]}}function f(e){h=Docsify.dom,r(),s(e),c()}function p(e,n){l(e.placeholder,n.route.path),u(e.noData,n.route.path)}var d,h,g={},y="",m={placeholder:"Type to search",noData:"No Results!",paths:"auto",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);var a="auto"===m.paths;e.mounted(function(e){f(m),!a&&i(m,n)}),e.doneEach(function(e){p(m,n),a&&i(m,n)})};window.$docsify.plugins=[].concat(v,window.$docsify.plugins)}();
this.D=this.D||{},function(){"use strict";function e(e){var n={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;"};return String(e).replace(/[&<>"'\/]/g,function(e){return n[e]})}function n(){var e=[];return h.dom.findAll("a:not([data-nosearch])").map(function(n){var t=n.href,a=n.getAttribute("href"),o=h.route.parse(t).path;o&&-1===e.indexOf(o)&&!h.route.isAbsolutePath(a)&&e.push(o)}),e}function t(e){localStorage.setItem("docsify.search.expires",Date.now()+e),localStorage.setItem("docsify.search.index",JSON.stringify(y))}function a(e,n){void 0===n&&(n="");var t,a=window.marked.lexer(n),o=window.Docsify.slugify,r=Docsify.route.toURL,i={};return a.forEach(function(n){if("heading"===n.type&&n.depth<=2)t=r(e,{id:o(n.text)}),i[t]={slug:t,title:n.text,body:""};else{if(!t)return;i[t]?i[t].body?i[t].body+="\n"+(n.text||""):i[t].body=n.text:i[t]={slug:t,title:"",body:""}}}),o.clear(),i}function o(n){var t=[],a=[];Object.keys(y).forEach(function(e){a=a.concat(Object.keys(y[e]).map(function(n){return y[e][n]}))}),n=[].concat(n,n.trim().split(/[\s\-\\\\/]+/));for(var o=0;o<a.length;o++)!function(o){var r=a[o],i=!1,s="",c=r.title&&r.title.trim(),l=r.body&&r.body.trim(),u=r.slug||"";if(c&&l&&(n.forEach(function(n,t){var a=new RegExp(n,"gi"),o=-1,r=-1;if(o=c&&c.search(a),r=l&&l.search(a),o<0&&r<0)i=!1;else{i=!0,r<0&&(r=0);var u=0,p=0;u=r<11?0:r-10,p=0===u?70:r+n.length+60,p>l.length&&(p=l.length);var f="..."+e(l).substring(u,p).replace(a,'<em class="search-keyword">'+n+"</em>")+"...";s+=f}}),i)){var p={title:e(c),content:s,url:u};t.push(p)}}(o);return t}function r(e,o){h=Docsify;var r="auto"===e.paths,i=localStorage.getItem("docsify.search.expires")<Date.now();if(y=JSON.parse(localStorage.getItem("docsify.search.index")),i)y={};else if(!r)return;var s=r?n():e.paths,c=s.length,l=0;s.forEach(function(n){if(y[n])return l++;h.get(o.$getFile(n)).then(function(o){y[n]=a(n,o),c===++l&&t(e.maxAge)})})}function i(){var e=g.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}");g.appendTo(g.head,e)}function s(e,n){void 0===n&&(n="");var t='<input type="search" value="'+n+'" /><div class="results-panel"></div></div>',a=g.create("div",t),o=g.find("aside");g.toggleClass(a,"search"),g.before(o,a)}function c(e){var n=g.find("div.search"),t=g.find(n,".results-panel");if(!e)return t.classList.remove("show"),void(t.innerHTML="");var a=o(e),r="";a.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">'+v+"</p>"}function l(){var e,n=g.find("div.search"),t=g.find(n,"input");g.on(n,"click",function(e){return"A"!==e.target.tagName&&e.stopPropagation()}),g.on(t,"input",function(n){clearTimeout(e),e=setTimeout(function(e){return c(n.target.value.trim())},100)})}function u(e,n){var t=g.getNode('.search input[type="search"]');if("string"==typeof e)t.placeholder=e;else{var a=Object.keys(e).find(function(e){return n.indexOf(e)>-1});t.placeholder=e[a]}}function p(e,n){if("string"==typeof e)v=e;else{var t=Object.keys(e).find(function(e){return n.indexOf(e)>-1});v=e[t]}}function f(e){g=Docsify.dom;var n=Docsify.route.parse().query.s;i(),s(e,n),l(),n&&setTimeout(function(e){return c(n)},500)}function d(e,n){u(e.placeholder,n.route.path),p(e.noData,n.route.path)}var h,g,y={},v="",m={placeholder:"Type to search",noData:"No Results!",paths:"auto",maxAge:864e5},x=function(e,n){var t=Docsify.util,a=n.config.search||m;Array.isArray(a)?m.paths=a:"object"==typeof a&&(m.paths=Array.isArray(a.paths)?a.paths:"auto",m.maxAge=t.isPrimitive(a.maxAge)?a.maxAge:m.maxAge,m.placeholder=a.placeholder||m.placeholder,m.noData=a.noData||m.noData);var o="auto"===m.paths;e.mounted(function(e){f(m),!o&&r(m,n)}),e.doneEach(function(e){d(m,n),o&&r(m,n)})};window.$docsify.plugins=[].concat(x,window.$docsify.plugins)}();
+1 -1
View File
@@ -1 +1 @@
this.D=this.D||{},function(){"use strict";function t(t,e){return e={exports:{}},t(e,e.exports),e.exports}function e(t){var e,n=Docsify.dom;n.appendTo(n.head,n.create("style",i)),t.doneEach(function(t){var i=n.findAll("img:not(.emoji)");Array.isArray(e)&&e.length&&(e.forEach(function(t){return t()}),e=[]),e=i.map(o)})}var n="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},o=t(function(t,e){!function(e,n){t.exports=n()}(n,function(){function t(){g===-1&&(g=window.pageYOffset);var t=Math.abs(g-window.pageYOffset);t>=40&&a()}function e(t){27===t.keyCode&&a()}function n(t){var e=t.touches[0];null!==e&&(y=e.pageY,t.target.addEventListener("touchmove",o))}function o(t){var e=t.touches[0];null!==e&&Math.abs(e.pageY-y)>10&&(a(),t.target.removeEventListener("touchmove",o))}function i(){a()}function r(){document.addEventListener("scroll",t),document.addEventListener("keyup",e),document.addEventListener("touchstart",n),document.addEventListener("click",i,!0)}function s(){document.removeEventListener("scroll",t),document.removeEventListener("keyup",e),document.removeEventListener("touchstart",n),document.removeEventListener("click",i,!0)}function a(t){null!==h&&(t?h.dispose():h.close(),s(),h=null)}function c(t){if(!document.body.classList.contains("zoom-overlay-open"))return t.metaKey||t.ctrlKey?void window.open(t.target.getAttribute("data-original")||t.target.src,"_blank"):void(t.target.width>=m()-v||(a(!0),h=new p(t.target,v),h.zoom(),r()))}var m=function(){return document.documentElement.clientWidth},u=function(){return document.documentElement.clientHeight},d=function(t){var e=t.getBoundingClientRect(),n=document.documentElement,o=window;return{top:e.top+o.pageYOffset-n.clientTop,left:e.left+o.pageXOffset-n.clientLeft}},l=function(t,e,n){var o=function(t){t.target.removeEventListener(e,o),n()};t.addEventListener(e,o)},f=function(t,e){this.w=t,this.h=e},p=function(t,e){this.img=t,this.preservedTransform=t.style.transform,this.wrap=null,this.overlay=null,this.offset=e};p.prototype.forceRepaint=function(){this.img.offsetWidth},p.prototype.zoom=function(){var t=new f(this.img.naturalWidth,this.img.naturalHeight);this.wrap=document.createElement("div"),this.wrap.classList.add("zoom-img-wrap"),this.img.parentNode.insertBefore(this.wrap,this.img),this.wrap.appendChild(this.img),this.img.classList.add("zoom-img"),this.img.setAttribute("data-action","zoom-out"),this.overlay=document.createElement("div"),this.overlay.classList.add("zoom-overlay"),document.body.appendChild(this.overlay),this.forceRepaint();var e=this.calculateScale(t);this.forceRepaint(),this.animate(e),document.body.classList.add("zoom-overlay-open")},p.prototype.calculateScale=function(t){var e=t.w/this.img.width,n=m()-this.offset,o=u()-this.offset,i=t.w/t.h,r=n/o;return t.w<n&&t.h<o?e:i<r?o/t.h*e:n/t.w*e},p.prototype.animate=function(t){var e=d(this.img),n=window.pageYOffset,o=m()/2,i=n+u()/2,r=e.left+this.img.width/2,s=e.top+this.img.height/2,a=o-r,c=i-s,l=0,f="scale("+t+")",p="translate3d("+a+"px, "+c+"px, "+l+"px)";this.img.style.transform=f,this.wrap.style.transform=p},p.prototype.dispose=function(){null!==this.wrap&&null!==this.wrap.parentNode&&(this.img.classList.remove("zoom-img"),this.img.setAttribute("data-action","zoom"),this.wrap.parentNode.insertBefore(this.img,this.wrap),this.wrap.parentNode.removeChild(this.wrap),document.body.removeChild(this.overlay),document.body.classList.remove("zoom-overlay-transitioning"))},p.prototype.close=function(){var t=this;document.body.classList.add("zoom-overlay-transitioning"),this.img.style.transform=this.preservedTransform,0===this.img.style.length&&this.img.removeAttribute("style"),this.wrap.style.transform="none",l(this.img,"transitionend",function(){t.dispose(),document.body.classList.remove("zoom-overlay-open")})};var h=null,v=80,g=-1,y=-1,w=function(t){return t.setAttribute("data-action","zoom"),t.addEventListener("click",c),function(){return t.removeEventListener("click",c)}};return w})}),i='img[data-action="zoom"] {\n cursor: pointer;\n cursor: -webkit-zoom-in;\n cursor: zoom-in;\n}\n.zoom-img,\n.zoom-img-wrap {\n position: relative;\n z-index: 666;\n transition: -webkit-transform 300ms cubic-bezier(.2,0,.2,1);\n transition: transform 300ms cubic-bezier(.2,0,.2,1);\n transition: transform 300ms cubic-bezier(.2,0,.2,1), -webkit-transform 300ms cubic-bezier(.2,0,.2,1);\n}\n.zoom-overlay {\n z-index: 420;\n background: #fff;\n position: fixed;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n pointer-events: none;\n opacity: 0;\n transition: opacity 300ms;\n}\n.zoom-overlay-open .zoom-overlay {\n opacity: 1;\n}\n.zoom-overlay-open {\n cursor: pointer;\n cursor: -webkit-zoom-out;\n cursor: zoom-out;\n}\n.zoom-overlay-transitioning {\n cursor: default;\n}\n.zoom-overlay-open.zoom-overlay-transitioning .zoom-overlay{\n opacity: 0;\n}\n';$docsify.plugins=[].concat(e,$docsify.plugins)}();
this.D=this.D||{},function(){"use strict";function t(t){var o,i=Docsify.dom;i.appendTo(i.head,i.create("style",n)),t.doneEach(function(t){var n=i.findAll("img:not(.emoji)");Array.isArray(o)&&o.length&&(o.forEach(function(t){return t()}),o=[]),o=n.map(e)})}var e=("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self,function(t,e){return e={exports:{}},t(e,e.exports),e.exports}(function(t,e){!function(e,n){t.exports=function(){function t(){-1===g&&(g=window.pageYOffset),Math.abs(g-window.pageYOffset)>=40&&a()}function e(t){27===t.keyCode&&a()}function n(t){var e=t.touches[0];null!==e&&(y=e.pageY,t.target.addEventListener("touchmove",o))}function o(t){var e=t.touches[0];null!==e&&Math.abs(e.pageY-y)>10&&(a(),t.target.removeEventListener("touchmove",o))}function i(){a()}function r(){document.addEventListener("scroll",t),document.addEventListener("keyup",e),document.addEventListener("touchstart",n),document.addEventListener("click",i,!0)}function s(){document.removeEventListener("scroll",t),document.removeEventListener("keyup",e),document.removeEventListener("touchstart",n),document.removeEventListener("click",i,!0)}function a(t){null!==h&&(t?h.dispose():h.close(),s(),h=null)}function c(t){if(!document.body.classList.contains("zoom-overlay-open"))return t.metaKey||t.ctrlKey?void window.open(t.target.getAttribute("data-original")||t.target.src,"_blank"):void(t.target.width>=m()-v||(a(!0),h=new p(t.target,v),h.zoom(),r()))}var m=function(){return document.documentElement.clientWidth},u=function(){return document.documentElement.clientHeight},d=function(t){var e=t.getBoundingClientRect(),n=document.documentElement,o=window;return{top:e.top+o.pageYOffset-n.clientTop,left:e.left+o.pageXOffset-n.clientLeft}},l=function(t,e,n){var o=function(t){t.target.removeEventListener(e,o),n()};t.addEventListener(e,o)},f=function(t,e){this.w=t,this.h=e},p=function(t,e){this.img=t,this.preservedTransform=t.style.transform,this.wrap=null,this.overlay=null,this.offset=e};p.prototype.forceRepaint=function(){this.img.offsetWidth},p.prototype.zoom=function(){var t=new f(this.img.naturalWidth,this.img.naturalHeight);this.wrap=document.createElement("div"),this.wrap.classList.add("zoom-img-wrap"),this.img.parentNode.insertBefore(this.wrap,this.img),this.wrap.appendChild(this.img),this.img.classList.add("zoom-img"),this.img.setAttribute("data-action","zoom-out"),this.overlay=document.createElement("div"),this.overlay.classList.add("zoom-overlay"),document.body.appendChild(this.overlay),this.forceRepaint();var e=this.calculateScale(t);this.forceRepaint(),this.animate(e),document.body.classList.add("zoom-overlay-open")},p.prototype.calculateScale=function(t){var e=t.w/this.img.width,n=m()-this.offset,o=u()-this.offset,i=t.w/t.h,r=n/o;return t.w<n&&t.h<o?e:i<r?o/t.h*e:n/t.w*e},p.prototype.animate=function(t){var e=d(this.img),n=window.pageYOffset,o=m()/2,i=n+u()/2,r=e.left+this.img.width/2,s=e.top+this.img.height/2,a=o-r,c=i-s,l="scale("+t+")",f="translate3d("+a+"px, "+c+"px, 0px)";this.img.style.transform=l,this.wrap.style.transform=f},p.prototype.dispose=function(){null!==this.wrap&&null!==this.wrap.parentNode&&(this.img.classList.remove("zoom-img"),this.img.setAttribute("data-action","zoom"),this.wrap.parentNode.insertBefore(this.img,this.wrap),this.wrap.parentNode.removeChild(this.wrap),document.body.removeChild(this.overlay),document.body.classList.remove("zoom-overlay-transitioning"))},p.prototype.close=function(){var t=this;document.body.classList.add("zoom-overlay-transitioning"),this.img.style.transform=this.preservedTransform,0===this.img.style.length&&this.img.removeAttribute("style"),this.wrap.style.transform="none",l(this.img,"transitionend",function(){t.dispose(),document.body.classList.remove("zoom-overlay-open")})};var h=null,v=80,g=-1,y=-1;return function(t){return t.setAttribute("data-action","zoom"),t.addEventListener("click",c),function(){return t.removeEventListener("click",c)}}}()}()})),n='img[data-action="zoom"] {\n cursor: pointer;\n cursor: -webkit-zoom-in;\n cursor: zoom-in;\n}\n.zoom-img,\n.zoom-img-wrap {\n position: relative;\n z-index: 666;\n transition: -webkit-transform 300ms cubic-bezier(.2,0,.2,1);\n transition: transform 300ms cubic-bezier(.2,0,.2,1);\n transition: transform 300ms cubic-bezier(.2,0,.2,1), -webkit-transform 300ms cubic-bezier(.2,0,.2,1);\n}\n.zoom-overlay {\n z-index: 420;\n background: #fff;\n position: fixed;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n pointer-events: none;\n opacity: 0;\n transition: opacity 300ms;\n}\n.zoom-overlay-open .zoom-overlay {\n opacity: 1;\n}\n.zoom-overlay-open {\n cursor: pointer;\n cursor: -webkit-zoom-out;\n cursor: zoom-out;\n}\n.zoom-overlay-transitioning {\n cursor: default;\n}\n.zoom-overlay-open.zoom-overlay-transitioning .zoom-overlay{\n opacity: 0;\n}\n';$docsify.plugins=[].concat(t,$docsify.plugins)}();
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
+34 -29
View File
@@ -1,7 +1,18 @@
{
"name": "docsify",
"version": "3.4.2",
"version": "3.7.1",
"description": "A magical documentation generator.",
"author": {
"name": "qingwei-li",
"email": "cinwell.li@gmail.com",
"url": "https://github.com/QingWei-Li"
},
"homepage": "https://docsify.js.org",
"license": "MIT",
"repository": {
"type": "git",
"url": "git+https://github.com/QingWei-Li/docsify.git"
},
"main": "lib/docsify.js",
"files": [
"lib",
@@ -14,9 +25,27 @@
"dev": "node app.js & nodemon -w src -e js,css --exec 'npm run dev:build'",
"test": "eslint src"
},
"repository": {
"type": "git",
"url": "https://github.com/QingWei-Li/docsify.git"
"dependencies": {
"marked": "^0.3.6",
"prismjs": "^1.6.0",
"tinydate": "^1.0.0",
"zoom-image": "^0.1.4"
},
"devDependencies": {
"cssnano": "^3.10.0",
"eslint": "^3.18.0",
"eslint-config-vue": "^2.0.2",
"eslint-plugin-vue": "^2.0.1",
"nodemon": "^1.11.0",
"postcss": "^5.2.16",
"postcss-salad": "^1.0.8",
"rollup": "^0.41.6",
"rollup-plugin-buble": "^0.15.0",
"rollup-plugin-commonjs": "^8.0.2",
"rollup-plugin-node-resolve": "^2.0.0",
"rollup-plugin-string": "^2.0.2",
"rollup-plugin-uglify": "^1.0.1",
"serve-static": "^1.12.1"
},
"keywords": [
"doc",
@@ -24,29 +53,5 @@
"documentation",
"creator",
"generator"
],
"author": "qingwei-li <cinwell.li@gmail.com> (https://github.com/QingWei-Li)",
"homepage": "https://docsify.js.org",
"license": "MIT",
"devDependencies": {
"cssnano": "^3.8.1",
"eslint": "^3.10.2",
"eslint-config-vue": "^2.0.1",
"eslint-plugin-vue": "^1.0.0",
"nodemon": "^1.11.0",
"postcss": "^5.2.6",
"postcss-salad": "^1.0.5",
"rollup": "^0.41.1",
"rollup-plugin-buble": "^0.15.0",
"rollup-plugin-commonjs": "^7.0.0",
"rollup-plugin-node-resolve": "^2.0.0",
"rollup-plugin-string": "^2.0.2",
"rollup-plugin-uglify": "^1.0.1",
"serve-static": "^1.11.1"
},
"dependencies": {
"marked": "^0.3.6",
"prismjs": "^1.5.1",
"zoom-image": "^0.1.4"
}
]
}
+4 -1
View File
@@ -17,7 +17,10 @@ const config = merge({
autoHeader: false,
executeScript: null,
noEmoji: false,
ga: ''
ga: '',
mergeNavbar: false,
formatUpdated: '',
externalLinkTarget: '_blank'
}, window.$docsify)
const script = document.currentScript ||
+11 -6
View File
@@ -7,17 +7,22 @@ const title = dom.$.title
* Toggle button
*/
export function btn (el) {
const toggle = () => dom.body.classList.toggle('close')
const toggle = _ => dom.body.classList.toggle('close')
el = dom.getNode(el)
dom.on(el, 'click', toggle)
dom.on(el, 'click', e => {
e.stopPropagation()
toggle()
})
const sidebar = dom.getNode('.sidebar')
dom.on(sidebar, 'click', () => {
isMobile && toggle()
setTimeout(() => getAndActive(sidebar, true, true), 0)
})
isMobile && dom.on(dom.body, 'click', _ =>
dom.body.classList.contains('close') && toggle()
)
dom.on(sidebar, 'click', _ =>
setTimeout((_ => getAndActive(sidebar, true, true), 0))
)
}
export function sticky () {
+12 -4
View File
@@ -14,9 +14,10 @@ export function get (url, hasBar = false) {
const on = function () {
xhr.addEventListener.apply(xhr, arguments)
}
const cached = cache[url]
if (cache[url]) {
return { then: cb => cb(cache[url]), abort: noop }
if (cached) {
return { then: cb => cb(cached.content, cached.opt), abort: noop }
}
xhr.open('GET', url)
@@ -41,8 +42,15 @@ export function get (url, hasBar = false) {
if (target.status >= 400) {
error(target)
} else {
cache[url] = target.response
success(target.response)
const result = cache[url] = {
content: target.response,
opt: {
updatedAt: xhr.getResponseHeader('last-modified') ||
xhr.getResponseHeader('expires')
}
}
success(result.content, result.opt)
}
})
},
+2 -2
View File
@@ -28,8 +28,8 @@ export function fetchMixin (proto) {
this.isHTML = /\.html$/g.test(path)
// Load main content
last.then(text => {
this._renderMain(text)
last.then((text, opt) => {
this._renderMain(text, opt)
if (!loadSidebar) return cb()
const fn = result => { this._renderSidebar(result); cb() }
+29 -6
View File
@@ -11,6 +11,7 @@ import { isFn, merge, cached } from '../util/core'
let markdownCompiler = marked
let contentBase = ''
let currentPath = ''
let linkTarget = '_blank'
let renderer = new marked.Renderer()
const cacheTree = {}
let toc = []
@@ -32,8 +33,12 @@ export const markdown = cached(text => {
markdown.renderer = renderer
markdown.init = function (config = {}, base = window.location.pathname) {
markdown.init = function (config = {}, {
base = window.location.pathname,
externalLinkTarget
}) {
contentBase = getBasePath(base)
linkTarget = externalLinkTarget || linkTarget
if (isFn(config)) {
markdownCompiler = config(marked, renderer)
@@ -52,10 +57,24 @@ markdown.update = function () {
* @link https://github.com/chjj/marked#overriding-renderer-methods
*/
renderer.heading = function (text, level) {
const nextToc = { level, title: text }
if (/{docsify-ignore}/g.test(text)) {
text = text.replace('{docsify-ignore}', '')
nextToc.title = text
nextToc.ignoreSubHeading = true
}
if (/{docsify-ignore-all}/g.test(text)) {
text = text.replace('{docsify-ignore-all}', '')
nextToc.title = text
nextToc.ignoreAllSubs = true
}
const slug = slugify(text)
const url = toURL(currentPath, { id: slug })
toc.push({ level, slug: url, title: text })
nextToc.slug = url
toc.push(nextToc)
return `<h${level} id="${slug}"><a href="${url}" data-id="${slug}" class="anchor"><span>${text}</span></a></h${level}>`
}
@@ -68,14 +87,14 @@ renderer.code = function (code, lang = '') {
renderer.link = function (href, title, text) {
let blank = ''
if (!/:|(\/{2})/.test(href)) {
href = toURL(href)
href = toURL(href, null, currentPath)
} else {
blank = ' target="_blank"'
blank = ` target="${linkTarget}"`
}
if (title) {
title = ` title="${title}"`
}
return `<a href="${href}"${title}${blank}>${text}</a>`
return `<a href="${href}"${title || ''}${blank}>${text}</a>`
}
renderer.paragraph = function (text) {
if (/^!&gt;/.test(text)) {
@@ -119,7 +138,11 @@ export function sidebar (text, level) {
*/
export function subSidebar (el, level) {
if (el) {
toc[0] && toc[0].ignoreAllSubs && (toc = [])
toc[0] && toc[0].level === 1 && toc.shift()
toc.forEach((node, i) => {
node.ignoreSubHeading && toc.splice(i, 1)
})
const tree = cacheTree[currentPath] || genTree(toc, level)
el.parentNode.innerHTML += treeTpl(tree, '<ul class="app-sub-sidebar">')
cacheTree[currentPath] = tree
+32 -9
View File
@@ -7,6 +7,8 @@ import { markdown, sidebar, subSidebar, cover } from './compiler'
import { callHook } from '../init/lifecycle'
import { getBasePath, getPath, isAbsolutePath } from '../route/util'
import { isPrimitive } from '../util/core'
import { isMobile } from '../util/env'
import tinydate from 'tinydate'
function executeScript () {
const script = dom.findAll('.markdown-section>script')
@@ -20,6 +22,16 @@ function executeScript () {
}, 0)
}
function formatUpdated (html, updated, fn) {
updated = typeof fn === 'function'
? fn(updated)
: typeof fn === 'string'
? tinydate(fn)(new Date(updated))
: updated
return html.replace(/{docsify-updated}/g, updated)
}
function renderMain (html) {
if (!html) {
// TODO: Custom 404 page
@@ -96,9 +108,13 @@ export function renderMixin (proto) {
getAndActive('nav')
}
proto._renderMain = function (text) {
proto._renderMain = function (text, opt = {}) {
callHook(this, 'beforeEach', text, result => {
const html = this.isHTML ? result : markdown(result)
let html = this.isHTML ? result : markdown(result)
if (opt.updatedAt) {
html = formatUpdated(html, opt.updatedAt, this.config.formatUpdated)
}
callHook(this, 'afterEach', html, text => renderMain.call(this, text))
})
}
@@ -146,19 +162,15 @@ export function initRender (vm) {
const config = vm.config
// Init markdown compiler
markdown.init(config.markdown, config.basePath)
markdown.init(config.markdown, config)
const id = config.el || '#app'
const navEl = dom.find('nav') || dom.create('nav')
let el = dom.find(id)
let html = ''
let navAppendToTarget = dom.body
navEl.classList.add('app-nav')
if (!config.repo) {
navEl.classList.add('no-badge')
}
if (!el) {
el = dom.create(id)
dom.appendTo(dom.body, el)
@@ -173,8 +185,19 @@ export function initRender (vm) {
html += tpl.main(config)
// Render main app
vm._renderTo(el, html, true)
if (config.mergeNavbar && isMobile) {
navAppendToTarget = dom.find('.sidebar')
} else {
navEl.classList.add('app-nav')
if (!config.repo) {
navEl.classList.add('no-badge')
}
}
// Add nav
dom.before(dom.body, navEl)
dom.before(navAppendToTarget, navEl)
if (config.themeColor) {
dom.$.head.innerHTML += tpl.theme(config.themeColor)
+7 -2
View File
@@ -12,7 +12,7 @@ function replaceHash (path) {
const replaceSlug = cached(path => {
return path
.replace('#', '?id=')
.replace(/\?(\w+)=/g, (_, slug) => slug === 'id' ? '?id=' : `&${slug}=`)
// .replace(/\?(\w+)=/g, (_, slug) => slug === 'id' ? '?id=' : `&${slug}=`)
})
/**
* Normalize the current url
@@ -64,12 +64,17 @@ export function parse (path = window.location.href) {
* to URL
* @param {string} path
* @param {object} qs query params
* @param {string} currentRoute optional current route
*/
export function toURL (path, params) {
export function toURL (path, params, currentRoute) {
const local = currentRoute && path[0] === '#'
const route = parse(replaceSlug(path))
route.query = merge({}, route.query, params)
path = route.path + stringifyQuery(route.query)
path = path.replace(/\.md(\?)|\.md$/, '$1')
if (local) path = currentRoute + path
return cleanPath('#/' + path)
}
+3 -1
View File
@@ -54,5 +54,7 @@ export const getParentPath = cached(path => {
})
export const cleanPath = cached(path => {
return path.replace(/\/+/g, '/')
return path
.replace(/^\/+/, '/')
.replace(/([^:])\/{2,}/g, '$1/')
})
+12 -8
View File
@@ -1,16 +1,20 @@
function handleExternalScript () {
const container = Docsify.dom.getNode('#main')
const script = Docsify.dom.find(container, 'script')
const scripts = Docsify.dom.findAll(container, 'script')
if (script && script.src) {
const newScript = document.createElement('script')
for (let i = scripts.length; i--;) {
const script = scripts[i]
;['src', 'async', 'defer'].forEach(attribute => {
newScript[attribute] = script[attribute]
})
if (script && script.src) {
const newScript = document.createElement('script')
script.parentNode.removeChild(script)
container.appendChild(newScript)
Array.prototype.slice.call(script.attributes).forEach(attribute => {
newScript[attribute.name] = attribute.value
})
script.parentNode.insertBefore(newScript, script)
script.parentNode.removeChild(script)
}
}
}
+1 -1
View File
@@ -19,7 +19,7 @@ function init (id) {
function collect () {
init(window.$docsify.ga)
window.ga('set', 'page', location.href)
window.ga('set', 'page', location.hash)
window.ga('send', 'pageview')
}
+32 -23
View File
@@ -30,6 +30,9 @@ function style () {
padding: 7px;
line-height: 22px;
font-size: 14px;
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
}
.search h2 {
@@ -66,9 +69,9 @@ function style () {
dom.appendTo(dom.head, style)
}
function tpl (opts) {
function tpl (opts, defaultValue = '') {
const html =
`<input type="search" />` +
`<input type="search" value="${defaultValue}" />` +
'<div class="results-panel"></div>' +
'</div>'
const el = dom.create('div', html)
@@ -78,29 +81,32 @@ function tpl (opts) {
dom.before(aside, el)
}
function doSearch (value) {
const $search = dom.find('div.search')
const $panel = dom.find($search, '.results-panel')
if (!value) {
$panel.classList.remove('show')
$panel.innerHTML = ''
return
}
const matchs = search(value)
let html = ''
matchs.forEach(post => {
html += `<div class="matching-post">
<h2><a href="${post.url}">${post.title}</a></h2>
<p>${post.content}</p>
</div>`
})
$panel.classList.add('show')
$panel.innerHTML = html || `<p class="empty">${NO_DATA_TEXT}</p>`
}
function bindEvents () {
const $search = dom.find('div.search')
const $input = dom.find($search, 'input')
const $panel = dom.find($search, '.results-panel')
const doSearch = function (value) {
if (!value) {
$panel.classList.remove('show')
$panel.innerHTML = ''
return
}
const matchs = search(value)
let html = ''
matchs.forEach(post => {
html += `<div class="matching-post">
<h2><a href="${post.url}">${post.title}</a></h2>
<p>${post.content}</p>
</div>`
})
$panel.classList.add('show')
$panel.innerHTML = html || `<p class="empty">${NO_DATA_TEXT}</p>`
}
let timeId
// Prevent to Fold sidebar
@@ -134,9 +140,12 @@ function updateNoData (text, path) {
export function init (opts) {
dom = Docsify.dom
const keywords = Docsify.route.parse().query.s
style()
tpl(opts)
tpl(opts, keywords)
bindEvents()
keywords && setTimeout(_ => doSearch(keywords), 500)
}
export function update (opts, vm) {
+1 -1
View File
@@ -9,7 +9,7 @@ const CONFIG = {
}
const install = function (hook, vm) {
const util = Docsify.util
const { util } = Docsify
const opts = vm.config.search || CONFIG
if (Array.isArray(opts)) {
+1 -1
View File
@@ -73,7 +73,7 @@ export function search (keywords) {
data = data.concat(Object.keys(INDEXS[key]).map(page => INDEXS[key][page]))
})
keywords = keywords.trim().split(/[\s\-\\\/]+/)
keywords = [].concat(keywords, keywords.trim().split(/[\s\-\\\/]+/))
for (let i = 0; i < data.length; i++) {
const post = data[i]
+5 -5
View File
@@ -72,16 +72,16 @@ section.cover {
.cover-main > p:last-child a {
border-color: var(--theme-color, $color-primary);
border-radius: 2em;
border-radius: 2rem;
border-style: solid;
border-width: 1px;
box-sizing: border-box;
color: var(--theme-color, $color-primary);
display: inline-block;
font-size: 1.05em;
letter-spacing: 0.1em;
margin-right: 1em;
padding: 0.75em 2em;
font-size: 1.05rem;
letter-spacing: 0.1rem;
margin-right: 1rem;
padding: 0.75em 2rem;
text-decoration: none;
transition: all 0.15s ease;
+31 -16
View File
@@ -10,7 +10,7 @@
body:not(.ready) {
overflow: hidden;
[data-cloak], nav {
[data-cloak], .app-nav {
display: none;
}
}
@@ -27,7 +27,7 @@ div#app {
}
.emoji {
height: 1.2em;
height: 1.2rem;
vertical-align: middle;
}
@@ -83,7 +83,7 @@ kbd {
}
/* navbar */
nav.app-nav {
.app-nav {
left: 0;
margin: 25px 60px 0 0;
position: absolute;
@@ -100,7 +100,7 @@ nav.app-nav {
}
>a {
margin: 0 1em;
margin: 0 1rem;
padding: 5px 0;
}
@@ -129,7 +129,7 @@ nav.app-nav {
/* navbar dropdown */
li {
display: inline-block;
margin: 0 1em;
margin: 0 1rem;
padding: 5px 0;
position: relative;
@@ -152,7 +152,7 @@ nav.app-nav {
li {
display: block;
font-size: 14px;
line-height: 1em;
line-height: 1rem;
margin: 0;
margin: 8px 14px;
white-space: nowrap;
@@ -229,8 +229,8 @@ main {
z-index: 20;
> h1 {
margin: 0 auto 1em;
font-size: 1.5em;
margin: 0 auto 1rem;
font-size: 1.5rem;
font-weight: 300;
text-align: center;
@@ -238,6 +238,11 @@ main {
color: inherit;
text-decoration: none;
}
.app-nav {
display: block;
position: static;
}
}
ul {
@@ -325,7 +330,7 @@ body.sticky {
.markdown-section {
margin: 0 auto;
max-width: 800px;
padding: 20px 15px 40px 15px;
padding: 30px 15px 40px 15px;
position: relative;
> * {
@@ -348,7 +353,7 @@ body.sticky {
border-collapse: collapse;
border-spacing: 0;
display: block;
margin-bottom: 1em;
margin-bottom: 1rem;
overflow: auto;
width: 100%;
}
@@ -408,7 +413,7 @@ body.sticky {
.markdown-section p.warn {
background: rgba($color-primary, 0.1);
border-radius: 2px;
padding: 1em;
padding: 1rem;
}
body.close {
@@ -425,16 +430,26 @@ body.close {
}
}
@media (max-width: 600px) {
@media print {
.github-corner, .sidebar-toggle, .sidebar {
display: none;
}
.app-nav {
display: none;
}
}
@media screen and (max-width: 768px) {
.github-corner, .sidebar-toggle, .sidebar {
position: fixed;
}
nav {
.app-nav {
margin-top: 16px;
}
nav li ul {
.app-nav li ul {
top: 30px;
}
@@ -455,7 +470,7 @@ body.close {
transition: transform 250ms ease;
}
nav, .github-corner {
.app-nav, .github-corner {
transition: transform 250ms ease-out;
}
@@ -479,7 +494,7 @@ body.close {
transform: translateX($sidebar-width);
}
nav, .github-corner {
.app-nav, .github-corner {
display: none;
}
}
+17 -17
View File
@@ -3,7 +3,7 @@
$color-primary: #0074D9;
$color-bg: #fff;
$color-text: #34495e;
$sidebar-width: 16em;
$sidebar-width: 16rem;
@import "basic/layout";
@import "basic/coverpage";
@@ -21,7 +21,7 @@ $sidebar-width: 16em;
li {
list-style: none;
margin: 0;
padding: 0.2em 0 0.2em 1em;
padding: 0.2em 0 0.2em 1rem;
}
ul li ul {
@@ -54,40 +54,40 @@ $sidebar-width: 16em;
.markdown-section p,
.markdown-section ul,
.markdown-section ol {
line-height: 1.6em;
line-height: 1.6rem;
margin: 0 0 1em 0;
word-spacing: 0.05em;
word-spacing: 0.05rem;
}
.markdown-section h1 {
font-size: 2em;
font-size: 2rem;
font-weight: 500;
margin: 0 0 1em;
margin: 0 0 1rem;
}
.markdown-section h2 {
font-size: 1.8em;
font-size: 1.8rem;
font-weight: 400;
margin: 0 0 1rem 0;
padding: 1rem 0 0 0;
}
.markdown-section h3 {
font-size: 1.5em;
margin: 52px 0 1.2em;
font-size: 1.5rem;
margin: 52px 0 1.2rem;
}
.markdown-section h4 {
font-size: 1.25em;
font-size: 1.25rem;
}
.markdown-section h5 {
font-size: 1em;
font-size: 1rem;
}
.markdown-section h6 {
color: #777;
font-size: 1em;
font-size: 1rem;
}
.markdown-section figure,
@@ -99,7 +99,7 @@ $sidebar-width: 16em;
.markdown-section ul,
.markdown-section ol {
padding-left: 1.5em;
padding-left: 1.5rem;
}
.markdown-section li {
@@ -131,7 +131,7 @@ $sidebar-width: 16em;
background-color: #f9f9f9;
border-radius: 3px;
font-family: Inconsolata;
padding: 0.2em 0.4em;
padding: 0.2em 0.4rem;
white-space: pre;
}
@@ -221,7 +221,7 @@ $sidebar-width: 16em;
border-radius: 2px;
display: block;
font-family: Inconsolata;
line-height: 1.1em;
line-height: 1.1rem;
max-width: inherit;
overflow: inherit;
padding: 20px 0.8em 20px;
@@ -229,11 +229,11 @@ $sidebar-width: 16em;
}
.markdown-section code::after, .markdown-section code::before {
letter-spacing: 0.05em;
letter-spacing: 0.05rem;
}
code .token {
-webkit-font-smoothing: initial;
-moz-osx-font-smoothing: initial;
min-height: 1.5em;
min-height: 1.5rem;
}
+20 -20
View File
@@ -50,7 +50,7 @@ body {
.markdown-section h3,
.markdown-section h4,
.markdown-section strong {
color: #2c3e50;
color: #657b83;
font-weight: 600;
}
@@ -60,31 +60,31 @@ body {
}
.markdown-section h1 {
font-size: 2em;
margin: 0 0 1em;
font-size: 2rem;
margin: 0 0 1rem;
}
.markdown-section h2 {
font-size: 1.75em;
margin: 45px 0 0.8em;
font-size: 1.75rem;
margin: 45px 0 0.8rem;
}
.markdown-section h3 {
font-size: 1.5em;
margin: 40px 0 .6em;
font-size: 1.5rem;
margin: 40px 0 .6rem;
}
.markdown-section h4 {
font-size: 1.25em;
font-size: 1.25rem;
}
.markdown-section h5 {
font-size: 1em;
font-size: 1rem;
}
.markdown-section h6 {
color: #777;
font-size: 1em;
font-size: 1rem;
}
.markdown-section figure,
@@ -97,13 +97,13 @@ body {
.markdown-section p,
.markdown-section ul,
.markdown-section ol {
line-height: 1.6em;
word-spacing: 0.05em;
line-height: 1.6rem;
word-spacing: 0.05rem;
}
.markdown-section ul,
.markdown-section ol {
padding-left: 1.5em;
padding-left: 1.5rem;
}
.markdown-section blockquote {
@@ -131,7 +131,7 @@ body {
border-radius: 2px;
color: #657b83;
font-family: 'Roboto Mono', Monaco, courier, monospace;
font-size: 0.8em;
font-size: 0.8rem;
margin: 0 2px;
padding: 3px 5px;
white-space: nowrap;
@@ -142,10 +142,10 @@ body {
-webkit-font-smoothing: initial;
background-color: #282828;
font-family: 'Roboto Mono', Monaco, courier, monospace;
line-height: 1.5em;
line-height: 1.5rem;
margin: 1.2em 0;
overflow: auto;
padding: 0 1.4em;
padding: 0 1.4rem;
position: relative;
word-wrap: normal;
}
@@ -254,7 +254,7 @@ body {
color: #657b83;
display: block;
font-family: 'Roboto Mono', Monaco, courier, monospace;
font-size: 0.8em;
font-size: 0.8rem;
line-height: inherit;
margin: 0 2px;
max-width: inherit;
@@ -264,19 +264,19 @@ body {
}
.markdown-section code::after, .markdown-section code::before {
letter-spacing: 0.05em;
letter-spacing: 0.05rem;
}
code .token {
-moz-osx-font-smoothing: initial;
-webkit-font-smoothing: initial;
min-height: 1.5em;
min-height: 1.5rem;
}
pre::after {
color: #ccc;
content: attr(data-lang);
font-size: 0.6em;
font-size: 0.6rem;
font-weight: 600;
height: 15px;
line-height: 15px;
+19 -19
View File
@@ -71,31 +71,31 @@ body {
}
.markdown-section h1 {
font-size: 2em;
margin: 0 0 1em;
font-size: 2rem;
margin: 0 0 1rem;
}
.markdown-section h2 {
font-size: 1.75em;
margin: 45px 0 0.8em;
font-size: 1.75rem;
margin: 45px 0 0.8rem;
}
.markdown-section h3 {
font-size: 1.5em;
margin: 40px 0 .6em;
font-size: 1.5rem;
margin: 40px 0 .6rem;
}
.markdown-section h4 {
font-size: 1.25em;
font-size: 1.25rem;
}
.markdown-section h5 {
font-size: 1em;
font-size: 1rem;
}
.markdown-section h6 {
color: #777;
font-size: 1em;
font-size: 1rem;
}
.markdown-section figure,
@@ -108,13 +108,13 @@ body {
.markdown-section p,
.markdown-section ul,
.markdown-section ol {
line-height: 1.6em;
word-spacing: 0.05em;
line-height: 1.6rem;
word-spacing: 0.05rem;
}
.markdown-section ul,
.markdown-section ol {
padding-left: 1.5em;
padding-left: 1.5rem;
}
.markdown-section blockquote {
@@ -142,7 +142,7 @@ body {
border-radius: 2px;
color: #e96900;
font-family: 'Roboto Mono', Monaco, courier, monospace;
font-size: 0.8em;
font-size: 0.8rem;
margin: 0 2px;
padding: 3px 5px;
white-space: nowrap;
@@ -153,10 +153,10 @@ body {
-webkit-font-smoothing: initial;
background-color: #f8f8f8;
font-family: 'Roboto Mono', Monaco, courier, monospace;
line-height: 1.5em;
line-height: 1.5rem;
margin: 1.2em 0;
overflow: auto;
padding: 0 1.4em;
padding: 0 1.4rem;
position: relative;
word-wrap: normal;
}
@@ -265,7 +265,7 @@ body {
color: #525252;
display: block;
font-family: 'Roboto Mono', Monaco, courier, monospace;
font-size: 0.8em;
font-size: 0.8rem;
line-height: inherit;
margin: 0 2px;
max-width: inherit;
@@ -275,19 +275,19 @@ body {
}
.markdown-section code::after, .markdown-section code::before {
letter-spacing: 0.05em;
letter-spacing: 0.05rem;
}
code .token {
-moz-osx-font-smoothing: initial;
-webkit-font-smoothing: initial;
min-height: 1.5em;
min-height: 1.5rem;
}
pre::after {
color: #ccc;
content: attr(data-lang);
font-size: 0.6em;
font-size: 0.6rem;
font-weight: 600;
height: 15px;
line-height: 15px;
+550 -492
View File
File diff suppressed because it is too large Load Diff