mui/material-ui · error · Error
unsupported language: "${language}", "${code}"
Error message
unsupported language: "${language}", "${code}" What it means
prism.mjs throws when a fenced code block uses a language it has no Prism grammar for (after handling the special cases ts/js/sh/bash/diff). The error echoes the offending language and code so you can locate the block. An empty language falls back to JSX, so this only fires for an explicit but unknown language tag.
Source
Thrown at packages-internal/markdown/prism.mjs:52
].join('\n'),
);
case 'diff':
prismLanguage = { ...prism.languages.diff };
// original `/^[-<].*$/m` matches lines starting with `<` which matches
// <SomeComponent />
// we will only use `-` as the deleted marker
prismLanguage.deleted = /^[-].*$/m;
break;
default:
prismLanguage = prism.languages[language];
break;
}
if (!prismLanguage) {
if (language) {
throw new Error(`unsupported language: "${language}", "${code}"`);
} else {
prismLanguage = prism.languages.jsx;
}
}
return prism.highlight(code, prismLanguage);
}
export default highlight;
View on GitHub (pinned to bdc96df2cb)
Solutions
- Change the fence to a supported language (typically bash, js, ts, jsx, tsx, diff).
- If the language is legitimate and needed, extend the switch in packages-internal/markdown/prism.mjs to map it to a loaded Prism grammar.
- Re-run `pnpm docs:build` to confirm.
Example fix
```yaml key: value ``` // after (if yaml is unsupported here, switch to a supported lang or register it) ```bash key: value ```
Defensive patterns
Strategy: validation
Validate before calling
const SUPPORTED = new Set(['ts', 'js', 'bash', 'diff', 'jsx', 'tsx', 'json', 'css', '']); // per prism.mjs
function isSupportedLanguage(lang) { return SUPPORTED.has(lang); }
if (!isSupportedLanguage(fenceLang)) throw new Error(`unsupported language: ${fenceLang}`); Prevention
- Stick to the languages mapped in prism.mjs for docs code blocks.
- When adding a new language, also register it in prism.mjs.
- Run the docs build locally before pushing.
When it happens
Trigger: Using a fenced code block with a language the docs highlighter does not support, e.g. ```yaml, ```json (if not mapped), ```jsx-with-helpers, or a typo like ```javscript.
Common situations: Doc examples in less common languages; typos in the fence language; new grammar not yet registered in prism.mjs.
Related errors
- docs-infra: Unsupported language: "sh" in:\n\n```sh\n${code}
- docs-infra: The title "${title}" is too long (${title.length
- docs-infra: Missing description in the page: ${location}\n
- docs-infra: The description "${description}" is too long (${
- docs-infra: The description "${description}" should end with
AI-assisted analysis of mui/material-ui@bdc96df2cb (2026-08-12).
Data as JSON: /api/errors/6930b1686d2de7d0.
Report an issue: GitHub.