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

  1. Change the fence to a supported language (typically bash, js, ts, jsx, tsx, diff).
  2. If the language is legitimate and needed, extend the switch in packages-internal/markdown/prism.mjs to map it to a loaded Prism grammar.
  3. 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

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


AI-assisted analysis of mui/material-ui@bdc96df2cb (2026-08-12). Data as JSON: /api/errors/6930b1686d2de7d0. Report an issue: GitHub.