Skip to content

Commit f72bf4c

Browse files
committed
allow the user's $docsify config to be a function that receives as input the Docsify instance
1 parent b2e6123 commit f72bf4c

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

src/core/config.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { merge, hyphenate, isPrimitive, hasOwn } from './util/core';
22

33
const currentScript = document.currentScript;
44

5-
export default function() {
5+
export default function(vm) {
66
const config = merge(
77
{
88
el: '#app',
@@ -35,7 +35,9 @@ export default function() {
3535
relativePath: false,
3636
topMargin: 0,
3737
},
38-
window.$docsify
38+
typeof window.$docsify === 'function'
39+
? window.$docsify(vm)
40+
: window.$docsify
3941
);
4042

4143
const script =

src/core/init/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { initLifecycle, callHook } from './lifecycle';
99
export function initMixin(proto) {
1010
proto._init = function() {
1111
const vm = this;
12-
vm.config = config();
12+
vm.config = config(vm);
1313

1414
initLifecycle(vm); // Init hooks
1515
initPlugin(vm); // Install plugins

0 commit comments

Comments
 (0)