From 4bcd6e91442d4979042b91825e5d0fe2879d6e55 Mon Sep 17 00:00:00 2001 From: Rowan Cockett Date: Thu, 23 Nov 2023 12:59:41 -0700 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=91=20Clone=20mdast=20for=20html=20dem?= =?UTF-8?q?o?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .changeset/short-mugs-smell.md | 12 ++++++++++++ packages/myst-demo/src/index.tsx | 4 ++-- 2 files changed, 14 insertions(+), 2 deletions(-) create mode 100644 .changeset/short-mugs-smell.md diff --git a/.changeset/short-mugs-smell.md b/.changeset/short-mugs-smell.md new file mode 100644 index 000000000..0ae1daa9f --- /dev/null +++ b/.changeset/short-mugs-smell.md @@ -0,0 +1,12 @@ +--- +'myst-to-react': patch +'myst-demo': patch +'@myst-theme/providers': patch +'@myst-theme/jupyter': patch +'@myst-theme/common': patch +'@myst-theme/article': patch +'@myst-theme/site': patch +'@myst-theme/book': patch +--- + +Updates to myst and bug fix for myst-demo (clone for html output). diff --git a/packages/myst-demo/src/index.tsx b/packages/myst-demo/src/index.tsx index 7ea73a8bf..d9899831a 100644 --- a/packages/myst-demo/src/index.tsx +++ b/packages/myst-demo/src/index.tsx @@ -105,8 +105,7 @@ async function parse( // Also run some of the transforms, like the links const mdastPre = JSON.parse(JSON.stringify(mdast)); visit(mdastPre, (n) => delete n.position); - unified().use(linksPlugin, { transformers: linkTransforms }).runSync(mdast); - const htmlString = mystToHtml(mdast); + const htmlString = mystToHtml(JSON.parse(JSON.stringify(mdast))); const references = { cite: { order: [], data: {} }, footnotes: {}, @@ -141,6 +140,7 @@ async function parse( .use(resolveReferencesPlugin, { state }) .use(keysPlugin) .runSync(mdast as any, file); + const mdastPost = JSON.parse(JSON.stringify(mdast)); visit(mdastPost, (n) => { delete n.position;