-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs(zh-cn): finish chinese documents
- Loading branch information
1 parent
f89d43e
commit 772972c
Showing
16 changed files
with
316 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,244 @@ | ||
# 配置项 | ||
|
||
> TODO | ||
docsify 有两种配置参数的方式。一种是配置 `window.$docsify` 对象,另一种是给 `script` 标签添加 `data-*` 属性。 | ||
|
||
```html | ||
<!-- 方法 1 --> | ||
<script> | ||
window.$docsify = { | ||
repo: 'QingWei-Li/docsify', | ||
maxLevel: 3, | ||
coverpage: true | ||
} | ||
</script> | ||
|
||
<!-- 方法 2 --> | ||
<script | ||
src="//unpkg.com/docsify" | ||
data-repo="QingWei-Li/docsify" | ||
data-max-level="3" | ||
data-coverpage> | ||
</script> | ||
``` | ||
|
||
两种方式可以共存,推荐第一种做法——直接配置 `window.$docsify` 对象——这会让你的配置更加清晰,同时也可以方便的将配置单独写到另一个文件里。 | ||
|
||
!> 通过 `window.$docsify` 配置属性,需要将属性改成驼峰命名法。通过 `data-*` 属性配置,保持短横线的命名规则。 | ||
|
||
|
||
## el | ||
|
||
- 类型:`String` | ||
- 默认值:`#app` | ||
|
||
docsify 初始化的挂载元素,可以是一个 CSS 选择器,默认为 `#app` 如果不存在就直接绑定在 `body` 上。 | ||
|
||
```js | ||
window.$docsify = { | ||
el: '#app' | ||
} | ||
``` | ||
|
||
## repo | ||
|
||
- 类型:`String` | ||
- 默认值: `null` | ||
|
||
配置仓库地址或者 `username/repo` 的字符串,会在页面右上角渲染一个 [GitHub Corner](http://tholman.com/github-corners/) 挂件。 | ||
|
||
```js | ||
window.$docsify = { | ||
repo: 'QingWei-Li/docsify', | ||
// or | ||
repo: 'https://github.com/QingWei-Li/docsify/' | ||
} | ||
``` | ||
|
||
|
||
## max-level | ||
|
||
- 类型:`Number` | ||
- 默认值: `6` | ||
|
||
默认情况下会抓取文档中所有标题渲染成目录,可配置最大支持渲染的标题层级。 | ||
|
||
|
||
```js | ||
window.$docsify = { | ||
maxLevel: 4 | ||
} | ||
``` | ||
|
||
## load-navbar | ||
|
||
- 类型:`Boolean|String` | ||
- 默认值: `false` | ||
|
||
加载自定义导航栏,参考[定制导航栏](zh-cn/custom-navbar) 了解用法。设置为 `true` 后会加载 `_navbar.md` 文件,也可以自定义加载的文件名。 | ||
|
||
```js | ||
window.$docsify = { | ||
// 加载 _navbar.md | ||
loadNavbar: true, | ||
|
||
// 加载 nav.md | ||
loadNavbar: 'nav.md' | ||
} | ||
``` | ||
|
||
## load-sidebar | ||
|
||
- 类型:`Boolean|String` | ||
- 默认值: `false` | ||
|
||
加载自定义侧边栏,参考[多页文档](zh-cn/more-pages)。设置为 `true` 后会加载 `_sidebar.md` 文件,也可以自定义加载的文件名。 | ||
|
||
```js | ||
window.$docsify = { | ||
// 加载 _sidebar.md | ||
loadSidebar: true, | ||
|
||
// 加载 summary.md | ||
loadSidebar: 'summary.md' | ||
} | ||
``` | ||
|
||
## sub-max-level | ||
|
||
- 类型:`Number` | ||
- 默认值: `0` | ||
|
||
自定义侧边栏后默认不会再生成目录,你也可以通过设置生成目录的最大层级开启这个功能, | ||
|
||
|
||
```js | ||
window.$docsify = { | ||
subMaxLevel: 3 | ||
} | ||
``` | ||
|
||
## load-navbar | ||
|
||
## auto2top | ||
|
||
- 类型:`Boolean` | ||
- 默认值: `false` | ||
|
||
切换页面后是否自动跳转到页面顶部。 | ||
|
||
```js | ||
window.$docsify = { | ||
auto2top: true | ||
} | ||
``` | ||
|
||
|
||
## homepage | ||
|
||
- 类型:`String` | ||
- 默认值: `README.md` | ||
|
||
设置首页文件加载路径。适合不想将 `README.md` 作为入口文件渲染,或者是文档在仓库根目录的情况使用。 | ||
|
||
```js | ||
window.$docsify = { | ||
// 入口文件改为 /home.md | ||
homepage: 'home.md', | ||
|
||
// 文档和仓库根目录下的 README.md 内容一致 | ||
homepage: 'https://raw.githubusercontent.com/QingWei-Li/docsify/master/README.md' | ||
} | ||
``` | ||
|
||
## base-path | ||
|
||
- 类型:`String` | ||
|
||
文档加载的根路径,可以是二级路径或者是其他域名的路径。 | ||
|
||
```js | ||
window.$docsify = { | ||
basePath: '/path/', | ||
|
||
// 直接渲染其他域名的文档 | ||
basePath: 'https://docsify.js.org/', | ||
|
||
// 甚至直接渲染其他仓库下的内容 | ||
basePath: 'https://raw.githubusercontent.com/ryanmcdermott/clean-code-javascript/master/' | ||
} | ||
``` | ||
|
||
|
||
## coverpage | ||
|
||
- 类型:`Boolean|String` | ||
- 默认值: `false` | ||
|
||
启用[封面页](/zh-cn/cover)。开启后是加载 `_coverpage.md` 文件,也可以自定义文件名。 | ||
|
||
```js | ||
window.$docsify = { | ||
coverpage: true, | ||
|
||
// 自定义文件名 | ||
coverpage: 'cover.md' | ||
} | ||
``` | ||
|
||
## name | ||
|
||
- 类型:`String` | ||
|
||
|
||
文档标题,会显示在侧边栏顶部。 | ||
|
||
```js | ||
window.$docsify = { | ||
name: 'docsify' | ||
} | ||
``` | ||
|
||
## name-link | ||
|
||
- 类型:`String` | ||
- 默认值:`window.location.pathname` | ||
|
||
点击文档标题后跳转的链接地址。 | ||
|
||
```js | ||
window.$docsify = { | ||
nameLink: '/' | ||
} | ||
``` | ||
|
||
## markdown | ||
|
||
- 类型: `Function` | ||
|
||
参考 [Markdown 配置](/zh-cn/markdown)。 | ||
|
||
## theme-color | ||
|
||
- 类型:`String` | ||
|
||
替换默认的主题配置。利用 CSS3 支持变量的特性,对于老的浏览器有 polyfill 处理。 | ||
|
||
```js | ||
window.$docsify = { | ||
themeColor: '#3F51B5' | ||
} | ||
``` | ||
|
||
## alias | ||
|
||
定义路由别名,可以更自由的定义路由规则。 | ||
|
||
|
||
```js | ||
window.$docsify = { | ||
alias: { | ||
'/zh-cn/changelog': '/changelog', | ||
'/changelog': 'https://raw.githubusercontent.com/QingWei-Li/docsify/master/CHANGELOG' | ||
} | ||
} | ||
``` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,55 @@ | ||
# 封面 | ||
|
||
> TODO | ||
一个有封面的文档网站会给用户留下好的印象,通过设置 `coverpage` 参数,可以开启渲染封面的功能。具体用法见见[配置项#coverpage](zh-cn/configuration#coverpage)。 | ||
|
||
## 基本用法 | ||
|
||
封面的生成同样是从 markdown 文件渲染来的。开启渲染封面功能后在文档根目录创建 `_coverpage.md` 文件。 | ||
|
||
```html | ||
<script> | ||
window.$docsify = { | ||
coverpage: true | ||
} | ||
</script> | ||
<script src="//unpkg.com/docsify"></script> | ||
``` | ||
|
||
*_coverpage.md* | ||
|
||
```markdown | ||
![logo](_media/icon.svg) | ||
|
||
# docsify | ||
|
||
> A magical documentation site generator. | ||
|
||
- Simple and lightweight (~12kb gzipped) | ||
- Multiple themes | ||
- Not build static html files | ||
|
||
|
||
[GitHub](https://github.com/QingWei-Li/docsify/) | ||
[Get Started](#quick-start) | ||
``` | ||
|
||
渲染效果如本文档。 | ||
|
||
!> 一份文档只会在根目录下加载封面,其他页面或者二级目录下都不会加载。 | ||
|
||
## 自定义背景 | ||
|
||
目前的背景是随机生成的渐变色,我们自定义背景色或者背景图。在文档末尾用添加图片的 Markdown 语法设置背景。 | ||
|
||
```markdown | ||
# docsify | ||
|
||
[GitHub](https://github.com/QingWei-Li/docsify/) | ||
[Get Started](#quick-start) | ||
|
||
<!-- 背景图片 --> | ||
![](_media/bg.png) | ||
<!-- 背景色 --> | ||
![color](#f0f0f0) | ||
``` | ||
|
Oops, something went wrong.