diff --git a/docs/write-a-plugin.md b/docs/write-a-plugin.md index 2f5af37f..d6605d4e 100644 --- a/docs/write-a-plugin.md +++ b/docs/write-a-plugin.md @@ -6,41 +6,41 @@ A plugin is simply a function that takes `hook` as an argument. The hook support ```js window.$docsify = { - plugins: [ - function (hook, vm) { - hook.init(function() { - // Called when the script starts running, only trigger once, no arguments, - }) + plugins: [ + function(hook, vm) { + hook.init(function() { + // Called when the script starts running, only trigger once, no arguments, + }); - hook.beforeEach(function(content) { - // Invoked each time before parsing the Markdown file. - // ... - return content - }) + hook.beforeEach(function(content) { + // Invoked each time before parsing the Markdown file. + // ... + return content; + }); - hook.afterEach(function(html, next) { - // Invoked each time after the Markdown file is parsed. - // beforeEach and afterEach support asynchronous。 - // ... - // call `next(html)` when task is done. - next(html) - }) + hook.afterEach(function(html, next) { + // Invoked each time after the Markdown file is parsed. + // beforeEach and afterEach support asynchronous。 + // ... + // call `next(html)` when task is done. + next(html); + }); - hook.doneEach(function() { - // Invoked each time after the data is fully loaded, no arguments, - // ... - }) + hook.doneEach(function() { + // Invoked each time after the data is fully loaded, no arguments, + // ... + }); - hook.mounted(function() { - // Called after initial completion. Only trigger once, no arguments. - }) + hook.mounted(function() { + // Called after initial completion. Only trigger once, no arguments. + }); - hook.ready(function() { - // Called after initial completion, no arguments. - }) - } - ] -} + hook.ready(function() { + // Called after initial completion, no arguments. + }); + } + ] +}; ``` !> You can get internal methods through `window.Docsify`. Get the current instance through the second argument. @@ -54,21 +54,21 @@ Add footer component in each pages. ```js window.$docsify = { plugins: [ - function (hook) { + function(hook) { var footer = [ '