mirror of
https://gitee.com/docsifyjs/docsify.git
synced 2024-12-02 03:59:19 +08:00
docs: add mutiple covers
This commit is contained in:
parent
bd7ee84241
commit
4bdcee2cb3
@ -152,7 +152,7 @@ window.$docsify = {
|
|||||||
|
|
||||||
## coverpage
|
## coverpage
|
||||||
|
|
||||||
* Type: `Boolean|String`
|
* Type: `Boolean|String|String[]|Object`
|
||||||
* Default: `false`
|
* Default: `false`
|
||||||
|
|
||||||
Activate the [cover feature](cover.md). If true, it will load from `_coverpage.md`.
|
Activate the [cover feature](cover.md). If true, it will load from `_coverpage.md`.
|
||||||
@ -162,7 +162,16 @@ window.$docsify = {
|
|||||||
coverpage: true,
|
coverpage: true,
|
||||||
|
|
||||||
// Custom file name
|
// Custom file name
|
||||||
coverpage: 'cover.md'
|
coverpage: 'cover.md',
|
||||||
|
|
||||||
|
// mutiple covers
|
||||||
|
coverpage: ['/', '/zh-cn/'],
|
||||||
|
|
||||||
|
// mutiple covers and custom file name
|
||||||
|
coverpage: {
|
||||||
|
'/': 'cover.md',
|
||||||
|
'/zh-cn/': 'cover.md'
|
||||||
|
}
|
||||||
};
|
};
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -367,4 +376,16 @@ window.$docsify = {
|
|||||||
};
|
};
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## onlyCover
|
||||||
|
|
||||||
|
* type: `Boolean`
|
||||||
|
|
||||||
|
Only coverpage is loaded when When visiting the home page.
|
||||||
|
|
||||||
|
```js
|
||||||
|
window.$docsify = {
|
||||||
|
onlyCover: false
|
||||||
|
};
|
||||||
|
```
|
||||||
|
|
||||||
##
|
##
|
||||||
|
@ -26,9 +26,9 @@ Set `coverpage` to **true**, and create a `_coverpage.md`:
|
|||||||
|
|
||||||
> A magical documentation site generator.
|
> A magical documentation site generator.
|
||||||
|
|
||||||
- Simple and lightweight (~18kB gzipped)
|
* Simple and lightweight (~18kB gzipped)
|
||||||
- No statically built html files
|
* No statically built html files
|
||||||
- Multiple themes
|
* Multiple themes
|
||||||
|
|
||||||
[GitHub](https://github.com/QingWei-Li/docsify/)
|
[GitHub](https://github.com/QingWei-Li/docsify/)
|
||||||
[Get Started](#docsify)
|
[Get Started](#docsify)
|
||||||
@ -49,8 +49,51 @@ The background color is generated randomly by default. You can customize the bac
|
|||||||
[Get Started](#quick-start)
|
[Get Started](#quick-start)
|
||||||
|
|
||||||
<!-- background image -->
|
<!-- background image -->
|
||||||
|
|
||||||
![](_media/bg.png)
|
![](_media/bg.png)
|
||||||
|
|
||||||
<!-- background color -->
|
<!-- background color -->
|
||||||
|
|
||||||
![color](#f0f0f0)
|
![color](#f0f0f0)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Coverpage as homepage
|
||||||
|
|
||||||
|
Normal, the coverpage and the homepage appear at the same time. Of course, you can also separate the coverpage by [onlyCover option](configuration.md#onlycover).
|
||||||
|
|
||||||
|
## Multiple covers
|
||||||
|
|
||||||
|
If your docs site is in more than one language, it may be useful to set multiple covers.
|
||||||
|
|
||||||
|
For example, your docs structure is like this
|
||||||
|
|
||||||
|
```text
|
||||||
|
.
|
||||||
|
└── docs
|
||||||
|
├── README.md
|
||||||
|
├── guide.md
|
||||||
|
├── _coverpage.md
|
||||||
|
└── zh-cn
|
||||||
|
├── README.md
|
||||||
|
└── guide.md
|
||||||
|
└── _coverpage.md
|
||||||
|
```
|
||||||
|
|
||||||
|
Now, you can set
|
||||||
|
|
||||||
|
```js
|
||||||
|
window.$docsify = {
|
||||||
|
coverpage: ['/', '/zh-cn/']
|
||||||
|
};
|
||||||
|
```
|
||||||
|
|
||||||
|
Or a special file name
|
||||||
|
|
||||||
|
```js
|
||||||
|
window.$docsify = {
|
||||||
|
coverpage: {
|
||||||
|
'/': 'cover.md',
|
||||||
|
'/zh-cn/': 'cover.md'
|
||||||
|
}
|
||||||
|
};
|
||||||
|
```
|
||||||
|
@ -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.md#load-navbar).
|
Alternatively, you can create a custom markdown-based navigation file by setting `loadNavbar` to **true** and creating `_navbar.md`, compare [loadNavbar configuration](configuration.md#loadnavbar).
|
||||||
|
|
||||||
```html
|
```html
|
||||||
<!-- index.html -->
|
<!-- index.html -->
|
||||||
@ -36,13 +36,13 @@ Alternatively, you can create a custom markdown-based navigation file by setting
|
|||||||
```markdown
|
```markdown
|
||||||
<!-- _navbar.md -->
|
<!-- _navbar.md -->
|
||||||
|
|
||||||
- [En](/)
|
* [En](/)
|
||||||
- [chinese](/zh-cn/)
|
* [chinese](/zh-cn/)
|
||||||
```
|
```
|
||||||
|
|
||||||
!> 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.
|
||||||
|
|
||||||
`_navbar.md` is loaded from each level directory. If the current directory doesn't have `_navbar.md`, it will fall back to the parent directory. If, for example, the current path is `/guide/quick-start`, the `_navbar.md` will be loaded from `/guide/_navbar.md`.
|
`_navbar.md` is loaded from each level directory. If the current directory doesn't have `_navbar.md`, it will fall back to the parent directory. If, for example, the current path is `/guide/quick-start`, the `_navbar.md` will be loaded from `/guide/_navbar.md`.
|
||||||
|
|
||||||
## Nesting
|
## Nesting
|
||||||
|
|
||||||
@ -51,23 +51,24 @@ You can create sub-lists by indenting items that are under a certain parent.
|
|||||||
```markdown
|
```markdown
|
||||||
<!-- _navbar.md -->
|
<!-- _navbar.md -->
|
||||||
|
|
||||||
- Getting started
|
* Getting started
|
||||||
- [Quick start](quickstart.md)
|
|
||||||
- [Writing more pages](more-pages.md)
|
|
||||||
- [Custom navbar](custom-navbar.md)
|
|
||||||
- [Cover page](cover.md)
|
|
||||||
|
|
||||||
- Configuration
|
* [Quick start](quickstart.md)
|
||||||
- [Configuration](configuration.md)
|
* [Writing more pages](more-pages.md)
|
||||||
- [Themes](themes.md)
|
* [Custom navbar](custom-navbar.md)
|
||||||
- [Using plugins](plugins.md)
|
* [Cover page](cover.md)
|
||||||
- [Markdown configuration](markdown.md)
|
|
||||||
- [Language highlight](language-highlight.md)
|
* Configuration
|
||||||
|
* [Configuration](configuration.md)
|
||||||
|
* [Themes](themes.md)
|
||||||
|
* [Using plugins](plugins.md)
|
||||||
|
* [Markdown configuration](markdown.md)
|
||||||
|
* [Language highlight](language-highlight.md)
|
||||||
```
|
```
|
||||||
|
|
||||||
renders as
|
renders as
|
||||||
|
|
||||||
![Nesting navbar](_images/nested-navbar.png "Nesting navbar")
|
![Nesting navbar](_images/nested-navbar.png 'Nesting navbar')
|
||||||
|
|
||||||
## Combining custom navbars with the emoji plugin
|
## Combining custom navbars with the emoji plugin
|
||||||
|
|
||||||
@ -90,6 +91,6 @@ you could, for example, use flag emojis in your custom navbar Markdown file:
|
|||||||
```markdown
|
```markdown
|
||||||
<!-- _navbar.md -->
|
<!-- _navbar.md -->
|
||||||
|
|
||||||
- [:us:, :uk:](/)
|
* [:us:, :uk:](/)
|
||||||
- [:cn:](/zh-cn/)
|
* [:cn:](/zh-cn/)
|
||||||
```
|
```
|
||||||
|
@ -162,7 +162,16 @@ window.$docsify = {
|
|||||||
coverpage: true,
|
coverpage: true,
|
||||||
|
|
||||||
// Anderer Dateiname
|
// Anderer Dateiname
|
||||||
coverpage: 'cover.md'
|
coverpage: 'cover.md',
|
||||||
|
|
||||||
|
// mutiple covers
|
||||||
|
coverpage: ['/', '/zh-cn/'],
|
||||||
|
|
||||||
|
// mutiple covers and custom file name
|
||||||
|
coverpage: {
|
||||||
|
'/': 'cover.md',
|
||||||
|
'/zh-cn/': 'cover.md'
|
||||||
|
}
|
||||||
};
|
};
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -26,9 +26,9 @@ Setze `coverpage` auf **true**, und erstelle `_coverpage.md`:
|
|||||||
|
|
||||||
> Ein magischer Generator für Dokumentationsseiten.
|
> Ein magischer Generator für Dokumentationsseiten.
|
||||||
|
|
||||||
- Einfach und wenig Speicherbedarf (~18kB gzipped)
|
* Einfach und wenig Speicherbedarf (~18kB gzipped)
|
||||||
- Keine statischen HTML Dateien
|
* Keine statischen HTML Dateien
|
||||||
- Mehrere Themes
|
* Mehrere Themes
|
||||||
|
|
||||||
[GitHub](https://github.com/QingWei-Li/docsify/)
|
[GitHub](https://github.com/QingWei-Li/docsify/)
|
||||||
[Schnellstart](#docsify)
|
[Schnellstart](#docsify)
|
||||||
@ -49,8 +49,51 @@ Die Hintergrundfarbe wird in der Standardeinstellung zufällig generiert. Du kan
|
|||||||
[Schnellstart](#quick-start)
|
[Schnellstart](#quick-start)
|
||||||
|
|
||||||
<!-- Hintegrundbild -->
|
<!-- Hintegrundbild -->
|
||||||
|
|
||||||
![](_media/bg.png)
|
![](_media/bg.png)
|
||||||
|
|
||||||
<!-- Hintegrundfarbe -->
|
<!-- Hintegrundfarbe -->
|
||||||
|
|
||||||
![color](#f0f0f0)
|
![color](#f0f0f0)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Coverpage as homepage
|
||||||
|
|
||||||
|
Normal, the coverpage and the homepage appear at the same time. Of course, you can also separate the coverpage by [onlyCover option](de-de/configuration.md#onlycover).
|
||||||
|
|
||||||
|
## Multiple covers
|
||||||
|
|
||||||
|
If your docs site is in more than one language, it may be useful to set multiple covers.
|
||||||
|
|
||||||
|
For example, your docs structure is like this
|
||||||
|
|
||||||
|
```text
|
||||||
|
.
|
||||||
|
└── docs
|
||||||
|
├── README.md
|
||||||
|
├── guide.md
|
||||||
|
├── _coverpage.md
|
||||||
|
└── zh-cn
|
||||||
|
├── README.md
|
||||||
|
└── guide.md
|
||||||
|
└── _coverpage.md
|
||||||
|
```
|
||||||
|
|
||||||
|
Now, you can set
|
||||||
|
|
||||||
|
```js
|
||||||
|
window.$docsify = {
|
||||||
|
coverpage: ['/', '/zh-cn/']
|
||||||
|
};
|
||||||
|
```
|
||||||
|
|
||||||
|
Or a special file name
|
||||||
|
|
||||||
|
```js
|
||||||
|
window.$docsify = {
|
||||||
|
coverpage: {
|
||||||
|
'/': 'cover.md',
|
||||||
|
'/zh-cn/': 'cover.md'
|
||||||
|
}
|
||||||
|
};
|
||||||
|
```
|
||||||
|
@ -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](configuration.md#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 [loadNavbar Einstellungen](configuration.md#loadnavbar).
|
||||||
|
|
||||||
```html
|
```html
|
||||||
<!-- index.html -->
|
<!-- index.html -->
|
||||||
@ -36,13 +36,13 @@ Oder du kannst deine Navigationsleiste mit einer Datei basierend auf Markdown er
|
|||||||
```markdown
|
```markdown
|
||||||
<!-- _navbar.md -->
|
<!-- _navbar.md -->
|
||||||
|
|
||||||
- [En](/)
|
* [En](/)
|
||||||
- [Deutsch](/de-de/)
|
* [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.
|
!> 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.
|
`_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
|
## Aufbauen von Strukturen
|
||||||
|
|
||||||
@ -51,23 +51,24 @@ Du kannst untergeordnete Listen erstellen, indem du untergeordnete Punkte einem
|
|||||||
```markdown
|
```markdown
|
||||||
<!-- _navbar.md -->
|
<!-- _navbar.md -->
|
||||||
|
|
||||||
- Getting started
|
* 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
|
* [Quick start](de-de/quickstart.md)
|
||||||
- [Configuration](de-de/configuration.md)
|
* [Writing more pages](de-de/more-pages.md)
|
||||||
- [Themes](de-de/themes.md)
|
* [Custom navbar](de-de/custom-navbar.md)
|
||||||
- [Using plugins](de-de/plugins.md)
|
* [Cover page](de-de/cover.md)
|
||||||
- [Markdown configuration](de-de/markdown.md)
|
|
||||||
- [Language highlight](de-de/language-highlight.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
|
wird also wie folgt aussehen
|
||||||
|
|
||||||
![Nesting navbar](_images/nested-navbar.png "Nesting navbar")
|
![Nesting navbar](_images/nested-navbar.png 'Nesting navbar')
|
||||||
|
|
||||||
## Angepasste Navigationsleisten in Verbindung mit dem emoji Erweiterung
|
## Angepasste Navigationsleisten in Verbindung mit dem emoji Erweiterung
|
||||||
|
|
||||||
@ -90,6 +91,6 @@ so kannst du z.B. auch die Flaggenemojis in der Markdown Datei für deine angepa
|
|||||||
```markdown
|
```markdown
|
||||||
<!-- _navbar.md -->
|
<!-- _navbar.md -->
|
||||||
|
|
||||||
- [:us:, :uk:](/)
|
* [:us:, :uk:](/)
|
||||||
- [:de:](/de-de/)
|
* [:de:](/de-de/)
|
||||||
```
|
```
|
||||||
|
@ -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](configuration.md#load-sidebar).
|
Als Erstes musst du `loadSidebar` auf **true** setzen, vergleiche [Einstellungen für das seitliche Inhaltsverzeichnis](configuration.md#loadsidebar).
|
||||||
|
|
||||||
```html
|
```html
|
||||||
<!-- index.html -->
|
<!-- index.html -->
|
||||||
@ -45,13 +45,13 @@ Als Zweites erstellst du eine Datei namens `_sidebar.md`:
|
|||||||
```markdown
|
```markdown
|
||||||
<!-- docs/_sidebar.md -->
|
<!-- docs/_sidebar.md -->
|
||||||
|
|
||||||
- [Home](/)
|
* [Home](/)
|
||||||
- [Guide](de-de/guide.md)
|
* [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.
|
||||||
|
|
||||||
`_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.
|
`_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.
|
||||||
|
|
||||||
You can specify `alias` to avoid unnecessary fallback.
|
You can specify `alias` to avoid unnecessary fallback.
|
||||||
|
|
||||||
@ -68,7 +68,7 @@ You can specify `alias` to avoid unnecessary fallback.
|
|||||||
|
|
||||||
## Inhaltsverzeichnis
|
## 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).
|
Eine angepasste Seitenleist kann auch automatisch ein Inhaltsverzeichnis generieren, indem ein `subMaxLevel` gesetzt wird, vergleiche [subMaxLevel Einstellungen](configuration.md#submaxlevel).
|
||||||
|
|
||||||
```html
|
```html
|
||||||
<!-- index.html -->
|
<!-- index.html -->
|
||||||
@ -90,6 +90,7 @@ When `subMaxLevel` is set, each header is automatically added to the table of co
|
|||||||
# Getting Started
|
# Getting Started
|
||||||
|
|
||||||
## Header {docsify-ignore}
|
## Header {docsify-ignore}
|
||||||
|
|
||||||
This header won't appear in the sidebar table of contents.
|
This header won't appear in the sidebar table of contents.
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -99,6 +100,7 @@ To ignore all headers on a specific page, you can use `{docsify-ignore-all}` on
|
|||||||
# Getting Started {docsify-ignore-all}
|
# Getting Started {docsify-ignore-all}
|
||||||
|
|
||||||
## Header
|
## Header
|
||||||
|
|
||||||
This header won't appear in the sidebar table of contents.
|
This header won't appear in the sidebar table of contents.
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@ docs/zh-cn/guide.md => http://domain.com/zh-cn/guide
|
|||||||
|
|
||||||
In order to have 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):
|
In order to have 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.md#load-sidebar).
|
First, you need to set `loadSidebar` to **true**. Details are available in the [configuration paragraph](configuration.md#loadsidebar).
|
||||||
|
|
||||||
```html
|
```html
|
||||||
<!-- index.html -->
|
<!-- index.html -->
|
||||||
@ -45,13 +45,13 @@ Create the `_sidebar.md`:
|
|||||||
```markdown
|
```markdown
|
||||||
<!-- docs/_sidebar.md -->
|
<!-- docs/_sidebar.md -->
|
||||||
|
|
||||||
- [Home](/)
|
* [Home](/)
|
||||||
- [Guide](guide.md)
|
* [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.
|
||||||
|
|
||||||
`_sidebar.md` is loaded from each level directory. If the current directory doesn't have `_sidebar.md`, it will fall back to the parent directory. If, for example, the current path is `/guide/quick-start`, the `_sidebar.md` will be loaded from `/guide/_sidebar.md`.
|
`_sidebar.md` is loaded from each level directory. If the current directory doesn't have `_sidebar.md`, it will fall back to the parent directory. If, for example, the current path is `/guide/quick-start`, the `_sidebar.md` will be loaded from `/guide/_sidebar.md`.
|
||||||
|
|
||||||
You can specify `alias` to avoid unnecessary fallback.
|
You can specify `alias` to avoid unnecessary fallback.
|
||||||
|
|
||||||
@ -70,7 +70,7 @@ You can specify `alias` to avoid unnecessary fallback.
|
|||||||
|
|
||||||
Once you've created `_sidebar.md`, the sidebar content is automatically generated based on the headers in the markdown files.
|
Once you've created `_sidebar.md`, the sidebar content is automatically generated based on the headers in the markdown files.
|
||||||
|
|
||||||
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).
|
A custom sidebar can also automatically generate a table of contents by setting a `subMaxLevel`, compare [subMaxLevel configuration](configuration.md#submaxlevel).
|
||||||
|
|
||||||
```html
|
```html
|
||||||
<!-- index.html -->
|
<!-- index.html -->
|
||||||
@ -92,6 +92,7 @@ When `subMaxLevel` is set, each header is automatically added to the table of co
|
|||||||
# Getting Started
|
# Getting Started
|
||||||
|
|
||||||
## Header {docsify-ignore}
|
## Header {docsify-ignore}
|
||||||
|
|
||||||
This header won't appear in the sidebar table of contents.
|
This header won't appear in the sidebar table of contents.
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -101,6 +102,7 @@ To ignore all headers on a specific page, you can use `{docsify-ignore-all}` on
|
|||||||
# Getting Started {docsify-ignore-all}
|
# Getting Started {docsify-ignore-all}
|
||||||
|
|
||||||
## Header
|
## Header
|
||||||
|
|
||||||
This header won't appear in the sidebar table of contents.
|
This header won't appear in the sidebar table of contents.
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -175,7 +175,16 @@ window.$docsify = {
|
|||||||
coverpage: true,
|
coverpage: true,
|
||||||
|
|
||||||
// 自定义文件名
|
// 自定义文件名
|
||||||
coverpage: 'cover.md'
|
coverpage: 'cover.md',
|
||||||
|
|
||||||
|
// mutiple covers
|
||||||
|
coverpage: ['/', '/zh-cn/'],
|
||||||
|
|
||||||
|
// mutiple covers and custom file name
|
||||||
|
coverpage: {
|
||||||
|
'/': 'cover.md',
|
||||||
|
'/zh-cn/': 'cover.md'
|
||||||
|
}
|
||||||
};
|
};
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
封面的生成同样是从 markdown 文件渲染来的。开启渲染封面功能后在文档根目录创建 `_coverpage.md` 文件。渲染效果如本文档。
|
封面的生成同样是从 markdown 文件渲染来的。开启渲染封面功能后在文档根目录创建 `_coverpage.md` 文件。渲染效果如本文档。
|
||||||
|
|
||||||
*index.html*
|
_index.html_
|
||||||
|
|
||||||
```html
|
```html
|
||||||
<script>
|
<script>
|
||||||
@ -17,7 +17,7 @@
|
|||||||
<script src="//unpkg.com/docsify"></script>
|
<script src="//unpkg.com/docsify"></script>
|
||||||
```
|
```
|
||||||
|
|
||||||
*_coverpage.md*
|
_\_coverpage.md_
|
||||||
|
|
||||||
```markdown
|
```markdown
|
||||||
![logo](_media/icon.svg)
|
![logo](_media/icon.svg)
|
||||||
@ -26,24 +26,21 @@
|
|||||||
|
|
||||||
> A magical documentation site generator.
|
> A magical documentation site generator.
|
||||||
|
|
||||||
- Simple and lightweight (~12kb gzipped)
|
* Simple and lightweight (~12kb gzipped)
|
||||||
- Multiple themes
|
* Multiple themes
|
||||||
- Not build static html files
|
* Not build static html files
|
||||||
|
|
||||||
|
|
||||||
[GitHub](https://github.com/QingWei-Li/docsify/)
|
[GitHub](https://github.com/QingWei-Li/docsify/)
|
||||||
[Get Started](#quick-start)
|
[Get Started](#quick-start)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
!> 一份文档只会在根目录下加载封面,其他页面或者二级目录下都不会加载。
|
!> 一份文档只会在根目录下加载封面,其他页面或者二级目录下都不会加载。
|
||||||
|
|
||||||
## 自定义背景
|
## 自定义背景
|
||||||
|
|
||||||
目前的背景是随机生成的渐变色,我们自定义背景色或者背景图。在文档末尾用添加图片的 Markdown 语法设置背景。
|
目前的背景是随机生成的渐变色,我们自定义背景色或者背景图。在文档末尾用添加图片的 Markdown 语法设置背景。
|
||||||
|
|
||||||
*_coverpage.md*
|
_\_coverpage.md_
|
||||||
|
|
||||||
```markdown
|
```markdown
|
||||||
# docsify
|
# docsify
|
||||||
@ -52,7 +49,51 @@
|
|||||||
[Get Started](#quick-start)
|
[Get Started](#quick-start)
|
||||||
|
|
||||||
<!-- 背景图片 -->
|
<!-- 背景图片 -->
|
||||||
|
|
||||||
![](_media/bg.png)
|
![](_media/bg.png)
|
||||||
|
|
||||||
<!-- 背景色 -->
|
<!-- 背景色 -->
|
||||||
|
|
||||||
![color](#f0f0f0)
|
![color](#f0f0f0)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## 封面作为首页
|
||||||
|
|
||||||
|
通常封面和首页是同时出现的,当然你也是当封面独立出来通过设置[onlyCover 选项](zh-cn/configuration.md#onlycover)。
|
||||||
|
|
||||||
|
## 多个封面
|
||||||
|
|
||||||
|
如果你的文档网站是多语言的,或许你需要设置多个封面。
|
||||||
|
|
||||||
|
例如你的文档目录结构如下
|
||||||
|
|
||||||
|
```text
|
||||||
|
.
|
||||||
|
└── docs
|
||||||
|
├── README.md
|
||||||
|
├── guide.md
|
||||||
|
├── _coverpage.md
|
||||||
|
└── zh-cn
|
||||||
|
├── README.md
|
||||||
|
└── guide.md
|
||||||
|
└── _coverpage.md
|
||||||
|
```
|
||||||
|
|
||||||
|
那么你可以这么配置
|
||||||
|
|
||||||
|
```js
|
||||||
|
window.$docsify = {
|
||||||
|
coverpage: ['/', '/zh-cn/']
|
||||||
|
};
|
||||||
|
```
|
||||||
|
|
||||||
|
或者具体指名文件名
|
||||||
|
|
||||||
|
```js
|
||||||
|
window.$docsify = {
|
||||||
|
coverpage: {
|
||||||
|
'/': 'cover.md',
|
||||||
|
'/zh-cn/': 'cover.md'
|
||||||
|
}
|
||||||
|
};
|
||||||
|
```
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
我们可以直接在 HTML 里定义导航栏,要注意链接要以 `#/` 开头。
|
我们可以直接在 HTML 里定义导航栏,要注意链接要以 `#/` 开头。
|
||||||
|
|
||||||
*index.html*
|
_index.html_
|
||||||
|
|
||||||
```html
|
```html
|
||||||
<body>
|
<body>
|
||||||
@ -14,13 +14,11 @@
|
|||||||
</body>
|
</body>
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
## 配置文件
|
## 配置文件
|
||||||
|
|
||||||
那我们可以通过 Markdown 文件来配置导航。首先配置 `loadNavbar`,默认加载的文件为 `_navbar.md`。具体配置规则见[配置项#load-navbar](configuration.md#load-navbar)。
|
那我们可以通过 Markdown 文件来配置导航。首先配置 `loadNavbar`,默认加载的文件为 `_navbar.md`。具体配置规则见[配置项#loadNavbar](configuration.md#loadnavbar)。
|
||||||
|
|
||||||
*index.html*
|
|
||||||
|
|
||||||
|
_index.html_
|
||||||
|
|
||||||
```html
|
```html
|
||||||
<script>
|
<script>
|
||||||
@ -31,11 +29,11 @@
|
|||||||
<script src="//unpkg.com/docsify"></script>
|
<script src="//unpkg.com/docsify"></script>
|
||||||
```
|
```
|
||||||
|
|
||||||
*_navbar.md*
|
_\_navbar.md_
|
||||||
|
|
||||||
```markdown
|
```markdown
|
||||||
- [En](/)
|
* [En](/)
|
||||||
- [中文](/zh-cn/)
|
* [中文](/zh-cn/)
|
||||||
```
|
```
|
||||||
|
|
||||||
`_navbar.md` 加载逻辑和 `sidebar` 文件一致,从每层目录下获取。例如当前路由为 `/zh-cn/custom-navbar` 那么是从 `/zh-cn/_navbar.md` 获取导航栏。
|
`_navbar.md` 加载逻辑和 `sidebar` 文件一致,从每层目录下获取。例如当前路由为 `/zh-cn/custom-navbar` 那么是从 `/zh-cn/_navbar.md` 获取导航栏。
|
||||||
@ -44,24 +42,23 @@
|
|||||||
|
|
||||||
如果导航内容过多,可以写成嵌套的列表,会被渲染成下拉列表的形式。
|
如果导航内容过多,可以写成嵌套的列表,会被渲染成下拉列表的形式。
|
||||||
|
|
||||||
*_navbar.md*
|
_\_navbar.md_
|
||||||
|
|
||||||
|
|
||||||
```markdown
|
```markdown
|
||||||
- 基础
|
* 基础
|
||||||
- [快速开始](zh-cn/quickstart.md)
|
* [快速开始](zh-cn/quickstart.md)
|
||||||
- [多页文档](zh-cn/more-pages.md)
|
* [多页文档](zh-cn/more-pages.md)
|
||||||
- [定制导航栏](zh-cn/custom-navbar.md)
|
* [定制导航栏](zh-cn/custom-navbar.md)
|
||||||
- [封面](zh-cn/cover.md)
|
* [封面](zh-cn/cover.md)
|
||||||
|
|
||||||
- 配置
|
* 配置
|
||||||
- [配置项](zh-cn/configuration.md)
|
* [配置项](zh-cn/configuration.md)
|
||||||
- [主题](zh-cn/themes.md)
|
* [主题](zh-cn/themes.md)
|
||||||
- [使用插件](zh-cn/plugins.md)
|
* [使用插件](zh-cn/plugins.md)
|
||||||
- [Markdown 配置](zh-cn/markdown.md)
|
* [Markdown 配置](zh-cn/markdown.md)
|
||||||
- [代码高亮](zh-cn/language-highlight.md)
|
* [代码高亮](zh-cn/language-highlight.md)
|
||||||
```
|
```
|
||||||
|
|
||||||
效果图
|
效果图
|
||||||
|
|
||||||
![嵌套导航栏](_images/zh-cn/nested-navbar.png "嵌套导航栏")
|
![嵌套导航栏](_images/zh-cn/nested-navbar.png '嵌套导航栏')
|
||||||
|
@ -26,7 +26,7 @@ docs/zh-cn/guide.md => http://domain.com/zh-cn/guide
|
|||||||
|
|
||||||
默认情况下,侧边栏会根据当前文档的标题生成目录。也可以设置文档链接,通过 Markdown 文件生成,效果如当前的文档的侧边栏。
|
默认情况下,侧边栏会根据当前文档的标题生成目录。也可以设置文档链接,通过 Markdown 文件生成,效果如当前的文档的侧边栏。
|
||||||
|
|
||||||
首先配置 `loadSidebar` 选项,具体配置规则见[配置项#load-sidebar](configuration.md#load-sidebar)。
|
首先配置 `loadSidebar` 选项,具体配置规则见[配置项#loadSidebar](configuration.md#loadsidebar)。
|
||||||
|
|
||||||
```html
|
```html
|
||||||
<script>
|
<script>
|
||||||
@ -40,13 +40,12 @@ docs/zh-cn/guide.md => http://domain.com/zh-cn/guide
|
|||||||
接着创建 `_sidebar.md` 文件,内容如下
|
接着创建 `_sidebar.md` 文件,内容如下
|
||||||
|
|
||||||
```markdown
|
```markdown
|
||||||
- [首页](zh-cn/)
|
* [首页](zh-cn/)
|
||||||
- [指南](zh-cn/guide)
|
* [指南](zh-cn/guide)
|
||||||
```
|
```
|
||||||
|
|
||||||
!> 需要在文档根目录创建 `.nojekyll` 命名的空文件,阻止 GitHub Pages 忽略命名是下划线开头的文件。
|
!> 需要在文档根目录创建 `.nojekyll` 命名的空文件,阻止 GitHub Pages 忽略命名是下划线开头的文件。
|
||||||
|
|
||||||
|
|
||||||
`_sidebar.md` 的加载逻辑是从每层目录下获取文件,如果当前目录不存在该文件则回退到上一级目录。例如当前路径为 `/zh-cn/more-pages` 则从 `/zh-cn/_sidebar.md` 获取文件,如果不存在则从 `/_sidebar.md` 获取。
|
`_sidebar.md` 的加载逻辑是从每层目录下获取文件,如果当前目录不存在该文件则回退到上一级目录。例如当前路径为 `/zh-cn/more-pages` 则从 `/zh-cn/_sidebar.md` 获取文件,如果不存在则从 `/_sidebar.md` 获取。
|
||||||
|
|
||||||
当然你也可以配置 `alias` 避免不必要的回退过程。
|
当然你也可以配置 `alias` 避免不必要的回退过程。
|
||||||
@ -78,12 +77,13 @@ docs/zh-cn/guide.md => http://domain.com/zh-cn/guide
|
|||||||
|
|
||||||
## 忽略副标题
|
## 忽略副标题
|
||||||
|
|
||||||
当设置了 `subMaxLevel` 时,默认情况下每个标题都会自动添加到目录中。如果你想忽略特定的标题,可以给它添加 `{docsify-ignore}` 。
|
当设置了 `subMaxLevel` 时,默认情况下每个标题都会自动添加到目录中。如果你想忽略特定的标题,可以给它添加 `{docsify-ignore}` 。
|
||||||
|
|
||||||
```markdown
|
```markdown
|
||||||
# Getting Started
|
# Getting Started
|
||||||
|
|
||||||
## Header {docsify-ignore}
|
## Header {docsify-ignore}
|
||||||
|
|
||||||
该标题不会出现在侧边栏的目录中。
|
该标题不会出现在侧边栏的目录中。
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -93,8 +93,8 @@ docs/zh-cn/guide.md => http://domain.com/zh-cn/guide
|
|||||||
# Getting Started {docsify-ignore-all}
|
# Getting Started {docsify-ignore-all}
|
||||||
|
|
||||||
## Header
|
## Header
|
||||||
|
|
||||||
该标题不会出现在侧边栏的目录中。
|
该标题不会出现在侧边栏的目录中。
|
||||||
```
|
```
|
||||||
|
|
||||||
在使用时, `{docsify-ignore}` 和 `{docsify-ignore-all}` 都不会在页面上呈现。
|
在使用时, `{docsify-ignore}` 和 `{docsify-ignore-all}` 都不会在页面上呈现。
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user