Skip to content

Commit

Permalink
🔧 Consume reconstructHtmlTransform for inline html
Browse files Browse the repository at this point in the history
  • Loading branch information
fwkoch committed Sep 1, 2023
1 parent 2f739cd commit b101149
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions src/myst.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ import {
getFrontmatter,
GithubTransformer,
glossaryPlugin,
// htmlPlugin,
keysPlugin,
linksPlugin,
mathPlugin,
reconstructHtmlTransform,
ReferenceState,
resolveReferencesPlugin,
RRIDTransformer,
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -127,6 +118,9 @@ export async function processArticleMDAST(
await internalLinksTransform(mdast, { resolver });
await imageUrlSourceTransform(mdast, { resolver });

// Fix inline html
reconstructHtmlTransform(mdast);

return {
references,
frontmatter,
Expand Down Expand Up @@ -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'));
Expand Down

0 comments on commit b101149

Please sign in to comment.