@@ -21,10 +21,6 @@ window.$docsify = {
2121
2222Alternatively, a plugin can be stored in a separate file and "installed" using a standard ` <script> ` tag.
2323
24- ``` html
25- <script src =" path/to/docsify-plugin-myplugin.js" ></script >
26- ```
27-
2824``` js
2925(function () {
3026 var myPlugin = function (hook , vm ) {
@@ -37,6 +33,10 @@ Alternatively, a plugin can be stored in a separate file and "installed" using a
3733})();
3834```
3935
36+ ``` html
37+ <script src =" docsify-plugin-myplugin.js" ></script >
38+ ```
39+
4040## Template
4141
4242Below is a plugin template with placeholders for all available lifecycle hooks.
@@ -62,14 +62,14 @@ Below is a plugin template with placeholders for all available lifecycle hooks.
6262 });
6363
6464 // Invoked on each page load before new markdown is transformed to HTML.
65- // See beforeEach() documentation for asynchronous tasks .
65+ // Supports asynchronous tasks (see beforeEach documentation for details) .
6666 hook .beforeEach (function (markdown ) {
6767 // ...
6868 return markdown;
6969 });
7070
7171 // Invoked on each page load after new markdown has been transformed to HTML.
72- // See afterEach() documentation for asynchronous tasks .
72+ // Supports asynchronous tasks (see afterEach documentation for details) .
7373 hook .afterEach (function (html ) {
7474 // ...
7575 return html;
@@ -131,16 +131,13 @@ For asynchronous tasks, the hook function accepts a `next` callback as a second
131131
132132``` js
133133hook .beforeEach (function (markdown , next ) {
134- // Asynchronous task (example)
135- setTimeout (function () {
136- try {
137- // ...
138- } catch (err) {
139- // ...
140- } finally {
141- next (markdown);
142- }
143- }, 1000 );
134+ try {
135+ // Async task(s)...
136+ } catch (err) {
137+ // ...
138+ } finally {
139+ next (markdown);
140+ }
144141});
145142```
146143
@@ -159,16 +156,13 @@ For asynchronous tasks, the hook function accepts a `next` callback as a second
159156
160157``` js
161158hook .afterEach (function (html , next ) {
162- // Asynchronous task (example)
163- setTimeout (function () {
164- try {
165- // ...
166- } catch (err) {
167- // ...
168- } finally {
169- next (markdown);
170- }
171- }, 1000 );
159+ try {
160+ // Async task(s)...
161+ } catch (err) {
162+ // ...
163+ } finally {
164+ next (markdown);
165+ }
172166});
173167```
174168
0 commit comments