summaryrefslogtreecommitdiff
path: root/packages/markdown/remark/src
diff options
context:
space:
mode:
authorGravatar Juan Martín Seery <me@juanm04.com> 2022-02-08 02:48:00 -0300
committerGravatar GitHub <noreply@github.com> 2022-02-08 00:48:00 -0500
commitf0952a8e5bbc75983bbf83e57dcb4d21ef322735 (patch)
tree61b85db5d15b1c1b2620568785b6ce2d9cd73444 /packages/markdown/remark/src
parentc88a9951e4dcc653245bfbacd8c632e39fa3d8f8 (diff)
downloadastro-f0952a8e5bbc75983bbf83e57dcb4d21ef322735.tar.gz
astro-f0952a8e5bbc75983bbf83e57dcb4d21ef322735.tar.zst
astro-f0952a8e5bbc75983bbf83e57dcb4d21ef322735.zip
fix: curly braces inside Shiki (#2545)
Diffstat (limited to 'packages/markdown/remark/src')
-rw-r--r--packages/markdown/remark/src/remark-shiki.ts4
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