diff options
-rw-r--r-- | .changeset/cuddly-vans-reply.md | 5 | ||||
-rw-r--r-- | packages/markdown/remark/src/remark-shiki.ts | 4 | ||||
-rw-r--r-- | packages/markdown/remark/test/shiki.js | 16 |
3 files changed, 23 insertions, 2 deletions
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(/<pre class="(.*?)shiki(.*?)"/, `<pre is:raw class="$1astro-code$2"`); + // Replace "shiki" class naming with "astro". + html = html.replace(/<pre class="(.*?)shiki(.*?)"/, `<pre class="$1astro-code$2"`); // Add "user-select: none;" for "+"/"-" diff symbols if (node.lang === 'diff') { html = html.replace( diff --git a/packages/markdown/remark/test/shiki.js b/packages/markdown/remark/test/shiki.js new file mode 100644 index 000000000..5077623e8 --- /dev/null +++ b/packages/markdown/remark/test/shiki.js @@ -0,0 +1,16 @@ +import { createMarkdownProcessor } from '../dist/index.js'; +import chai from 'chai'; + +describe('shiki syntax highlighting', async () => { + 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 |