Skip to content

Commit

Permalink
fix: handle crash issue on hljs highlighting (#859)
Browse files Browse the repository at this point in the history
  • Loading branch information
louis-jan authored Dec 5, 2023
1 parent 5b76862 commit 848bdbc
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion web/screens/Chat/SimpleTextMessage/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,11 @@ const marked = new Marked(
if (lang === undefined || lang === '') {
return hljs.highlightAuto(code).value
}
return hljs.highlight(code, { language: lang }).value
try {
return hljs.highlight(code, { language: lang }).value
} catch (err) {
return hljs.highlight(code, { language: 'javascript' }).value
}
},
}),
{
Expand Down

0 comments on commit 848bdbc

Please sign in to comment.