Skip to content

Commit

Permalink
fix(gatsby-transformer-asciidoc): abstract the source of asciidoc tra…
Browse files Browse the repository at this point in the history
…nsformer (#11531)
  • Loading branch information
jtanguy authored and pieh committed Feb 5, 2019
1 parent 6bb338a commit 7728d25
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/gatsby-transformer-asciidoc/src/gatsby-node.js
Expand Up @@ -21,10 +21,11 @@ async function onCreateNode(
const content = await loadNodeContent(node)
// Load Asciidoc file for extracting
// https://asciidoctor-docs.netlify.com/asciidoctor.js/processor/extract-api/
const doc = await asciidoc.loadFile(node.absolutePath)
// We use a `let` here as a warning: some operations, like .convert() mutate the document
let doc = await asciidoc.load(content, pluginOptions)

try {
const html = asciidoc.convert(content, pluginOptions)
const html = doc.convert()
// Use "partition" option to be able to get title, subtitle, combined
const title = doc.getDocumentTitle({ partition: true })

Expand Down

0 comments on commit 7728d25

Please sign in to comment.