Skip to content

Commit

Permalink
Fix language not detected
Browse files Browse the repository at this point in the history
  • Loading branch information
ztjhz committed Mar 8, 2023
1 parent b6bf66d commit e48d967
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/components/Chat/ChatContent/Message/MessageContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
});
Expand Down

0 comments on commit e48d967

Please sign in to comment.