mirror of
https://github.com/zhigang1992/mdx-util.git
synced 2026-04-29 20:54:59 +08:00
Changes mdx-loader to check for prism language before trying to dynamically require the corresponding language file.
This commit is contained in:
@@ -22,8 +22,8 @@ function highlight(str, lang) {
|
||||
return str
|
||||
} else {
|
||||
lang = aliases[lang] || lang
|
||||
require(`prismjs/components/prism-${lang}.js`)
|
||||
if (Prism.languages[lang]) {
|
||||
require(`prismjs/components/prism-${lang}.js`)
|
||||
return Prism.highlight(str, Prism.languages[lang])
|
||||
} else {
|
||||
return str
|
||||
|
||||
Reference in New Issue
Block a user