diff --git a/frontend/src/utils/chat/markdown.js b/frontend/src/utils/chat/markdown.js index b0fa7f2d527..19ca46dec1c 100644 --- a/frontend/src/utils/chat/markdown.js +++ b/frontend/src/utils/chat/markdown.js @@ -11,12 +11,13 @@ const markdown = markdownIt({ typographer: true, highlight: function (code, lang) { const uuid = v4(); + const theme = + window.localStorage.getItem("theme") === "light" + ? "github" + : "github-dark"; + if (lang && hljs.getLanguage(lang)) { try { - const theme = - window.localStorage.getItem("theme") === "light" - ? "github" - : "github-dark"; return ( `
@@ -36,7 +37,7 @@ const markdown = markdownIt({ } return ( - `
+ `