diff --git a/.changeset/few-peas-hunt.md b/.changeset/few-peas-hunt.md new file mode 100644 index 000000000..e4dd16e03 --- /dev/null +++ b/.changeset/few-peas-hunt.md @@ -0,0 +1,7 @@ +--- +'@astrojs/markdoc': minor +'@astrojs/markdown-remark': minor +'astro': minor +--- + +Update internal `shiki` syntax highlighter to `shikiji`. Existing docs on `shiki` still stays the same, but `shikiji` will help make bundling simpler and easier to maintain. diff --git a/packages/astro/components/Code.astro b/packages/astro/components/Code.astro index b3dbb07aa..8f2783db9 100644 --- a/packages/astro/components/Code.astro +++ b/packages/astro/components/Code.astro @@ -103,7 +103,7 @@ const html = highlighter.codeToHtml(code, { }, root(node) { // theme.id for shiki -> shikiji compat - const themeName = typeof theme === 'string' ? theme : (theme as any).id || theme.name; + const themeName = typeof theme === 'string' ? theme : theme.name; if (themeName === 'css-variables') { // Replace special color tokens to CSS variables visit(node as any, 'element', (child) => { diff --git a/packages/integrations/markdoc/src/extensions/shiki.ts b/packages/integrations/markdoc/src/extensions/shiki.ts index dcdd05e7b..8520902ec 100644 --- a/packages/integrations/markdoc/src/extensions/shiki.ts +++ b/packages/integrations/markdoc/src/extensions/shiki.ts @@ -97,7 +97,7 @@ export default async function shiki({ } // theme.id for shiki -> shikiji compat - const themeName = typeof theme === 'string' ? theme : (theme as any).id || theme.name; + const themeName = typeof theme === 'string' ? theme : theme.name; if (themeName === 'css-variables') { html = html.replace(/style="(.*?)"/g, (m) => replaceCssVariables(m)); } diff --git a/packages/markdown/remark/src/remark-shiki.ts b/packages/markdown/remark/src/remark-shiki.ts index 3ffea0cc6..ef267d45f 100644 --- a/packages/markdown/remark/src/remark-shiki.ts +++ b/packages/markdown/remark/src/remark-shiki.ts @@ -93,7 +93,7 @@ export function remarkShiki({ } // theme.id for shiki -> shikiji compat - const themeName = typeof theme === 'string' ? theme : (theme as any).id || theme.name; + const themeName = typeof theme === 'string' ? theme : theme.name; if (themeName === 'css-variables') { html = html.replace(/style="(.*?)"/g, (m) => replaceCssVariables(m)); }