update docs regarding configs as functions

This commit is contained in:
Joe Pea 2020-05-22 01:42:40 -07:00
parent 732c34db55
commit 5a5b5aa932

View File

@ -1,6 +1,6 @@
# Configuration
You can configure the `window.$docsify`.
You can configure Docsify by defining `window.$docsify` as an object:
```html
<script>
@ -12,6 +12,24 @@ You can configure the `window.$docsify`.
</script>
```
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:
```html
<script>
window.$docsify = function(vm) {
return {
markdown: {
renderer: {
code(code, lang) {
// ... use `vm` ...
},
},
},
};
};
</script>
```
## el
- Type: `String`