From b10114940690eadc457efcc6d990a1ebc88e8ca2 Mon Sep 17 00:00:00 2001 From: Franklin Koch Date: Fri, 1 Sep 2023 17:12:24 -0600 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A7=20Consume=20reconstructHtmlTransfo?= =?UTF-8?q?rm=20for=20inline=20html?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/myst.ts | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/src/myst.ts b/src/myst.ts index bc4dd08..4c96d14 100644 --- a/src/myst.ts +++ b/src/myst.ts @@ -9,10 +9,10 @@ import { getFrontmatter, GithubTransformer, glossaryPlugin, - // htmlPlugin, keysPlugin, linksPlugin, mathPlugin, + reconstructHtmlTransform, ReferenceState, resolveReferencesPlugin, RRIDTransformer, @@ -65,15 +65,6 @@ export function markdownParse(text: string): Root { // This is consistent with the current Jupyter markdown renderer unified() .use(basicTransformationsPlugin) - // .use(htmlPlugin, { - // htmlHandlers: { - // comment(h: any, node: any) { - // const result = h(node, 'comment'); - // (result as any).value = node.value; - // return result; - // } - // } - // }) .runSync(mdast as any); return mdast as Root; } @@ -127,6 +118,9 @@ export async function processArticleMDAST( await internalLinksTransform(mdast, { resolver }); await imageUrlSourceTransform(mdast, { resolver }); + // Fix inline html + reconstructHtmlTransform(mdast); + return { references, frontmatter, @@ -191,6 +185,9 @@ export async function processNotebookMDAST( await internalLinksTransform(mdast, { resolver }); + // Fix inline html + reconstructHtmlTransform(mdast); + if (file.messages.length > 0) { // TODO: better error messages in the future console.error(file.messages.map(m => m.message).join('\n'));