Skip to content

Commit 5a5b5aa

Browse files
committed
update docs regarding configs as functions
1 parent 732c34d commit 5a5b5aa

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

docs/configuration.md

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Configuration
22

3-
You can configure the `window.$docsify`.
3+
You can configure Docsify by defining `window.$docsify` as an object:
44

55
```html
66
<script>
@@ -12,6 +12,24 @@ You can configure the `window.$docsify`.
1212
</script>
1313
```
1414

15+
The config can also be defined as a function, in which case the first arg is the Docsify `vm` instance. The function should return a config object. This can be useful for referencing `vm` in places like the markdown configuration:
16+
17+
```html
18+
<script>
19+
window.$docsify = function(vm) {
20+
return {
21+
markdown: {
22+
renderer: {
23+
code(code, lang) {
24+
// ... use `vm` ...
25+
},
26+
},
27+
},
28+
};
29+
};
30+
</script>
31+
```
32+
1533
## el
1634

1735
- Type: `String`

0 commit comments

Comments
 (0)