fix(v1): fix JSX highlighting by passing language to Prism (#2196)

* Fix JSX highlighting by passing language to Prism

* Make Prettier happy

* Keep guessing what Prettier wants because CI doesn't tell me
This commit is contained in:
Dan Abramov 2020-01-07 16:42:47 +00:00 committed by Yangshun Tay
parent c2aeda273c
commit 632e2dc437

View File

@ -54,7 +54,11 @@ class MarkdownRenderer {
// Currently people using prismjs on Node have to individually require()
// every single language (https://github.com/PrismJS/prism/issues/593)
loadLanguages([language]);
return prismjs.highlight(str, prismjs.languages[language]);
return prismjs.highlight(
str,
prismjs.languages[language],
language,
);
} catch (err) {
if (err.code === 'MODULE_NOT_FOUND') {
const unsupportedLanguageError = chalk.yellow(