{"record":{"id":"6930b1686d2de7d0","repo":"mui/material-ui","slug":"unsupported-language-language-code","errorCode":null,"errorMessage":"unsupported language: \"${language}\", \"${code}\"","messagePattern":"unsupported language: \"(.+?)\", \"(.+?)\"","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages-internal/markdown/prism.mjs","lineNumber":52,"sourceCode":"        ].join('\\n'),\n      );\n\n    case 'diff':\n      prismLanguage = { ...prism.languages.diff };\n      // original `/^[-<].*$/m` matches lines starting with `<` which matches\n      // <SomeComponent />\n      // we will only use `-` as the deleted marker\n      prismLanguage.deleted = /^[-].*$/m;\n      break;\n\n    default:\n      prismLanguage = prism.languages[language];\n      break;\n  }\n\n  if (!prismLanguage) {\n    if (language) {\n      throw new Error(`unsupported language: \"${language}\", \"${code}\"`);\n    } else {\n      prismLanguage = prism.languages.jsx;\n    }\n  }\n\n  return prism.highlight(code, prismLanguage);\n}\n\nexport default highlight;\n","sourceCodeStart":34,"sourceCodeEnd":62,"githubUrl":"https://github.com/mui/material-ui/blob/bdc96df2cb530fcdd60a7a7aabe37f610ce0f0a5/packages-internal/markdown/prism.mjs#L34-L62","documentation":"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.","triggerScenarios":"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.","commonSituations":"Doc examples in less common languages; typos in the fence language; new grammar not yet registered in prism.mjs.","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."],"exampleFix":"```yaml\nkey: value\n```\n// after (if yaml is unsupported here, switch to a supported lang or register it)\n```bash\nkey: value\n```","handlingStrategy":"validation","validationCode":"const SUPPORTED = new Set(['ts', 'js', 'bash', 'diff', 'jsx', 'tsx', 'json', 'css', '']); // per prism.mjs\nfunction isSupportedLanguage(lang) { return SUPPORTED.has(lang); }\nif (!isSupportedLanguage(fenceLang)) throw new Error(`unsupported language: ${fenceLang}`);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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."],"tags":["docs-infra","build","syntax-highlighting","validation"],"backgroundTag":null,"analyzedSha":"bdc96df2cb530fcdd60a7a7aabe37f610ce0f0a5","analyzedAt":"2026-08-12T22:59:56.717Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}