diff --git a/.changeset/eighty-pumpkins-float.md b/.changeset/eighty-pumpkins-float.md new file mode 100644 index 000000000000..9550a18ceeec --- /dev/null +++ b/.changeset/eighty-pumpkins-float.md @@ -0,0 +1,6 @@ +--- +"@astrojs/markdown-remark": patch +--- + +This patch allows Shiki to use all of its reserved languages instead of the +previous behavior of forcing unknown languages to plaintext. diff --git a/packages/markdown/remark/src/shiki.ts b/packages/markdown/remark/src/shiki.ts index ff1589dac153..fc35c6e92b33 100644 --- a/packages/markdown/remark/src/shiki.ts +++ b/packages/markdown/remark/src/shiki.ts @@ -1,5 +1,5 @@ import type { Properties } from 'hast'; -import { bundledLanguages, createCssVariablesTheme, getHighlighter } from 'shiki'; +import { bundledLanguages, createCssVariablesTheme, getHighlighter, isSpecialLang } from 'shiki'; import { visit } from 'unist-util-visit'; import type { ShikiConfig } from './types.js'; @@ -51,7 +51,7 @@ export async function createShikiHighlighter({ return { highlight(code, lang = 'plaintext', options) { - if (lang !== 'plaintext' && !loadedLanguages.includes(lang)) { + if (!isSpecialLang(lang) && !loadedLanguages.includes(lang)) { // eslint-disable-next-line no-console console.warn(`[Shiki] The language "${lang}" doesn't exist, falling back to "plaintext".`); lang = 'plaintext';