From ca462769b94e204cd4c3c8f8cf2f92d2dcf84100 Mon Sep 17 00:00:00 2001 From: Olivier Tassinari Date: Tue, 29 Oct 2019 09:24:50 +0100 Subject: [PATCH] [docs] Fail if missing language --- docs/src/modules/components/MarkdownElement.js | 10 +++------- .../minimizing-bundle-size/minimizing-bundle-size.md | 2 +- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/docs/src/modules/components/MarkdownElement.js b/docs/src/modules/components/MarkdownElement.js index 598bef4760bd36..a7d6b409005308 100644 --- a/docs/src/modules/components/MarkdownElement.js +++ b/docs/src/modules/components/MarkdownElement.js @@ -99,15 +99,11 @@ const markedOptions = { break; } - if (!prismLanguage && language) { + if (!prismLanguage) { throw new Error(`unsuppored language: "${language}", "${code}"`); } - if (prismLanguage) { - return prism.highlight(code, prismLanguage); - } - - return code; + return prism.highlight(code, prismLanguage); }, renderer, }; @@ -141,7 +137,7 @@ const styles = theme => ({ fontSize: 14, borderRadius: 2, }, - '& pre > code': { + '& code[class*="language-"]': { backgroundColor: '#333', color: '#fff', }, diff --git a/docs/src/pages/guides/minimizing-bundle-size/minimizing-bundle-size.md b/docs/src/pages/guides/minimizing-bundle-size/minimizing-bundle-size.md index 87e88dfad7e8b1..07c47c643465ad 100644 --- a/docs/src/pages/guides/minimizing-bundle-size/minimizing-bundle-size.md +++ b/docs/src/pages/guides/minimizing-bundle-size/minimizing-bundle-size.md @@ -175,7 +175,7 @@ If you are using Create React App, you will need to use a couple of projects tha Note: You may run into errors like these: - ``` + ```sh Module not found: Can't resolve '@material-ui/core/makeStyles' in '/your/project' Module not found: Can't resolve '@material-ui/core/createStyles' in '/your/project' ```