Compare commits

...
34 Commits
Author SHA1 Message Date
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
56 changed files with 340 additions and 210 deletions
+1
View File
@@ -0,0 +1 @@
.git/
+3 -1
View File
@@ -1,5 +1,7 @@
{ {
"extends": ["vue"], "extends": [
"vue"
],
"env": { "env": {
"browser": true "browser": true
}, },
+2 -2
View File
@@ -1,4 +1,4 @@
.DS_Store
*.log *.log
.DS_Store
/themes
node_modules 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 sudo: false
cache: cache:
directories: directories:
- $HOME/.yarn-cache - $HOME/.yarn-cache
language: node_js language: node_js
node_js: stable node_js: stable
os:
- linux
- osx
+33 -1
View File
@@ -1,6 +1,38 @@
# 3.6.2/ 2017-04-12
* feat(external-script): detect more than one script dom, fixed #146
* GA: Send hash instead of complete href (#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 # 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)) * 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) * fix external-script not inserting script at right place [@Leopoldthecoder](https://github.com/Leopoldthecoder)
+8 -8
View File
@@ -23,15 +23,15 @@
'/zh-cn/changelog': '/changelog', '/zh-cn/changelog': '/changelog',
'/changelog': 'https://raw.githubusercontent.com/QingWei-Li/docsify/master/CHANGELOG' '/changelog': 'https://raw.githubusercontent.com/QingWei-Li/docsify/master/CHANGELOG'
}, },
auto2top: true,
basePath: '/docs/',
executeScript: true,
loadNavbar: true, loadNavbar: true,
executeScript: true loadSidebar: true,
name: 'docsify',
subMaxLevel: 2,
mergeNavbar: true
} }
</script> </script>
<script <script src="/lib/docsify.js"></script>
src="/lib/docsify.js"
data-name="docsify"
data-base-path="/docs/"
data-load-sidebar
data-sub-max-level="2"
data-auto2top></script>
</html> </html>
+2 -2
View File
@@ -4,9 +4,9 @@
## What is it ## 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 ## Features
+1 -1
View File
@@ -1,6 +1,6 @@
![logo](_media/icon.svg) ![logo](_media/icon.svg)
# docsify <small>3.4</small> # docsify <small>3.6</small>
> A magical documentation site generator. > A magical documentation site generator.
+4 -4
View File
@@ -1,4 +1,4 @@
- :uk: - Translations
- [:cn: 中文](/zh-cn/) - [:cn: 中文](/zh-cn/)
- [:de: German](/de-de/) - [:de: Deutsch](/de-de/)
- [:uk: English](/) - [:uk: English](/)
+16 -16
View File
@@ -1,22 +1,22 @@
- Getting started - Getting started
- [Quick start](/quickstart) - [Quick start](quickstart.md)
- [Writing more pages](/more-pages) - [Writing more pages](more-pages.md)
- [Custom navbar](/custom-navbar) - [Custom navbar](custom-navbar.md)
- [Cover page](/cover) - [Cover page](cover.md)
- Customization - Customization
- [Configuration](/configuration) - [Configuration](configuration.md)
- [Themes](/themes) - [Themes](themes.md)
- [List of Plugins](/plugins) - [List of Plugins](plugins.md)
- [Write a Plugin](/write-a-plugin) - [Write a Plugin](write-a-plugin.md)
- [Markdown configuration](/markdown) - [Markdown configuration](markdown.md)
- [Language highlighting](/language-highlight) - [Language highlighting](language-highlight.md)
- Guide - Guide
- [Deploy](/deploy) - [Deploy](deploy.md)
- [Helpers](/helpers) - [Helpers](helpers.md)
- [Vue compatibility](/vue) - [Vue compatibility](vue.md)
- [CDN](/cdn) - [CDN](cdn.md)
- [Offline Mode(PWA)](/pwa) - [Offline Mode(PWA)](pwa.md)
- [Changelog](/changelog) - [Changelog](changelog.md)
+13 -3
View File
@@ -166,7 +166,7 @@ window.$docsify = {
- Type: `Boolean|String` - Type: `Boolean|String`
- Default: `false` - 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 ```js
window.$docsify = { window.$docsify = {
@@ -212,7 +212,7 @@ window.$docsify = {
- Type: `Function` - Type: `Function`
See [Markdown configuration](/markdown). See [Markdown configuration](markdown.md).
```js ```js
window.$docsify = { window.$docsify = {
@@ -294,7 +294,7 @@ window.$docsify = {
</script> </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 ## no-emoji
@@ -305,3 +305,13 @@ window.$docsify = {
noEmoji: true noEmoji: true
} }
``` ```
## merge-navbar
Navbar will be merged with the sidebar on smaller screens.
```js
window.$docsify = {
mergeNavbar: true
}
```
+1 -1
View File
@@ -1,6 +1,6 @@
# Cover # 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 ## Basic usage
+10 -10
View File
@@ -20,7 +20,7 @@ If you need custom navigation, you can create a HTML-based navigation bar.
## Markdown ## 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 ```html
<!-- index.html --> <!-- index.html -->
@@ -52,17 +52,17 @@ You can create sub-lists by indenting items that are under a certain parent.
<!-- _navbar.md --> <!-- _navbar.md -->
- Getting started - Getting started
- [Quick start](/quickstart) - [Quick start](quickstart.md)
- [Writing more pages](/more-pages) - [Writing more pages](more-pages.md)
- [Custom navbar](/custom-navbar) - [Custom navbar](custom-navbar.md)
- [Cover page](/cover) - [Cover page](cover.md)
- Configuration - Configuration
- [Configuration](/configuration) - [Configuration](configuration.md)
- [Themes](/themes) - [Themes](themes.md)
- [Using plugins](/plugins) - [Using plugins](plugins.md)
- [Markdown configuration](/markdown) - [Markdown configuration](markdown.md)
- [Language highlight](/language-highlight) - [Language highlight](language-highlight.md)
``` ```
renders as renders as
+2 -2
View File
@@ -4,9 +4,9 @@
## Was ist das ## 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). **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) für weitere Informationen. Siehe [Schnellstart](de-de/quickstart.md) für weitere Informationen.
## Features ## Features
-4
View File
@@ -1,4 +0,0 @@
- :de:
- [:cn: 中文](/zh-cn/)
- [:de: German](/de-de/)
- [:uk: English](/)
+16 -16
View File
@@ -1,22 +1,22 @@
- Loslegen - Loslegen
- [Schnellstart](/de-de/quickstart) - [Schnellstart](de-de/quickstart.md)
- [Schreiben weiterer Seiten](/de-de/more-pages) - [Schreiben weiterer Seiten](de-de/more-pages.md)
- [Navigationsleiste anpassen](/de-de/custom-navbar) - [Navigationsleiste anpassen](de-de/custom-navbar.md)
- [Titelseite](/de-de/cover) - [Titelseite](de-de/cover.md)
- Anpassen - Anpassen
- [Einstellungen](/de-de/configuration) - [Einstellungen](de-de/configuration.md)
- [Themen](/de-de/themes) - [Themen](de-de/themes.md)
- [Liste der Erweiterungen](/de-de/plugins) - [Liste der Erweiterungen](de-de/plugins.md)
- [Schreiben eigener Erweiterungen](/de-de/write-a-plugin) - [Schreiben eigener Erweiterungen](de-de/write-a-plugin.md)
- [Markdown-Einstellungen](/de-de/markdown) - [Markdown-Einstellungen](de-de/markdown.md)
- [Hervorheben von Sprachen](/de-de/language-highlight) - [Hervorheben von Sprachen](de-de/language-highlight.md)
- Guide - Guide
- [Inbetriebnahme](/de-de/deploy) - [Inbetriebnahme](de-de/deploy.md)
- [Helfer](/de-de/helpers) - [Helfer](de-de/helpers.md)
- [Vue Kompatibilität](/de-de/vue) - [Vue Kompatibilität](de-de/vue.md)
- [CDN](/de-de/cdn) - [CDN](de-de/cdn.md)
- [Offline Modus (PWA)](/de-de/pwa) - [Offline Modus (PWA)](de-de/pwa.md)
- [Changelog](/de-de/changelog) - [Changelog](de-de/changelog.md)
+14 -4
View File
@@ -166,7 +166,7 @@ window.$docsify = {
- Typ: `Boolean|String` - Typ: `Boolean|String`
- Standard: `false` - Standard: `false`
Aktiviere das [Titelseitenfeature](/de-de/cover). Falls `true`, wird sie von `_coverpage.md` geladen. Aktiviere das [Titelseitenfeature](de-de/cover.md). Falls `true`, wird sie von `_coverpage.md` geladen.
```js ```js
window.$docsify = { window.$docsify = {
@@ -212,7 +212,7 @@ window.$docsify = {
- Typ: `Function` - Typ: `Function`
Siehe [Markdown Konfiguration](/de-de/markdown). Siehe [Markdown Konfiguration](de-de/markdown.md).
```js ```js
window.$docsify = { window.$docsify = {
@@ -278,7 +278,7 @@ window.$docsify = {
- Typ: `Boolean` - Typ: `Boolean`
Führe das Skript auf der Seite aus. Analysiere nur das erste script tag ([demo](/de-de/themes)). Sollte Vue verwendet sein, wird es in der Standardeinstellung ausgeführt. 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 ```js
window.$docsify = { window.$docsify = {
@@ -294,7 +294,7 @@ window.$docsify = {
</script> </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](plugins?id=external-script) plugin zu verwenden. ?> 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 ## no-emoji
@@ -305,3 +305,13 @@ window.$docsify = {
noEmoji: true noEmoji: true
} }
``` ```
## merge-navbar
Navbar will be merged with the sidebar on smaller screens.
```js
window.$docsify = {
mergeNavbar: true
}
```
+1 -1
View File
@@ -1,6 +1,6 @@
# Titelseite # Titelseite
Aktiviere die Unterstützung für Titelseiten, indem du `coverpage` auf **true** einstellst, vergleiche [coverpage Einstellungen](/de-de/configuration#coverpage). Aktiviere die Unterstützung für Titelseiten, indem du `coverpage` auf **true** einstellst, vergleiche [coverpage Einstellungen](configuration.md#coverpage).
## Einfache Verwendung ## Einfache Verwendung
+11 -11
View File
@@ -20,7 +20,7 @@ Solltest du eine Navigationsleiste benötigen, so kannst du eine HTML-basierte e
## Markdown ## 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](/de-de/configuration#load-navbar). 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 ```html
<!-- index.html --> <!-- index.html -->
@@ -52,17 +52,17 @@ Du kannst untergeordnete Listen erstellen, indem du untergeordnete Punkte einem
<!-- _navbar.md --> <!-- _navbar.md -->
- Getting started - Getting started
- [Quick start](/quickstart) - [Quick start](de-de/quickstart.md)
- [Writing more pages](/more-pages) - [Writing more pages](de-de/more-pages.md)
- [Custom navbar](/custom-navbar) - [Custom navbar](de-de/custom-navbar.md)
- [Cover page](/cover) - [Cover page](de-de/cover.md)
- Configuration - Configuration
- [Configuration](/configuration) - [Configuration](de-de/configuration.md)
- [Themes](/themes) - [Themes](de-de/themes.md)
- [Using plugins](/plugins) - [Using plugins](de-de/plugins.md)
- [Markdown configuration](/markdown) - [Markdown configuration](de-de/markdown.md)
- [Language highlight](/language-highlight) - [Language highlight](de-de/language-highlight.md)
``` ```
wird also wie folgt aussehen wird also wie folgt aussehen
@@ -71,7 +71,7 @@ wird also wie folgt aussehen
## Angepasste Navigationsleisten in Verbindung mit dem emoji Erweiterung ## Angepasste Navigationsleisten in Verbindung mit dem emoji Erweiterung
Solltest du die [emoji Erweiterung](/de-de/plugins#emoji) verwenden: Solltest du die [emoji Erweiterung](plugins.md#emoji) verwenden:
```html ```html
<!-- index.html --> <!-- index.html -->
+3 -3
View File
@@ -27,7 +27,7 @@ docs/de-de/guide.md => http://domain.com/de-de/guide
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 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](/de-de/configuration#load-sidebar). Als Erstes musst du `loadSidebar` auf **true** setzen, vergleiche [Einstellungen für das seitliche Inhaltsverzeichnis](configuration.md#load-sidebar).
```html ```html
<!-- index.html --> <!-- index.html -->
@@ -46,7 +46,7 @@ Als Zweites erstellst du eine Datei namens `_sidebar.md`:
<!-- docs/_sidebar.md --> <!-- docs/_sidebar.md -->
- [Home](/) - [Home](/)
- [Guide](/guide) - [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. !> 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.
@@ -55,7 +55,7 @@ Als Zweites erstellst du eine Datei namens `_sidebar.md`:
## Inhaltsverzeichnis ## Inhaltsverzeichnis
Eine angepasste Seitenleist kann auch automatisch ein Inhaltsverzeichnis generieren, indem ein `subMaxLevel` gesetzt wird, vergleiche [sub-max-level Einstellungen](/de-de/configuration#sub-max-level). 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 ```html
<!-- index.html --> <!-- index.html -->
+2 -2
View File
@@ -22,7 +22,7 @@ Nachdem der Befehl `init` vollständig ausgeführt wurde, kannst du folgende Dat
* `README.md` als die Startseite für die Dokumentation * `README.md` als die Startseite für die Dokumentation
* `.nojekyll` verhindert, dass Github Pages Dateien ignoriert, die mit einem Unterstrich beginnen. * `.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) hinzufügen. 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 ## Vorschau der eigenen Seiten
@@ -84,4 +84,4 @@ Du solltest das `data-app` Attribut anpassen, wenn du `el` geändert hast:
</script> </script>
``` ```
Vergleiche [el Einstellungen](/de-de/configuration#el). Vergleiche [el Einstellungen](configuration.md#el).
+1
View File
@@ -32,6 +32,7 @@
executeScript: true, executeScript: true,
loadSidebar: true, loadSidebar: true,
loadNavbar: true, loadNavbar: true,
mergeNavbar: true,
maxLevel: 4, maxLevel: 4,
name: 'docsify', name: 'docsify',
search: { search: {
+3 -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): 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 ```html
<!-- index.html --> <!-- index.html -->
@@ -46,7 +46,7 @@ Create the `_sidebar.md`:
<!-- docs/_sidebar.md --> <!-- docs/_sidebar.md -->
- [Home](/) - [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. !> 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 ## 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 ```html
<!-- index.html --> <!-- index.html -->
+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 * `README.md` as the home page
* `.nojekyll` prevents GitHub Pages from ignoring files that begin with an underscore * `.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 ## Preview your site
@@ -84,4 +84,4 @@ You should set the `data-app` attribute if you changed `el`:
</script> </script>
``` ```
Compare [el configuration](/configuration#el). Compare [el configuration](configuration.md#el).
+2 -2
View File
@@ -6,9 +6,9 @@
docsify 是一个动态生成文档网站的工具。不同于 GitBook、Hexo 的地方是它不会生成将 `.md` 转成 `.html` 文件,所有转换工作都是在运行时进行。 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)了解详情。
## 特性 ## 特性
- 无需构建,写完文档直接发布 - 无需构建,写完文档直接发布
-4
View File
@@ -1,4 +0,0 @@
- :cn:
- [:cn: 中文](/zh-cn/)
- [:de: German](/de-de/)
- [:uk: English](/)
+16 -16
View File
@@ -1,22 +1,22 @@
- 入门 - 入门
- [快速开始](zh-cn/quickstart) - [快速开始](zh-cn/quickstart.md)
- [多页文档](zh-cn/more-pages) - [多页文档](zh-cn/more-pages.md)
- [定制导航栏](zh-cn/custom-navbar) - [定制导航栏](zh-cn/custom-navbar.md)
- [封面](zh-cn/cover) - [封面](zh-cn/cover.md)
- 定制化 - 定制化
- [配置项](zh-cn/configuration) - [配置项](zh-cn/configuration.md)
- [主题](zh-cn/themes) - [主题](zh-cn/themes.md)
- [插件列表](zh-cn/plugins) - [插件列表](zh-cn/plugins.md)
- [开发插件](zh-cn/write-a-plugin) - [开发插件](zh-cn/write-a-plugin.md)
- [Markdown 配置](zh-cn/markdown) - [Markdown 配置](zh-cn/markdown.md)
- [代码高亮](zh-cn/language-highlight) - [代码高亮](zh-cn/language-highlight.md)
- 指南 - 指南
- [部署](zh-cn/deploy) - [部署](zh-cn/deploy.md)
- [文档助手](zh-cn/helpers) - [文档助手](zh-cn/helpers.md)
- [兼容 Vue](zh-cn/vue) - [兼容 Vue](zh-cn/vue.md)
- [CDN](zh-cn/cdn) - [CDN](zh-cn/cdn.md)
- [离线模式(PWA)](zh-cn/pwa) - [离线模式(PWA)](zh-cn/pwa.md)
- [Changelog](zh-cn/changelog) - [Changelog](zh-cn/changelog.md)
+17 -6
View File
@@ -74,7 +74,7 @@ window.$docsify = {
- 类型:`Boolean|String` - 类型:`Boolean|String`
- 默认值: `false` - 默认值: `false`
加载自定义导航栏,参考[定制导航栏](zh-cn/custom-navbar) 了解用法。设置为 `true` 后会加载 `_navbar.md` 文件,也可以自定义加载的文件名。 加载自定义导航栏,参考[定制导航栏](zh-cn/custom-navbar.md) 了解用法。设置为 `true` 后会加载 `_navbar.md` 文件,也可以自定义加载的文件名。
```js ```js
window.$docsify = { window.$docsify = {
@@ -91,7 +91,7 @@ window.$docsify = {
- 类型:`Boolean|String` - 类型:`Boolean|String`
- 默认值: `false` - 默认值: `false`
加载自定义侧边栏,参考[多页文档](zh-cn/more-pages)。设置为 `true` 后会加载 `_sidebar.md` 文件,也可以自定义加载的文件名。 加载自定义侧边栏,参考[多页文档](zh-cn/more-pages.md)。设置为 `true` 后会加载 `_sidebar.md` 文件,也可以自定义加载的文件名。
```js ```js
window.$docsify = { window.$docsify = {
@@ -173,7 +173,7 @@ window.$docsify = {
- 类型:`Boolean|String` - 类型:`Boolean|String`
- 默认值: `false` - 默认值: `false`
启用[封面页](/zh-cn/cover)。开启后是加载 `_coverpage.md` 文件,也可以自定义文件名。 启用[封面页](zh-cn/cover.md)。开启后是加载 `_coverpage.md` 文件,也可以自定义文件名。
```js ```js
window.$docsify = { window.$docsify = {
@@ -220,7 +220,7 @@ window.$docsify = {
- 类型: `Object|Function` - 类型: `Object|Function`
参考 [Markdown 配置](/zh-cn/markdown)。 参考 [Markdown 配置](zh-cn/markdown.md)。
```js ```js
window.$docsify = { window.$docsify = {
@@ -287,7 +287,7 @@ window.$docsify = {
- 类型:`Boolean` - 类型:`Boolean`
执行文档里的 script 标签里的脚本,只执行第一个 script ([demo](zh-cn/themes))。 如果 Vue 存在,则自动开启。 执行文档里的 script 标签里的脚本,只执行第一个 script ([demo](zh-cn/themes.md))。 如果 Vue 存在,则自动开启。
```js ```js
window.$docsify = { 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 ## no-emoji
@@ -315,3 +315,14 @@ window.$docsify = {
noEmoji: true noEmoji: true
} }
``` ```
## merge-navbar
小屏设备下合并导航栏到侧边栏。
```js
window.$docsify = {
mergeNavbar: true
}
```
+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* *index.html*
@@ -49,17 +49,17 @@
```markdown ```markdown
- 基础 - 基础
- [快速开始](zh-cn/quickstart) - [快速开始](zh-cn/quickstart.md)
- [多页文档](zh-cn/more-pages) - [多页文档](zh-cn/more-pages.md)
- [定制导航栏](zh-cn/custom-navbar) - [定制导航栏](zh-cn/custom-navbar.md)
- [封面](zh-cn/cover) - [封面](zh-cn/cover.md)
- 配置 - 配置
- [配置项](zh-cn/configuration) - [配置项](zh-cn/configuration.md)
- [主题](zh-cn/themes) - [主题](zh-cn/themes.md)
- [使用插件](zh-cn/plugins) - [使用插件](zh-cn/plugins.md)
- [Markdown 配置](zh-cn/markdown) - [Markdown 配置](zh-cn/markdown.md)
- [代码高亮](zh-cn/language-highlight) - [代码高亮](zh-cn/language-highlight.md)
``` ```
效果图 效果图
+1 -1
View File
@@ -26,7 +26,7 @@ docs/zh-cn/guide.md => http://domain.com/zh-cn/guide
默认情况下,侧边栏会根据当前文档的标题生成目录。也可以设置文档链接,通过 Markdown 文件生成,效果如当前的文档的侧边栏。 默认情况下,侧边栏会根据当前文档的标题生成目录。也可以设置文档链接,通过 Markdown 文件生成,效果如当前的文档的侧边栏。
首先配置 `loadSidebar` 选项,具体配置规则见[配置项#load-sidebar](zh-cn/configuration#load-sidebar)。 首先配置 `loadSidebar` 选项,具体配置规则见[配置项#load-sidebar](configuration.md#load-sidebar)。
```html ```html
<script> <script>
+1 -1
View File
@@ -22,7 +22,7 @@ docsify init ./docs
- `README.md` 会做为主页内容渲染 - `README.md` 会做为主页内容渲染
- `.nojekyll` 用于阻止 GitHub Pages 会忽略掉下划线开头的文件 - `.nojekyll` 用于阻止 GitHub Pages 会忽略掉下划线开头的文件
直接编辑 `docs/README.md` 就能更新网站内容,当然也可以[写多个页面](zh-cn/more-pages)。 直接编辑 `docs/README.md` 就能更新网站内容,当然也可以[写多个页面](zh-cn/more-pages.md)。
## 本地预览网站 ## 本地预览网站
+31 -15
View File
@@ -76,7 +76,8 @@ var config = merge({
autoHeader: false, autoHeader: false,
executeScript: null, executeScript: null,
noEmoji: false, noEmoji: false,
ga: '' ga: '',
mergeNavbar: false
}, window.$docsify); }, window.$docsify);
var script = document.currentScript || var script = document.currentScript ||
@@ -380,12 +381,17 @@ function parse (path) {
* to URL * to URL
* @param {string} path * @param {string} path
* @param {object} qs query params * @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)); var route = parse(replaceSlug(path));
route.query = merge({}, route.query, params); route.query = merge({}, route.query, params);
path = route.path + stringifyQuery(route.query); path = route.path + stringifyQuery(route.query);
path = path.replace(/\.md(\?)|\.md$/, '$1');
if (local) { path = currentRoute + path; }
return cleanPath('#/' + path) return cleanPath('#/' + path)
} }
@@ -410,17 +416,20 @@ var title = $.title;
* Toggle button * Toggle button
*/ */
function btn (el) { function btn (el) {
var toggle = function () { return body.classList.toggle('close'); }; var toggle = function (_) { return body.classList.toggle('close'); };
el = getNode(el); el = getNode(el);
on(el, 'click', toggle); on(el, 'click', function (e) {
e.stopPropagation();
toggle();
});
var sidebar = getNode('.sidebar'); var sidebar = getNode('.sidebar');
on(sidebar, 'click', function () { isMobile && on(body, 'click', function (_) { return body.classList.contains('close') && toggle(); }
isMobile && toggle(); );
setTimeout(function () { return getAndActive(sidebar, true, true); }, 0); on(sidebar, 'click', function (_) { return setTimeout((function (_) { return getAndActive(sidebar, true, true); }, 0)); }
}); );
} }
function sticky () { function sticky () {
@@ -3024,7 +3033,7 @@ renderer.code = function (code, lang) {
renderer.link = function (href, title, text) { renderer.link = function (href, title, text) {
var blank = ''; var blank = '';
if (!/:|(\/{2})/.test(href)) { if (!/:|(\/{2})/.test(href)) {
href = toURL(href); href = toURL(href, null, currentPath);
} else { } else {
blank = ' target="_blank"'; blank = ' target="_blank"';
} }
@@ -3258,12 +3267,8 @@ function initRender (vm) {
var el = find(id); var el = find(id);
var html = ''; var html = '';
var navAppendToTarget = body;
navEl.classList.add('app-nav');
if (!config.repo) {
navEl.classList.add('no-badge');
}
if (!el) { if (!el) {
el = create(id); el = create(id);
appendTo(body, el); appendTo(body, el);
@@ -3278,8 +3283,19 @@ function initRender (vm) {
html += main(config); html += main(config);
// Render main app // Render main app
vm._renderTo(el, html, true); 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 // Add nav
before(body, navEl); before(navAppendToTarget, navEl);
if (config.themeColor) { if (config.themeColor) {
$.head.innerHTML += theme(config.themeColor); $.head.innerHTML += theme(config.themeColor);
+2 -2
View File
File diff suppressed because one or more lines are too long
+14 -8
View File
@@ -4,16 +4,22 @@ this.D = this.D || {};
function handleExternalScript () { function handleExternalScript () {
var container = Docsify.dom.getNode('#main'); 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 loop = function ( i ) {
var newScript = document.createElement('script');['src', 'async', 'defer'].forEach(function (attribute) { var script = scripts[i];
newScript[attribute] = script[attribute];
});
script.parentNode.insertBefore(newScript, script); if (script && script.src) {
script.parentNode.removeChild(script); var newScript = document.createElement('script');['src', 'async', 'defer'].forEach(function (attribute) {
} newScript[attribute] = script[attribute];
});
script.parentNode.insertBefore(newScript, script);
script.parentNode.removeChild(script);
}
};
for (var i = scripts.length; i--;) loop( i );
} }
var install = function (hook) { var install = function (hook) {
+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 o=document.createElement("script");["src","async","defer"].forEach(function(i){o[i]=n[i]}),n.parentNode.insertBefore(o,n),n.parentNode.removeChild(n)}}var n=function(n){n.doneEach(i)};window.$docsify.plugins=[].concat(n,window.$docsify.plugins)}(); this.D=this.D||{},function(){"use strict";function n(){for(var n=Docsify.dom.getNode("#main"),i=Docsify.dom.findAll(n,"script"),o=function(n){var o=i[n];if(o&&o.src){var c=document.createElement("script");["src","async","defer"].forEach(function(n){c[n]=o[n]}),o.parentNode.insertBefore(c,o),o.parentNode.removeChild(o)}},c=i.length;c--;)o(c)}var i=function(i){i.doneEach(n)};window.$docsify.plugins=[].concat(i,window.$docsify.plugins)}();
+1 -1
View File
@@ -23,7 +23,7 @@ function init (id) {
function collect () { function collect () {
init(window.$docsify.ga); init(window.$docsify.ga);
window.ga('set', 'page', location.href); window.ga('set', 'page', location.hash);
window.ga('send', 'pageview'); 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 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.hash),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)}();
+2 -2
View File
@@ -79,7 +79,7 @@ function search (keywords) {
data = data.concat(Object.keys(INDEXS[key]).map(function (page) { return INDEXS[key][page]; })); 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 loop = function ( i ) {
var post = data[i]; var post = data[i];
@@ -173,7 +173,7 @@ var dom;
var NO_DATA_TEXT = ''; var NO_DATA_TEXT = '';
function style () { 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); var style = dom.create('style', code);
dom.appendTo(dom.head, style); dom.appendTo(dom.head, style);
} }
+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 n(n){var e={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;"};return String(n).replace(/[&<>"'\/]/g,function(n){return e[n]})}function e(){var n=[];return d.dom.findAll("a:not([data-nosearch])").map(function(e){var t=e.href,a=e.getAttribute("href"),o=d.route.parse(t).path;o&&n.indexOf(o)===-1&&!d.route.isAbsolutePath(a)&&n.push(o)}),n}function t(n){localStorage.setItem("docsify.search.expires",Date.now()+n),localStorage.setItem("docsify.search.index",JSON.stringify(g))}function a(n,e){void 0===e&&(e="");var t,a=window.marked.lexer(e),o=window.Docsify.slugify,r=Docsify.route.toURL,i={};return a.forEach(function(e){if("heading"===e.type&&e.depth<=2)t=r(n,{id:o(e.text)}),i[t]={slug:t,title:e.text,body:""};else{if(!t)return;i[t]?i[t].body?i[t].body+="\n"+(e.text||""):i[t].body=e.text:i[t]={slug:t,title:"",body:""}}}),o.clear(),i}function o(e){var t=[],a=[];Object.keys(g).forEach(function(n){a=a.concat(Object.keys(g[n]).map(function(e){return g[n][e]}))}),e=[].concat(e,e.trim().split(/[\s\-\\\\/]+/));for(var o=function(o){var r=a[o],i=!1,s="",c=r.title&&r.title.trim(),l=r.body&&r.body.trim(),p=r.slug||"";if(c&&l&&(e.forEach(function(e,t){var a=new RegExp(e,"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 p=0,u=0;p=r<11?0:r-10,u=0===p?70:r+e.length+60,u>l.length&&(u=l.length);var f="..."+n(l).substring(p,u).replace(a,'<em class="search-keyword">'+e+"</em>")+"...";s+=f}}),i)){var u={title:n(c),content:s,url:p};t.push(u)}},r=0;r<a.length;r++)o(r);return t}function r(n,o){d=Docsify;var r="auto"===n.paths,i=localStorage.getItem("docsify.search.expires")<Date.now();if(g=JSON.parse(localStorage.getItem("docsify.search.index")),i)g={};else if(!r)return;var s=r?e():n.paths,c=s.length,l=0;s.forEach(function(e){return g[e]?l++:void d.get(o.$getFile(e)).then(function(o){g[e]=a(e,o),c===++l&&t(n.maxAge)})})}function i(){var n="\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}",e=h.create("style",n);h.appendTo(h.head,e)}function s(n){var e='<input type="search" /><div class="results-panel"></div></div>',t=h.create("div",e),a=h.find("aside");h.toggleClass(t,"search"),h.before(a,t)}function c(){var n,e=h.find("div.search"),t=h.find(e,"input"),a=h.find(e,".results-panel"),r=function(n){if(!n)return a.classList.remove("show"),void(a.innerHTML="");var e=o(n),t="";e.forEach(function(n){t+='<div class="matching-post">\n <h2><a href="'+n.url+'">'+n.title+"</a></h2>\n <p>"+n.content+"</p>\n</div>"}),a.classList.add("show"),a.innerHTML=t||'<p class="empty">'+y+"</p>"};h.on(e,"click",function(n){return"A"!==n.target.tagName&&n.stopPropagation()}),h.on(t,"input",function(e){clearTimeout(n),n=setTimeout(function(n){return r(e.target.value.trim())},100)})}function l(n,e){var t=h.getNode('.search input[type="search"]');if("string"==typeof n)t.placeholder=n;else{var a=Object.keys(n).find(function(n){return e.indexOf(n)>-1});t.placeholder=n[a]}}function p(n,e){if("string"==typeof n)y=n;else{var t=Object.keys(n).find(function(n){return e.indexOf(n)>-1});y=n[t]}}function u(n){h=Docsify.dom,i(),s(n),c()}function f(n,e){l(n.placeholder,e.route.path),p(n.noData,e.route.path)}var d,h,g={},y="",m={placeholder:"Type to search",noData:"No Results!",paths:"auto",maxAge:864e5},v=function(n,e){var t=Docsify.util,a=e.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;n.mounted(function(n){u(m),!o&&r(m,e)}),n.doneEach(function(n){f(m,e),o&&r(m,e)})};window.$docsify.plugins=[].concat(v,window.$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
+3 -3
View File
@@ -1,6 +1,6 @@
{ {
"name": "docsify", "name": "docsify",
"version": "3.4.3", "version": "3.6.2",
"description": "A magical documentation generator.", "description": "A magical documentation generator.",
"author": { "author": {
"name": "qingwei-li", "name": "qingwei-li",
@@ -32,13 +32,13 @@
}, },
"devDependencies": { "devDependencies": {
"cssnano": "^3.10.0", "cssnano": "^3.10.0",
"eslint": "^3.17.1", "eslint": "^3.18.0",
"eslint-config-vue": "^2.0.2", "eslint-config-vue": "^2.0.2",
"eslint-plugin-vue": "^2.0.1", "eslint-plugin-vue": "^2.0.1",
"nodemon": "^1.11.0", "nodemon": "^1.11.0",
"postcss": "^5.2.16", "postcss": "^5.2.16",
"postcss-salad": "^1.0.8", "postcss-salad": "^1.0.8",
"rollup": "^0.41.5", "rollup": "^0.41.6",
"rollup-plugin-buble": "^0.15.0", "rollup-plugin-buble": "^0.15.0",
"rollup-plugin-commonjs": "^8.0.2", "rollup-plugin-commonjs": "^8.0.2",
"rollup-plugin-node-resolve": "^2.0.0", "rollup-plugin-node-resolve": "^2.0.0",
+2 -1
View File
@@ -17,7 +17,8 @@ const config = merge({
autoHeader: false, autoHeader: false,
executeScript: null, executeScript: null,
noEmoji: false, noEmoji: false,
ga: '' ga: '',
mergeNavbar: false
}, window.$docsify) }, window.$docsify)
const script = document.currentScript || const script = document.currentScript ||
+11 -6
View File
@@ -7,17 +7,22 @@ const title = dom.$.title
* Toggle button * Toggle button
*/ */
export function btn (el) { export function btn (el) {
const toggle = () => dom.body.classList.toggle('close') const toggle = _ => dom.body.classList.toggle('close')
el = dom.getNode(el) el = dom.getNode(el)
dom.on(el, 'click', toggle) dom.on(el, 'click', e => {
e.stopPropagation()
toggle()
})
const sidebar = dom.getNode('.sidebar') const sidebar = dom.getNode('.sidebar')
dom.on(sidebar, 'click', () => { isMobile && dom.on(dom.body, 'click', _ =>
isMobile && toggle() dom.body.classList.contains('close') && toggle()
setTimeout(() => getAndActive(sidebar, true, true), 0) )
}) dom.on(sidebar, 'click', _ =>
setTimeout((_ => getAndActive(sidebar, true, true), 0))
)
} }
export function sticky () { export function sticky () {
+1 -1
View File
@@ -82,7 +82,7 @@ renderer.code = function (code, lang = '') {
renderer.link = function (href, title, text) { renderer.link = function (href, title, text) {
let blank = '' let blank = ''
if (!/:|(\/{2})/.test(href)) { if (!/:|(\/{2})/.test(href)) {
href = toURL(href) href = toURL(href, null, currentPath)
} else { } else {
blank = ' target="_blank"' blank = ' target="_blank"'
} }
+14 -6
View File
@@ -7,6 +7,7 @@ import { markdown, sidebar, subSidebar, cover } from './compiler'
import { callHook } from '../init/lifecycle' import { callHook } from '../init/lifecycle'
import { getBasePath, getPath, isAbsolutePath } from '../route/util' import { getBasePath, getPath, isAbsolutePath } from '../route/util'
import { isPrimitive } from '../util/core' import { isPrimitive } from '../util/core'
import { isMobile } from '../util/env'
function executeScript () { function executeScript () {
const script = dom.findAll('.markdown-section>script') const script = dom.findAll('.markdown-section>script')
@@ -153,12 +154,8 @@ export function initRender (vm) {
let el = dom.find(id) let el = dom.find(id)
let html = '' let html = ''
let navAppendToTarget = dom.body
navEl.classList.add('app-nav')
if (!config.repo) {
navEl.classList.add('no-badge')
}
if (!el) { if (!el) {
el = dom.create(id) el = dom.create(id)
dom.appendTo(dom.body, el) dom.appendTo(dom.body, el)
@@ -173,8 +170,19 @@ export function initRender (vm) {
html += tpl.main(config) html += tpl.main(config)
// Render main app // Render main app
vm._renderTo(el, html, true) 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 // Add nav
dom.before(dom.body, navEl) dom.before(navAppendToTarget, navEl)
if (config.themeColor) { if (config.themeColor) {
dom.$.head.innerHTML += tpl.theme(config.themeColor) dom.$.head.innerHTML += tpl.theme(config.themeColor)
+6 -1
View File
@@ -64,12 +64,17 @@ export function parse (path = window.location.href) {
* to URL * to URL
* @param {string} path * @param {string} path
* @param {object} qs query params * @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)) const route = parse(replaceSlug(path))
route.query = merge({}, route.query, params) route.query = merge({}, route.query, params)
path = route.path + stringifyQuery(route.query) path = route.path + stringifyQuery(route.query)
path = path.replace(/\.md(\?)|\.md$/, '$1')
if (local) path = currentRoute + path
return cleanPath('#/' + path) return cleanPath('#/' + path)
} }
+12 -8
View File
@@ -1,16 +1,20 @@
function handleExternalScript () { function handleExternalScript () {
const container = Docsify.dom.getNode('#main') const container = Docsify.dom.getNode('#main')
const script = Docsify.dom.find(container, 'script') const scripts = Docsify.dom.findAll(container, 'script')
if (script && script.src) { for (let i = scripts.length; i--;) {
const newScript = document.createElement('script') const script = scripts[i]
;['src', 'async', 'defer'].forEach(attribute => { if (script && script.src) {
newScript[attribute] = script[attribute] const newScript = document.createElement('script')
})
script.parentNode.insertBefore(newScript, script) ;['src', 'async', 'defer'].forEach(attribute => {
script.parentNode.removeChild(script) newScript[attribute] = script[attribute]
})
script.parentNode.insertBefore(newScript, script)
script.parentNode.removeChild(script)
}
} }
} }
+1 -1
View File
@@ -19,7 +19,7 @@ function init (id) {
function collect () { function collect () {
init(window.$docsify.ga) init(window.$docsify.ga)
window.ga('set', 'page', location.href) window.ga('set', 'page', location.hash)
window.ga('send', 'pageview') window.ga('send', 'pageview')
} }
+3
View File
@@ -30,6 +30,9 @@ function style () {
padding: 7px; padding: 7px;
line-height: 22px; line-height: 22px;
font-size: 14px; font-size: 14px;
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
} }
.search h2 { .search h2 {
+1 -1
View File
@@ -73,7 +73,7 @@ export function search (keywords) {
data = data.concat(Object.keys(INDEXS[key]).map(page => INDEXS[key][page])) 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++) { for (let i = 0; i < data.length; i++) {
const post = data[i] const post = data[i]
+23 -8
View File
@@ -10,7 +10,7 @@
body:not(.ready) { body:not(.ready) {
overflow: hidden; overflow: hidden;
[data-cloak], nav { [data-cloak], .app-nav {
display: none; display: none;
} }
} }
@@ -83,7 +83,7 @@ kbd {
} }
/* navbar */ /* navbar */
nav.app-nav { .app-nav {
left: 0; left: 0;
margin: 25px 60px 0 0; margin: 25px 60px 0 0;
position: absolute; position: absolute;
@@ -238,6 +238,11 @@ main {
color: inherit; color: inherit;
text-decoration: none; text-decoration: none;
} }
.app-nav {
display: block;
position: static;
}
} }
ul { ul {
@@ -325,7 +330,7 @@ body.sticky {
.markdown-section { .markdown-section {
margin: 0 auto; margin: 0 auto;
max-width: 800px; max-width: 800px;
padding: 20px 15px 40px 15px; padding: 30px 15px 40px 15px;
position: relative; position: relative;
> * { > * {
@@ -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 { .github-corner, .sidebar-toggle, .sidebar {
position: fixed; position: fixed;
} }
nav { .app-nav {
margin-top: 16px; margin-top: 16px;
} }
nav li ul { .app-nav li ul {
top: 30px; top: 30px;
} }
@@ -455,7 +470,7 @@ body.close {
transition: transform 250ms ease; transition: transform 250ms ease;
} }
nav, .github-corner { .app-nav, .github-corner {
transition: transform 250ms ease-out; transition: transform 250ms ease-out;
} }
@@ -479,7 +494,7 @@ body.close {
transform: translateX($sidebar-width); transform: translateX($sidebar-width);
} }
nav, .github-corner { .app-nav, .github-corner {
display: none; display: none;
} }
} }