Fix language not detected

Fixes #46
This commit is contained in:
Jing Hua 2023-03-08 22:57:02 +08:00
parent b6bf66dcc7
commit e48d967b4b

View file

@ -125,7 +125,8 @@ const ContentView = React.memo(
const match = /language-(\w+)/.exec(className || '');
const lang = match && match[1];
if (lang)
const isMatch = lang && hljs.getLanguage(lang);
if (isMatch)
highlight = hljs.highlight(children.toString(), {
language: lang,
});