feat: add logo option, #264 (#541)

This commit is contained in:
cinwell.li 2018-06-19 08:19:21 +08:00 • committed by GitHub
commit ee72dd05e5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 192 additions and 142 deletions

View file

@ -14,8 +14,8 @@ You can configure the `window.$docsify`.
## el ## el
* Type: `String` - Type: `String`
* Default: `#app` - Default: `#app`
The DOM element to be mounted on initialization. It can be a CSS selector string or an actual HTMLElement. The DOM element to be mounted on initialization. It can be a CSS selector string or an actual HTMLElement.
@ -27,8 +27,8 @@ window.$docsify = {
## repo ## repo
* Type: `String` - Type: `String`
* Default: `null` - Default: `null`
Configure the repository url or a string of `username/repo` can add the [GitHub Corner](http://tholman.com/github-corners/) widget in the top right corner of the site. Configure the repository url or a string of `username/repo` can add the [GitHub Corner](http://tholman.com/github-corners/) widget in the top right corner of the site.
@ -42,8 +42,8 @@ window.$docsify = {
## maxLevel ## maxLevel
* Type: `Number` - Type: `Number`
* Default: `6` - Default: `6`
Maximum Table of content level. Maximum Table of content level.
@ -55,8 +55,8 @@ window.$docsify = {
## loadNavbar ## loadNavbar
* Type: `Boolean|String` - Type: `Boolean|String`
* Default: `false` - Default: `false`
Loads navbar from the Markdown file `_navbar.md` if **true**, or else from the path specified. Loads navbar from the Markdown file `_navbar.md` if **true**, or else from the path specified.
@ -72,8 +72,8 @@ window.$docsify = {
## loadSidebar ## loadSidebar
* Type: `Boolean|String` - Type: `Boolean|String`
* Default: `false` - Default: `false`
Loads sidebar from the Markdown file `_sidebar.md` if **true**, or else from the path specified. Loads sidebar from the Markdown file `_sidebar.md` if **true**, or else from the path specified.
@ -89,8 +89,8 @@ window.$docsify = {
## subMaxLevel ## subMaxLevel
* Type: `Number` - Type: `Number`
* Default: `0` - Default: `0`
Add table of contents (TOC) in custom sidebar. Add table of contents (TOC) in custom sidebar.
@ -102,8 +102,8 @@ window.$docsify = {
## auto2top ## auto2top
* Type: `Boolean` - Type: `Boolean`
* Default: `false` - Default: `false`
Scrolls to the top of the screen when the route is changed. Scrolls to the top of the screen when the route is changed.
@ -115,8 +115,8 @@ window.$docsify = {
## homepage ## homepage
* Type: `String` - Type: `String`
* Default: `README.md` - Default: `README.md`
`README.md` in your docs folder will be treated as homepage for your website, but sometimes you may need to serve another file as your homepage. `README.md` in your docs folder will be treated as homepage for your website, but sometimes you may need to serve another file as your homepage.
@ -133,7 +133,7 @@ window.$docsify = {
## basePath ## basePath
* Type: `String` - Type: `String`
Base path of the website. You can set it to another directory or another domain name. Base path of the website. You can set it to another directory or another domain name.
@ -152,8 +152,8 @@ window.$docsify = {
## coverpage ## coverpage
* Type: `Boolean|String|String[]|Object` - 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`.
@ -175,9 +175,21 @@ window.$docsify = {
}; };
``` ```
## logo
- Type: `String`
Website logo as it appears in the sidebar, you can resize by CSS.
```js
window.$docsify = {
logo: '/_media/icon.svg'
};
```
## name ## name
* Type: `String` - Type: `String`
Website name as it appears in the sidebar. Website name as it appears in the sidebar.
@ -189,8 +201,8 @@ window.$docsify = {
## nameLink ## nameLink
* Type: `String` - Type: `String`
* Default: `window.location.pathname` - Default: `window.location.pathname`
The name of the link. The name of the link.
@ -208,7 +220,7 @@ window.$docsify = {
## markdown ## markdown
* Type: `Function` - Type: `Function`
See [Markdown configuration](markdown.md). See [Markdown configuration](markdown.md).
@ -234,7 +246,7 @@ window.$docsify = {
## themeColor ## themeColor
* Type: `String` - Type: `String`
Customize the theme color. Use [CSS3 variables](https://developer.mozilla.org/en-US/docs/Web/CSS/Using_CSS_variables) feature and polyfill in old browser. Customize the theme color. Use [CSS3 variables](https://developer.mozilla.org/en-US/docs/Web/CSS/Using_CSS_variables) feature and polyfill in old browser.
@ -246,7 +258,7 @@ window.$docsify = {
## alias ## alias
* Type: `Object` - Type: `Object`
Set the route alias. You can freely manage routing rules. Supports RegExp. Set the route alias. You can freely manage routing rules. Supports RegExp.
@ -264,7 +276,7 @@ window.$docsify = {
## autoHeader ## autoHeader
* type: `Boolean` - type: `Boolean`
If `loadSidebar` and `autoHeader` are both enabled, for each link in `_sidebar.md`, prepend a header to the page before converting it to html. Compare [#78](https://github.com/QingWei-Li/docsify/issues/78). If `loadSidebar` and `autoHeader` are both enabled, for each link in `_sidebar.md`, prepend a header to the page before converting it to html. Compare [#78](https://github.com/QingWei-Li/docsify/issues/78).
@ -277,7 +289,7 @@ window.$docsify = {
## executeScript ## executeScript
* type: `Boolean` - type: `Boolean`
Execute the script on the page. Only parse the first script tag([demo](themes)). If Vue is present, it is turned on by default. Execute the script on the page. Only parse the first script tag([demo](themes)). If Vue is present, it is turned on by default.
@ -299,7 +311,7 @@ Note that if you are running an external script, e.g. an embedded jsfiddle demo,
## noEmoji ## noEmoji
* type: `Boolean` - type: `Boolean`
Disabled emoji parse. Disabled emoji parse.
@ -311,7 +323,7 @@ window.$docsify = {
## mergeNavbar ## mergeNavbar
* type: `Boolean` - type: `Boolean`
Navbar will be merged with the sidebar on smaller screens. Navbar will be merged with the sidebar on smaller screens.
@ -323,7 +335,7 @@ window.$docsify = {
## formatUpdated ## formatUpdated
* type: `String|Function` - type: `String|Function`
We can display the file update date through **{docsify-updated<span>}</span>** variable. And format it by `formatUpdated`. 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 See https://github.com/lukeed/tinydate#patterns
@ -342,8 +354,8 @@ window.$docsify = {
## externalLinkTarget ## externalLinkTarget
* type: `String` - type: `String`
* default: `_blank` - default: `_blank`
Target to open external links. Default `'_blank'` (new window/tab) Target to open external links. Default `'_blank'` (new window/tab)
@ -355,8 +367,8 @@ window.$docsify = {
## routerMode ## routerMode
* type: `String` - type: `String`
* default: `history` - default: `history`
```js ```js
window.$docsify = { window.$docsify = {
@ -366,7 +378,7 @@ window.$docsify = {
## noCompileLinks ## noCompileLinks
* type: `Array` - type: `Array`
Sometimes we do not want docsify to handle our links. See [#203](https://github.com/QingWei-Li/docsify/issues/203) Sometimes we do not want docsify to handle our links. See [#203](https://github.com/QingWei-Li/docsify/issues/203)
@ -378,7 +390,7 @@ window.$docsify = {
## onlyCover ## onlyCover
* type: `Boolean` - type: `Boolean`
Only coverpage is loaded when visiting the home page. Only coverpage is loaded when visiting the home page.
@ -390,7 +402,7 @@ window.$docsify = {
## requestHeaders ## requestHeaders
* type: `Object` - type: `Object`
Set the request resource headers. Set the request resource headers.
@ -404,7 +416,7 @@ window.$docsify = {
## ext ## ext
* type: `String` - type: `String`
Request file extension. Request file extension.
@ -416,32 +428,28 @@ window.$docsify = {
## fallbackLanguages ## fallbackLanguages
* type: `Array<string>` - type: `Array<string>`
List of languages that will fallback to the default language when a page is request and didn't exists for the given local. List of languages that will fallback to the default language when a page is request and didn't exists for the given local.
Example: Example:
- try to fetch the page of `/de/overview`. If this page exists, it'll be displayed - try to fetch the page of `/de/overview`. If this page exists, it'll be displayed
- then try to fetch the default page `/overview` (depending on the default language). If this page exists, it'll be displayed - then try to fetch the default page `/overview` (depending on the default language). If this page exists, it'll be displayed
- then display 404 page. - then display 404 page.
```js ```js
window.$docsify = { window.$docsify = {
fallbackLanguages: [ fallbackLanguages: ['fr', 'de']
"fr",
"de"
]
}; };
``` ```
## notFoundPage ## notFoundPage
* type: `Boolean` | `String` | `Object` - type: `Boolean` | `String` | `Object`
Load the `_404.md` file: Load the `_404.md` file:
```js ```js
window.$docsify = { window.$docsify = {
notFoundPage: true notFoundPage: true
@ -449,6 +457,7 @@ window.$docsify = {
``` ```
Load the customised path of the 404 page: Load the customised path of the 404 page:
```js ```js
window.$docsify = { window.$docsify = {
notFoundPage: 'my404.md' notFoundPage: 'my404.md'
@ -456,13 +465,14 @@ window.$docsify = {
``` ```
Load the right 404 page according to the localisation: Load the right 404 page according to the localisation:
```js ```js
window.$docsify = { window.$docsify = {
notFoundPage: { notFoundPage: {
'/': '_404.md', '/': '_404.md',
'/de': 'de/_404.md', '/de': 'de/_404.md'
} }
}; };
``` ```
> Note: The options with fallbackLanguages didn't work with the `notFoundPage` options.
> Note: The options with fallbackLanguages didn't work with the `notFoundPage` options.

View file

@ -14,8 +14,8 @@ You can configure the `window.$docsify`.
## el ## el
* Typ: `String` - Typ: `String`
* Standard: `#app` - Standard: `#app`
Das DOM Element kann bei der Initialisierung gesetzt werden. Es kann ein CSS selector string oder ein richtiges HTMLElement sein. Das DOM Element kann bei der Initialisierung gesetzt werden. Es kann ein CSS selector string oder ein richtiges HTMLElement sein.
@ -27,8 +27,8 @@ window.$docsify = {
## repo ## repo
* Typ: `String` - Typ: `String`
* Standard: `null` - 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. 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.
@ -42,8 +42,8 @@ window.$docsify = {
## maxLevel ## maxLevel
* Typ: `Number` - Typ: `Number`
* Standard: `6` - Standard: `6`
Maximale Anzahl der Inhaltsübersichtebenen. Maximale Anzahl der Inhaltsübersichtebenen.
@ -55,8 +55,8 @@ window.$docsify = {
## loadNavbar ## loadNavbar
* Typ: `Boolean|String` - Typ: `Boolean|String`
* Standard: `false` - Standard: `false`
Lädt die Navigationsleiste von der Markdown Datei `_navbar.md` falls **true**, oder vom gewählten Pfad. Lädt die Navigationsleiste von der Markdown Datei `_navbar.md` falls **true**, oder vom gewählten Pfad.
@ -72,8 +72,8 @@ window.$docsify = {
## loadSidebar ## loadSidebar
* Typ: `Boolean|String` - Typ: `Boolean|String`
* Standard: `false` - Standard: `false`
Lädt das seitliche Inhaltsverzeichnis von der Markdown Datei `_sidebar.md` falls **true**, oder vom gewählten Pfad. Lädt das seitliche Inhaltsverzeichnis von der Markdown Datei `_sidebar.md` falls **true**, oder vom gewählten Pfad.
@ -89,8 +89,8 @@ window.$docsify = {
## subMaxLevel ## subMaxLevel
* Typ: `Number` - Typ: `Number`
* Standard: `0` - Standard: `0`
Wähle die maximale Anzahl der Unterpunkte pro Datei in der Inhaltsübersicht. Wähle die maximale Anzahl der Unterpunkte pro Datei in der Inhaltsübersicht.
@ -102,8 +102,8 @@ window.$docsify = {
## auto2top ## auto2top
* Typ: `Boolean` - Typ: `Boolean`
* Standard: `false` - Standard: `false`
Scrolle zum Anfang der Seite, wenn die Route gewechselt wird. Scrolle zum Anfang der Seite, wenn die Route gewechselt wird.
@ -115,8 +115,8 @@ window.$docsify = {
## homepage ## homepage
* Typ: `String` - Typ: `String`
* Standard: `README.md` - 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. `README.md` in deinem Ordner für die Dokumentation wird als Startseite für deine Webseite gesetzt, aber manchmal musst du das vielleicht ändern.
@ -133,7 +133,7 @@ window.$docsify = {
## basePath ## basePath
* Typ: `String` - Typ: `String`
Der Basispfad der Webseite. Du kannst einen anderen Ordner wählen, oder eine andere Domain. Der Basispfad der Webseite. Du kannst einen anderen Ordner wählen, oder eine andere Domain.
@ -152,8 +152,8 @@ window.$docsify = {
## coverpage ## coverpage
* Typ: `Boolean|String` - Typ: `Boolean|String`
* Standard: `false` - Standard: `false`
Aktiviere das [Titelseitenfeature](de-de/cover.md). Falls `true`, wird sie von `_coverpage.md` geladen. Aktiviere das [Titelseitenfeature](de-de/cover.md). Falls `true`, wird sie von `_coverpage.md` geladen.
@ -175,9 +175,21 @@ window.$docsify = {
}; };
``` ```
## logo
- Type: `String`
Website logo as it appears in the sidebar, you can resize by CSS.
```js
window.$docsify = {
logo: '/_media/icon.svg'
};
```
## name ## name
* Typ: `String` - Typ: `String`
Webseitenname, wie er in der Inhaltsübersicht in der Seitenleiste angezeigt wird. Webseitenname, wie er in der Inhaltsübersicht in der Seitenleiste angezeigt wird.
@ -189,8 +201,8 @@ window.$docsify = {
## nameLink ## nameLink
* Typ: `String` - Typ: `String`
* Standard: `window.location.pathname` - Standard: `window.location.pathname`
Der Name der Links. Der Name der Links.
@ -208,7 +220,7 @@ window.$docsify = {
## markdown ## markdown
* Typ: `Function` - Typ: `Function`
Siehe [Markdown Konfiguration](de-de/markdown.md). Siehe [Markdown Konfiguration](de-de/markdown.md).
@ -234,7 +246,7 @@ window.$docsify = {
## themeColor ## themeColor
* Typ: `String` - 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. 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.
@ -246,7 +258,7 @@ window.$docsify = {
## alias ## alias
* Typ: `Object` - Typ: `Object`
Verwende alternative Routen. Du kannst sie ungehindert anpassen. Supports RegExp. Verwende alternative Routen. Du kannst sie ungehindert anpassen. Supports RegExp.
@ -264,7 +276,7 @@ window.$docsify = {
## autoHeader ## autoHeader
* Typ: `Boolean` - 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). 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).
@ -277,7 +289,7 @@ window.$docsify = {
## executeScript ## executeScript
* Typ: `Boolean` - 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. 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.
@ -299,7 +311,7 @@ window.$docsify = {
## noEmoji ## noEmoji
* type: `Boolean` - type: `Boolean`
Verhindere die Umwandlung in Emojis: Verhindere die Umwandlung in Emojis:
@ -311,7 +323,7 @@ window.$docsify = {
## mergeNavbar ## mergeNavbar
* type: `Boolean` - type: `Boolean`
Navbar will be merged with the sidebar on smaller screens. Navbar will be merged with the sidebar on smaller screens.
@ -323,7 +335,7 @@ window.$docsify = {
## formatUpdated ## formatUpdated
* type: `String|Function` - type: `String|Function`
We can display the file update date through **{docsify-updated<span>}</span>** variable. And format it by `formatUpdated`. 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 See https://github.com/lukeed/tinydate#patterns
@ -342,8 +354,8 @@ window.$docsify = {
## externalLinkTarget ## externalLinkTarget
* type: `String` - type: `String`
* default: `_blank` - default: `_blank`
Currently it defaults to \_blank, would be nice if configurable: Currently it defaults to \_blank, would be nice if configurable:
@ -355,8 +367,8 @@ window.$docsify = {
## routerMode ## routerMode
* type: `String` - type: `String`
* default: `history` - default: `history`
```js ```js
window.$docsify = { window.$docsify = {
@ -366,7 +378,7 @@ window.$docsify = {
## noCompileLinks ## noCompileLinks
* type: `Array` - type: `Array`
Sometimes we do not want docsify to handle our links. See [#203](https://github.com/QingWei-Li/docsify/issues/203) Sometimes we do not want docsify to handle our links. See [#203](https://github.com/QingWei-Li/docsify/issues/203)
@ -378,7 +390,7 @@ window.$docsify = {
## requestHeaders ## requestHeaders
* type: `Object` - type: `Object`
Set the request resource headers. Set the request resource headers.
@ -392,7 +404,7 @@ window.$docsify = {
## ext ## ext
* type: `String` - type: `String`
Request file extension. Request file extension.
@ -404,15 +416,15 @@ window.$docsify = {
## fallbackLanguages ## fallbackLanguages
* type: `Array<string>` - type: `Array<string>`
List of languages that will fallback to the default language when a page is request and didn't exists for the given local. List of languages that will fallback to the default language when a page is request and didn't exists for the given local.
Example: Example:
* try to fetch the page of `/de/overview`. If this page exists, it'll be displayed - try to fetch the page of `/de/overview`. If this page exists, it'll be displayed
* then try to fetch the default page `/overview` (depending on the default language). If this page exists, it'll be displayed - then try to fetch the default page `/overview` (depending on the default language). If this page exists, it'll be displayed
* then display 404 page. - then display 404 page.
```js ```js
window.$docsify = { window.$docsify = {
@ -422,9 +434,10 @@ window.$docsify = {
## notFoundPage ## notFoundPage
* type: `Boolean` | `String` | `Object` - type: `Boolean` | `String` | `Object`
Load the `_404.md` file: Load the `_404.md` file:
```js ```js
window.$docsify = { window.$docsify = {
notFoundPage: true notFoundPage: true
@ -432,6 +445,7 @@ window.$docsify = {
``` ```
Load the customised path of the 404 page: Load the customised path of the 404 page:
```js ```js
window.$docsify = { window.$docsify = {
notFoundPage: 'my404.md' notFoundPage: 'my404.md'
@ -439,12 +453,14 @@ window.$docsify = {
``` ```
Load the right 404 page according to the localisation: Load the right 404 page according to the localisation:
```js ```js
window.$docsify = { window.$docsify = {
notFoundPage: { notFoundPage: {
'/': '_404.md', '/': '_404.md',
'/de': 'de/_404.md', '/de': 'de/_404.md'
} }
}; };
``` ```
> Note: The options with fallbackLanguages didn't work with the `notFoundPage` options. > Note: The options with fallbackLanguages didn't work with the `notFoundPage` options.

View file

@ -14,8 +14,8 @@
## el ## el
* 类型:`String` - 类型:`String`
* 默认值:`#app` - 默认值:`#app`
docsify 初始化的挂载元素,可以是一个 CSS 选择器,默认为 `#app` 如果不存在就直接绑定在 `body` 上。 docsify 初始化的挂载元素,可以是一个 CSS 选择器,默认为 `#app` 如果不存在就直接绑定在 `body` 上。
@ -27,8 +27,8 @@ window.$docsify = {
## repo ## repo
* 类型:`String` - 类型:`String`
* 默认值: `null` - 默认值: `null`
配置仓库地址或者 `username/repo` 的字符串,会在页面右上角渲染一个 [GitHub Corner](http://tholman.com/github-corners/) 挂件。 配置仓库地址或者 `username/repo` 的字符串,会在页面右上角渲染一个 [GitHub Corner](http://tholman.com/github-corners/) 挂件。
@ -42,8 +42,8 @@ window.$docsify = {
## maxLevel ## maxLevel
* 类型:`Number` - 类型:`Number`
* 默认值: `6` - 默认值: `6`
默认情况下会抓取文档中所有标题渲染成目录,可配置最大支持渲染的标题层级。 默认情况下会抓取文档中所有标题渲染成目录,可配置最大支持渲染的标题层级。
@ -55,8 +55,8 @@ window.$docsify = {
## loadNavbar ## loadNavbar
* 类型:`Boolean|String` - 类型:`Boolean|String`
* 默认值: `false` - 默认值: `false`
加载自定义导航栏,参考[定制导航栏](zh-cn/custom-navbar.md) 了解用法。设置为 `true` 后会加载 `_navbar.md` 文件,也可以自定义加载的文件名。 加载自定义导航栏,参考[定制导航栏](zh-cn/custom-navbar.md) 了解用法。设置为 `true` 后会加载 `_navbar.md` 文件,也可以自定义加载的文件名。
@ -72,8 +72,8 @@ window.$docsify = {
## loadSidebar ## loadSidebar
* 类型:`Boolean|String` - 类型:`Boolean|String`
* 默认值: `false` - 默认值: `false`
加载自定义侧边栏,参考[多页文档](zh-cn/more-pages.md)。设置为 `true` 后会加载 `_sidebar.md` 文件,也可以自定义加载的文件名。 加载自定义侧边栏,参考[多页文档](zh-cn/more-pages.md)。设置为 `true` 后会加载 `_sidebar.md` 文件,也可以自定义加载的文件名。
@ -89,8 +89,8 @@ window.$docsify = {
## subMaxLevel ## subMaxLevel
* 类型:`Number` - 类型:`Number`
* 默认值: `0` - 默认值: `0`
自定义侧边栏后默认不会再生成目录,你也可以通过设置生成目录的最大层级开启这个功能。 自定义侧边栏后默认不会再生成目录,你也可以通过设置生成目录的最大层级开启这个功能。
@ -102,8 +102,8 @@ window.$docsify = {
## auto2top ## auto2top
* 类型:`Boolean` - 类型:`Boolean`
* 默认值: `false` - 默认值: `false`
切换页面后是否自动跳转到页面顶部。 切换页面后是否自动跳转到页面顶部。
@ -115,8 +115,8 @@ window.$docsify = {
## homepage ## homepage
* 类型:`String` - 类型:`String`
* 默认值: `README.md` - 默认值: `README.md`
设置首页文件加载路径。适合不想将 `README.md` 作为入口文件渲染,或者是文档存放在其他位置的情况使用。 设置首页文件加载路径。适合不想将 `README.md` 作为入口文件渲染,或者是文档存放在其他位置的情况使用。
@ -133,7 +133,7 @@ window.$docsify = {
## basePath ## basePath
* 类型:`String` - 类型:`String`
文档加载的根路径,可以是二级路径或者是其他域名的路径。 文档加载的根路径,可以是二级路径或者是其他域名的路径。
@ -152,8 +152,8 @@ window.$docsify = {
## coverpage ## coverpage
* 类型:`Boolean|String` - 类型:`Boolean|String`
* 默认值: `false` - 默认值: `false`
启用[封面页](zh-cn/cover.md)。开启后是加载 `_coverpage.md` 文件,也可以自定义文件名。 启用[封面页](zh-cn/cover.md)。开启后是加载 `_coverpage.md` 文件,也可以自定义文件名。
@ -175,9 +175,21 @@ window.$docsify = {
}; };
``` ```
## logo
- Type: `String`
Website logo as it appears in the sidebar, you can resize by CSS.
```js
window.$docsify = {
logo: '/_media/icon.svg'
};
```
## name ## name
* 类型:`String` - 类型:`String`
文档标题,会显示在侧边栏顶部。 文档标题,会显示在侧边栏顶部。
@ -189,8 +201,8 @@ window.$docsify = {
## nameLink ## nameLink
* 类型:`String` - 类型:`String`
* 默认值:`window.location.pathname` - 默认值:`window.location.pathname`
点击文档标题后跳转的链接地址。 点击文档标题后跳转的链接地址。
@ -208,7 +220,7 @@ window.$docsify = {
## markdown ## markdown
* 类型: `Object|Function` - 类型: `Object|Function`
参考 [Markdown 配置](zh-cn/markdown.md)。 参考 [Markdown 配置](zh-cn/markdown.md)。
@ -234,7 +246,7 @@ window.$docsify = {
## themeColor ## themeColor
* 类型:`String` - 类型:`String`
替换主题色。利用 [CSS3 支持变量](https://developer.mozilla.org/en-US/docs/Web/CSS/Using_CSS_variables)的特性,对于老的浏览器有 polyfill 处理。 替换主题色。利用 [CSS3 支持变量](https://developer.mozilla.org/en-US/docs/Web/CSS/Using_CSS_variables)的特性,对于老的浏览器有 polyfill 处理。
@ -246,7 +258,7 @@ window.$docsify = {
## alias ## alias
* 类型:`Object` - 类型:`Object`
定义路由别名,可以更自由的定义路由规则。 支持正则。 定义路由别名,可以更自由的定义路由规则。 支持正则。
@ -264,7 +276,7 @@ window.$docsify = {
## autoHeader ## autoHeader
* 类型:`Boolean` - 类型:`Boolean`
同时设置 `loadSidebar` 和 `autoHeader` 后,可以根据 `_sidebar.md` 的内容自动为每个页面增加标题。[#78](https://github.com/QingWei-Li/docsify/issues/78) 同时设置 `loadSidebar` 和 `autoHeader` 后,可以根据 `_sidebar.md` 的内容自动为每个页面增加标题。[#78](https://github.com/QingWei-Li/docsify/issues/78)
@ -277,7 +289,7 @@ window.$docsify = {
## executeScript ## executeScript
* 类型:`Boolean` - 类型:`Boolean`
执行文档里的 script 标签里的脚本,只执行第一个 script ([demo](zh-cn/themes.md))。 如果 Vue 存在,则自动开启。 执行文档里的 script 标签里的脚本,只执行第一个 script ([demo](zh-cn/themes.md))。 如果 Vue 存在,则自动开启。
@ -299,7 +311,7 @@ window.$docsify = {
## noEmoji ## noEmoji
* type: `Boolean` - type: `Boolean`
禁用 emoji 解析。 禁用 emoji 解析。
@ -311,7 +323,7 @@ window.$docsify = {
## mergeNavbar ## mergeNavbar
* type: `Boolean` - type: `Boolean`
小屏设备下合并导航栏到侧边栏。 小屏设备下合并导航栏到侧边栏。
@ -323,7 +335,7 @@ window.$docsify = {
## formatUpdated ## formatUpdated
* type: `String|Function` - type: `String|Function`
我们可以显示文档更新日期通过 **{docsify-updated<span>}</span>** 变量. 并且格式化日期通过 `formatUpdated`。参考 https://github.com/lukeed/tinydate#patterns 我们可以显示文档更新日期通过 **{docsify-updated<span>}</span>** 变量. 并且格式化日期通过 `formatUpdated`。参考 https://github.com/lukeed/tinydate#patterns
@ -341,8 +353,8 @@ window.$docsify = {
## externalLinkTarget ## externalLinkTarget
* type: `String` - type: `String`
* default: `_blank` - default: `_blank`
当前默认为 \_blank, 配置一下就可以: 当前默认为 \_blank, 配置一下就可以:
@ -354,8 +366,8 @@ window.$docsify = {
## routerMode ## routerMode
* type: `String` - type: `String`
* default: `history` - default: `history`
```js ```js
window.$docsify = { window.$docsify = {
@ -365,7 +377,7 @@ window.$docsify = {
## noCompileLinks ## noCompileLinks
* 类型: `Array` - 类型: `Array`
有时我们不希望 docsify 处理我们的链接。 参考 [#203](https://github.com/QingWei-Li/docsify/issues/203) 有时我们不希望 docsify 处理我们的链接。 参考 [#203](https://github.com/QingWei-Li/docsify/issues/203)
@ -377,7 +389,7 @@ window.$docsify = {
## requestHeaders ## requestHeaders
* type: `Object` - type: `Object`
设置请求资源的请求头。 设置请求资源的请求头。
@ -391,7 +403,7 @@ window.$docsify = {
## ext ## ext
* type: `String` - type: `String`
资源的文件扩展名。 资源的文件扩展名。
@ -403,15 +415,15 @@ window.$docsify = {
## fallbackLanguages ## fallbackLanguages
* type: `Array<string>` - type: `Array<string>`
List of languages that will fallback to the default language when a page is request and didn't exists for the given local. List of languages that will fallback to the default language when a page is request and didn't exists for the given local.
Example: Example:
* try to fetch the page of `/de/overview`. If this page exists, it'll be displayed - try to fetch the page of `/de/overview`. If this page exists, it'll be displayed
* then try to fetch the default page `/overview` (depending on the default language). If this page exists, it'll be displayed - then try to fetch the default page `/overview` (depending on the default language). If this page exists, it'll be displayed
* then display 404 page. - then display 404 page.
```js ```js
window.$docsify = { window.$docsify = {
@ -421,9 +433,10 @@ window.$docsify = {
## notFoundPage ## notFoundPage
* type: `Boolean` | `String` | `Object` - type: `Boolean` | `String` | `Object`
Load the `_404.md` file: Load the `_404.md` file:
```js ```js
window.$docsify = { window.$docsify = {
notFoundPage: true notFoundPage: true
@ -431,6 +444,7 @@ window.$docsify = {
``` ```
Load the customised path of the 404 page: Load the customised path of the 404 page:
```js ```js
window.$docsify = { window.$docsify = {
notFoundPage: 'my404.md' notFoundPage: 'my404.md'
@ -438,14 +452,14 @@ window.$docsify = {
``` ```
Load the right 404 page according to the localisation: Load the right 404 page according to the localisation:
```js ```js
window.$docsify = { window.$docsify = {
notFoundPage: { notFoundPage: {
'/': '_404.md', '/': '_404.md',
'/de': 'de/_404.md', '/de': 'de/_404.md'
} }
}; };
``` ```
> Note: The options with fallbackLanguages didn't work with the `notFoundPage` options. > Note: The options with fallbackLanguages didn't work with the `notFoundPage` options.

View file

@ -204,7 +204,7 @@ export class Compiler {
title = str title = str
if ( if (
!/:|(\/{2})/.test(href) && !isAbsolutePath(href) &&
!_self._matchNotCompileLink(href) && !_self._matchNotCompileLink(href) &&
!config.ignore !config.ignore
) { ) {

View file

@ -32,7 +32,9 @@ function formatUpdated(html, updated, fn) {
updated = updated =
typeof fn === 'function' ? typeof fn === 'function' ?
fn(updated) : fn(updated) :
typeof fn === 'string' ? tinydate(fn)(new Date(updated)) : updated typeof fn === 'string' ?
tinydate(fn)(new Date(updated)) :
updated
return html.replace(/{docsify-updated}/g, updated) return html.replace(/{docsify-updated}/g, updated)
} }
@ -229,6 +231,10 @@ export function initRender(vm) {
html += tpl.cover() html += tpl.cover()
} }
if (config.logo) {
config.logo = getPath(vm.router.getBasePath(), config.logo)
}
html += tpl.main(config) html += tpl.main(config)
// Render main app // Render main app
vm._renderTo(el, html, true) vm._renderTo(el, html, true)

View file

@ -36,7 +36,11 @@ export function main(config) {
'</button>' + '</button>' +
'<aside class="sidebar">' + '<aside class="sidebar">' +
(config.name ? (config.name ?
`<h1><a class="app-name-link" data-nosearch>${config.name}</a></h1>` : `<h1><a class="app-name-link" data-nosearch>${
config.logo ?
`<img alt=${config.name} src=${config.logo}>` :
config.name
}</a></h1>` :
'') + '') +
'<div class="sidebar-nav"><!--sidebar--></div>' + '<div class="sidebar-nav"><!--sidebar--></div>' +
'</aside>' '</aside>'