diff --git a/src/core/render/index.js b/src/core/render/index.js index e4e63f76d..4f4a6da3e 100644 --- a/src/core/render/index.js +++ b/src/core/render/index.js @@ -321,15 +321,15 @@ export function Render(Base) { ); } - this.callHook('afterEach', html, hookData => - renderMain.call(this, hookData) - ); + this.callHook('afterEach', html, hookData => { + renderMain.call(this, hookData); + next(); + }); }; if (this.isHTML) { html = this.result = text; callback(); - next(); } else { prerenderEmbed( { @@ -339,7 +339,6 @@ export function Render(Base) { tokens => { html = this.compiler.compile(tokens); callback(); - next(); } ); } diff --git a/test/e2e/plugins.test.js b/test/e2e/plugins.test.js index 92f00ca56..2f3ff4b7e 100644 --- a/test/e2e/plugins.test.js +++ b/test/e2e/plugins.test.js @@ -9,7 +9,7 @@ test.describe('Plugins', () => { 'mounted', 'beforeEach-async', 'beforeEach', - // 'afterEach-async', + 'afterEach-async', 'afterEach', 'doneEach', 'ready', @@ -41,13 +41,12 @@ test.describe('Plugins', () => { return markdown; }); - // FIXME: https://github.com/docsifyjs/docsify/issues/449 - // hook.afterEach(function (html, next) { - // setTimeout(function () { - // console.log('afterEach-async'); - // next(html); - // }, 100); - // }); + hook.afterEach(function (html, next) { + setTimeout(function () { + console.log('afterEach-async'); + next(html); + }, 100); + }); hook.afterEach(function (html) { console.log('afterEach');