diff options
Diffstat (limited to 'packages/markdown/remark/src')
-rw-r--r-- | packages/markdown/remark/src/remark-shiki.ts | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/packages/markdown/remark/src/remark-shiki.ts b/packages/markdown/remark/src/remark-shiki.ts index 91f1b76e3..4226c6db6 100644 --- a/packages/markdown/remark/src/remark-shiki.ts +++ b/packages/markdown/remark/src/remark-shiki.ts @@ -40,8 +40,8 @@ const remarkShiki = async ({ langs = [], theme = 'github-dark', wrap = false }: visit(tree, 'code', (node) => { let html = highlighter.codeToHtml(node.value, { lang: node.lang ?? 'plaintext' }); - // Replace "shiki" class naming with "astro". - html = html.replace('<pre class="shiki"', '<pre class="astro-code"'); + // Replace "shiki" class naming with "astro" and add "data-astro-raw". + html = html.replace('<pre class="shiki"', '<pre data-astro-raw class="astro-code"'); // Replace "shiki" css variable naming with "astro". html = html.replace(/style="(background-)?color: var\(--shiki-/g, 'style="$1color: var(--astro-code-'); // Handle code wrapping |