diff options
Diffstat (limited to 'packages/gitbook/src/output/generatePage.js')
-rw-r--r-- | packages/gitbook/src/output/generatePage.js | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/packages/gitbook/src/output/generatePage.js b/packages/gitbook/src/output/generatePage.js index 7375f1d..38cd450 100644 --- a/packages/gitbook/src/output/generatePage.js +++ b/packages/gitbook/src/output/generatePage.js @@ -23,10 +23,9 @@ function generatePage(output, page) { return timing.measure( 'page.generate', Promise(page) - .then(function(resultPage) { + .then((resultPage) => { const file = resultPage.getFile(); - const filePath = file.getPath(); - const parser = file.getParser(); + const { path: filePath, parser } = file; const context = JSONUtils.encodeState(output, resultPage); if (!parser) { @@ -39,8 +38,8 @@ function generatePage(output, page) { return callPageHook('page:before', output, resultPage) // Escape code blocks with raw tags - .then((currentPage) => { - return parser.preparePage(currentPage.getContent()); + .then(({ content }) => { + return parser.prepare(content); }) // Render templating syntax @@ -49,11 +48,9 @@ function generatePage(output, page) { return Templating.render(engine, absoluteFilePath, content, context); }) - // Parse with markdown/asciidoc parser - .then((content) => parser.parsePage(content)) - - // Return new page - .then(({content}) => { + // Render with markdown/asciidoc parser + .then((content) => { + content = parser.toHTML(content); return resultPage.set('content', content); }) |