diff --git a/packages/site-kit/src/lib/markdown/renderer.ts b/packages/site-kit/src/lib/markdown/renderer.ts index aaafcdfbe3..8810253e42 100644 --- a/packages/site-kit/src/lib/markdown/renderer.ts +++ b/packages/site-kit/src/lib/markdown/renderer.ts @@ -860,7 +860,10 @@ async function syntax_highlight({ html = replace_blank_lines(html); } else { const highlighted = highlighter.codeToHtml(source, { - lang: SHIKI_LANGUAGE_MAP[language as keyof typeof SHIKI_LANGUAGE_MAP], + // fallback to the passing the language as is if it doesn't exist in our map + // this ensures we get an error if we're using an unsupported language + // rather than silently not highlighting the code block as expected + lang: SHIKI_LANGUAGE_MAP[language as keyof typeof SHIKI_LANGUAGE_MAP] ?? language, theme }); diff --git a/packages/site-kit/src/lib/markdown/utils.ts b/packages/site-kit/src/lib/markdown/utils.ts index 559d507456..e01454fdf8 100644 --- a/packages/site-kit/src/lib/markdown/utils.ts +++ b/packages/site-kit/src/lib/markdown/utils.ts @@ -4,13 +4,19 @@ import json5 from 'json5'; export const SHIKI_LANGUAGE_MAP = { bash: 'bash', env: 'bash', + yaml: 'yaml', + toml: 'toml', html: 'svelte', svelte: 'svelte', sv: 'svelte', + css: 'css', js: 'javascript', + json: 'javascript', + jsonc: 'javascript', dts: 'typescript', - css: 'css', ts: 'typescript', + // TODO: find a highlighter for tree syntax + tree: '', '': '' };
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies: