Skip to content

Commit e545224

Browse files
committed
Update docs
1 parent 8b1000a commit e545224

File tree

3 files changed

+261
-47
lines changed

3 files changed

+261
-47
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
1+
## 1.5.0
2+
13
### Bug fixes
24
- Fix slugify.
5+
- Fix nav highlight.
6+
7+
### Features
8+
- Initialize the configuration by `window.$docsify`.
9+
- Markdown parser is configurable.
310

411
## 1.4.3
512
### Bug fixes

docs/README.md

Lines changed: 125 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,11 @@ docsify serve docs
6060

6161
Read more [docsify-cli](https://github.com/QingWei-Li/docsify-cli)
6262

63-
## Themes
63+
64+
65+
## More
66+
67+
### Themes
6468
Currently available `vue.css` and `buble.css`
6569
```html
6670
<link rel="stylesheet" href="//unpkg.com/docsify/themes/vue.css">
@@ -74,8 +78,6 @@ Minified files
7478
<link rel="stylesheet" href="//unpkg.com/docsify/lib/themes/buble.css">
7579
```
7680

77-
## More
78-
7981
### Multiple pages
8082
If you need other pages, directly create the markdown file, such as `guide.md` is `/#/guide`.
8183

@@ -131,39 +133,89 @@ Currently the background of cover page is generated randomly. We can customize t
131133
![color](#f0f0f0)
132134
```
133135

136+
### Markdown parser
137+
138+
Docsify uses [marked](https://github.com/chjj/marked) to parse markdown, we can configure it
139+
140+
```js
141+
window.$docsify = {
142+
markdown: {
143+
smartypants: true
144+
}
145+
}
146+
```
147+
148+
And can even be completely customized
149+
150+
```js
151+
window.$docsify = {
152+
markdown: function(marked) {
153+
// ...
154+
155+
return marked
156+
}
157+
}
158+
```
159+
160+
## Options
134161

135-
### Options
162+
You can add configuration by script tag attributes or `window.$docsify`.
136163

137-
#### repo
164+
### repo
138165
Display the [GitHub Corner](http://tholman.com/github-corners/) widget.
139166

140167
```html
141168
<script src="//unpkg.com/docsify" data-repo="your/repo"></script>
142169
```
143170

144-
#### max-level
171+
172+
```js
173+
window.$docsify = {
174+
repo: 'your/repo'
175+
}
176+
```
177+
178+
### max-level
145179
TOC level.
146180

147181
```html
148182
<script src="//unpkg.com/docsify" data-max-level="6"></script>
149183
```
150184

151-
#### el
185+
```js
186+
window.$docsify = {
187+
maxLevel: 6
188+
}
189+
```
190+
191+
### el
152192
Root element.
153193

154194
```html
155195
<script src="//unpkg.com/docsify" data-el="#app"></script>
156196
```
157197

158-
#### sidebar-toggle
198+
```js
199+
window.$docsify = {
200+
el: '#app'
201+
}
202+
```
203+
204+
### sidebar-toggle
159205

160206
Sidebar with toggle
161207

162208
```html
163209
<script src="//unpkg.com/docsify" data-sidebar-toggle></script>
164210
```
165211

166-
#### sidebar
212+
```js
213+
window.$docsify = {
214+
sidebarToggle: true
215+
}
216+
```
217+
218+
### sidebar
167219

168220
Custom sidebar. If it's set, the TOC will be disabled. Bind global variables on the `data-sidebar`.
169221

@@ -187,7 +239,13 @@ Custom sidebar. If it's set, the TOC will be disabled. Bind global variables on
187239
```
188240

189241

190-
#### load-sidebar
242+
```js
243+
window.$docsify = {
244+
sidebar: 'sidebar'
245+
}
246+
```
247+
248+
### load-sidebar
191249

192250
Load sidebar markdown file. If it is configured, load the current directory `_sidebar.md` by default. If the file isn't exist, sidebar will appear as a TOC.
193251
** you should add `.nojekyll` into docs folder to prevent GitHub Pages from ignoring the `_sidebar.md`**
@@ -202,6 +260,12 @@ You can specify a file:
202260
<script src="/lib/docsify.js" data-load-sidebar="_sidebar.md"></script>
203261
```
204262

263+
```js
264+
window.$docsify = {
265+
loadSidebar: '_sidebar.md'
266+
}
267+
```
268+
205269
The contents of the file can be:
206270

207271
```markdown
@@ -211,14 +275,9 @@ The contents of the file can be:
211275
- [Getting Started](/getting-started)
212276
- [Dynamic Route Matching](/dynamic-matching)
213277
- [Nested Routes](/nested-routes)
214-
- [Programmatic Navigation](/navigation)
215-
- [Named Routes](/named-routes)
216-
- [Named Views](/named-views)
217-
- [Redirect and Alias](/redirect-and-alias)
218-
- [HTML5 History Mode](/history-mode)
219278
```
220279

221-
#### sub-max-level
280+
### sub-max-level
222281

223282
Display TOC in the custom sidebar. The default value is 0.
224283

@@ -227,10 +286,14 @@ Display TOC in the custom sidebar. The default value is 0.
227286
<script src="/lib/docsify.js" data-load-sidebar data-max-sub-level="4"></script>
228287
```
229288

230-
![image](https://cloud.githubusercontent.com/assets/7565692/21563209/a8894512-ceba-11e6-80eb-fef00b80625c.png)
231289

290+
```js
291+
window.$docsify = {
292+
maxSubLevel: 4
293+
}
294+
```
232295

233-
#### load-navbar
296+
### load-navbar
234297

235298
Load navbar markdown file. If it is configured, load the current directory `_navbar.md` by default.
236299

@@ -244,6 +307,12 @@ You can specify a file:
244307
<script src="/lib/docsify.js" data-load-navbar="_navbar.md"></script>
245308
```
246309

310+
```js
311+
window.$docsify = {
312+
loadNavbar: '_navbar.md'
313+
}
314+
```
315+
247316
The contents of the file can be:
248317

249318
```markdown
@@ -260,15 +329,22 @@ If you write a sub level list, it will generate a dropdown list.
260329
- [chinese](/zh-cn)
261330
```
262331

263-
#### router
332+
### router
264333

265334
Hash router.
266335

267336
```html
268337
<script src="/lib/docsify.js" data-router></script>
269338
```
270339

271-
#### auto2top
340+
```js
341+
window.$docsify = {
342+
router: true
343+
}
344+
```
345+
346+
347+
### auto2top
272348

273349
Scroll to the top on changing hash.
274350

@@ -277,7 +353,13 @@ Scroll to the top on changing hash.
277353
<script src="/lib/docsify.js" data-auto2top></script>
278354
```
279355

280-
#### homepage
356+
```js
357+
window.$docsify = {
358+
auto2top: true
359+
}
360+
```
361+
362+
### homepage
281363

282364
`README.md` will be rendered as a homepage for your website in the docs folder, but sometimes we want to specify another file as a homepage, or even use the `README.md` in your repo. We can use (need `data-router`):
283365

@@ -288,7 +370,14 @@ Scroll to the top on changing hash.
288370
```
289371

290372

291-
#### basePath
373+
```js
374+
window.$docsify = {
375+
homepage: true
376+
}
377+
```
378+
379+
380+
### basePath
292381

293382
If your HTML entry file and the markdown files are in different directories, we can use:
294383

@@ -300,12 +389,25 @@ If your HTML entry file and the markdown files are in different directories, we
300389
```
301390

302391

303-
#### coverpage
392+
```js
393+
window.$docsify = {
394+
basePath: '/base/'
395+
}
396+
```
397+
398+
399+
### coverpage
304400

305401
Generate cover page.
306402

307403
```html
308404
<script src="/lib/docsify.js" data-coverpage></script>
309405
<!-- or -->
310406
<script src="/lib/docsify.js" data-coverpage="other.md"></script>
407+
```
408+
409+
```js
410+
window.$docsify = {
411+
coverpage: true
412+
}
311413
```

0 commit comments

Comments
 (0)