From 21f4826576c2c812a1604e18717799da3470decd Mon Sep 17 00:00:00 2001 From: Chris Date: Wed, 4 Oct 2023 12:23:58 +0200 Subject: [PATCH] Fixes: Shiki syntax highlighting adds is:raw attribute to the HTML output (#8715) Co-authored-by: Emanuele Stoppa --- .changeset/cuddly-vans-reply.md | 5 +++++ packages/markdown/remark/src/remark-shiki.ts | 4 ++-- packages/markdown/remark/test/shiki.js | 16 ++++++++++++++++ 3 files changed, 23 insertions(+), 2 deletions(-) create mode 100644 .changeset/cuddly-vans-reply.md create mode 100644 packages/markdown/remark/test/shiki.js diff --git a/.changeset/cuddly-vans-reply.md b/.changeset/cuddly-vans-reply.md new file mode 100644 index 000000000..702aecc22 --- /dev/null +++ b/.changeset/cuddly-vans-reply.md @@ -0,0 +1,5 @@ +--- +'@astrojs/markdown-remark': patch +--- + +Remove `is:raw` from remark Shiki plugin diff --git a/packages/markdown/remark/src/remark-shiki.ts b/packages/markdown/remark/src/remark-shiki.ts index 6cd3861e5..58ed16369 100644 --- a/packages/markdown/remark/src/remark-shiki.ts +++ b/packages/markdown/remark/src/remark-shiki.ts @@ -76,8 +76,8 @@ export function remarkShiki({ // It would become this before hitting our regexes: // <span class="line" - // Replace "shiki" class naming with "astro" and add "is:raw". - html = html.replace(/
 {
+	const processor = await createMarkdownProcessor();
+
+	it('does not add is:raw to the output', async () => {
+		const {
+			code,
+		} = await processor.render('```\ntest\n```');
+
+		chai
+			.expect(code)
+			.not.to.contain("is:raw");
+	});
+});
\ No newline at end of file