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
* Type: `String`
* Default: `#app`
- Type: `String`
- Default: `#app`
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
* Type: `String`
* Default: `null`
- Type: `String`
- 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.
@ -42,8 +42,8 @@ window.$docsify = {
## maxLevel
* Type: `Number`
* Default: `6`
- Type: `Number`
- Default: `6`
Maximum Table of content level.
@ -55,8 +55,8 @@ window.$docsify = {
## loadNavbar
* Type: `Boolean|String`
* Default: `false`
- Type: `Boolean|String`
- Default: `false`
Loads navbar from the Markdown file `_navbar.md` if **true**, or else from the path specified.
@ -72,8 +72,8 @@ window.$docsify = {
## loadSidebar
* Type: `Boolean|String`
* Default: `false`
- Type: `Boolean|String`
- Default: `false`
Loads sidebar from the Markdown file `_sidebar.md` if **true**, or else from the path specified.
@ -89,8 +89,8 @@ window.$docsify = {
## subMaxLevel
* Type: `Number`
* Default: `0`
- Type: `Number`
- Default: `0`
Add table of contents (TOC) in custom sidebar.
@ -102,8 +102,8 @@ window.$docsify = {
## auto2top
* Type: `Boolean`
* Default: `false`
- Type: `Boolean`
- Default: `false`
Scrolls to the top of the screen when the route is changed.
@ -115,8 +115,8 @@ window.$docsify = {
## homepage
* Type: `String`
* Default: `README.md`
- Type: `String`
- 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.
@ -133,7 +133,7 @@ window.$docsify = {
## basePath
* Type: `String`
- Type: `String`
Base path of the website. You can set it to another directory or another domain name.
@ -152,8 +152,8 @@ window.$docsify = {
## coverpage
* Type: `Boolean|String|String[]|Object`
* Default: `false`
- Type: `Boolean|String|String[]|Object`
- Default: `false`
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
* Type: `String`
- Type: `String`
Website name as it appears in the sidebar.
@ -189,8 +201,8 @@ window.$docsify = {
## nameLink
* Type: `String`
* Default: `window.location.pathname`
- Type: `String`
- Default: `window.location.pathname`
The name of the link.
@ -208,7 +220,7 @@ window.$docsify = {
## markdown
* Type: `Function`
- Type: `Function`
See [Markdown configuration](markdown.md).
@ -234,7 +246,7 @@ window.$docsify = {
## 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.
@ -246,7 +258,7 @@ window.$docsify = {
## alias
* Type: `Object`
- Type: `Object`
Set the route alias. You can freely manage routing rules. Supports RegExp.
@ -264,7 +276,7 @@ window.$docsify = {
## 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).
@ -277,7 +289,7 @@ window.$docsify = {
## 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.
@ -299,7 +311,7 @@ Note that if you are running an external script, e.g. an embedded jsfiddle demo,
## noEmoji
* type: `Boolean`
- type: `Boolean`
Disabled emoji parse.
@ -311,7 +323,7 @@ window.$docsify = {
## mergeNavbar
* type: `Boolean`
- type: `Boolean`
Navbar will be merged with the sidebar on smaller screens.
@ -323,7 +335,7 @@ window.$docsify = {
## 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`.
See https://github.com/lukeed/tinydate#patterns
@ -342,8 +354,8 @@ window.$docsify = {
## externalLinkTarget
* type: `String`
* default: `_blank`
- type: `String`
- default: `_blank`
Target to open external links. Default `'_blank'` (new window/tab)
@ -355,8 +367,8 @@ window.$docsify = {
## routerMode
* type: `String`
* default: `history`
- type: `String`
- default: `history`
```js
window.$docsify = {
@ -366,7 +378,7 @@ window.$docsify = {
## 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)
@ -378,7 +390,7 @@ window.$docsify = {
## onlyCover
* type: `Boolean`
- type: `Boolean`
Only coverpage is loaded when visiting the home page.
@ -390,7 +402,7 @@ window.$docsify = {
## requestHeaders
* type: `Object`
- type: `Object`
Set the request resource headers.
@ -404,7 +416,7 @@ window.$docsify = {
## ext
* type: `String`
- type: `String`
Request file extension.
@ -416,32 +428,28 @@ window.$docsify = {
## 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.
Example:
- 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 display 404 page.
- 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 display 404 page.
```js
window.$docsify = {
fallbackLanguages: [
"fr",
"de"
]
fallbackLanguages: ['fr', 'de']
};
```
## notFoundPage
* type: `Boolean` | `String` | `Object`
- type: `Boolean` | `String` | `Object`
Load the `_404.md` file:
```js
window.$docsify = {
notFoundPage: true
@ -449,6 +457,7 @@ window.$docsify = {
```
Load the customised path of the 404 page:
```js
window.$docsify = {
notFoundPage: 'my404.md'
@ -456,13 +465,14 @@ window.$docsify = {
```
Load the right 404 page according to the localisation:
```js
window.$docsify = {
notFoundPage: {
'/': '_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.