From c9d49a5f32e35c4a480686f105483c30029ab5ba Mon Sep 17 00:00:00 2001
From: Timothy Carambat <rambat1010@gmail.com>
Date: Mon, 25 Nov 2024 17:47:13 -0800
Subject: [PATCH] Fix markdown issue where type is missing in backticks (#2719)

---
 frontend/src/utils/chat/markdown.js | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/frontend/src/utils/chat/markdown.js b/frontend/src/utils/chat/markdown.js
index b0fa7f2d5..19ca46dec 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 (
           `<div class="whitespace-pre-line w-full hljs ${theme} light:border light:border-gray-700 rounded-lg px-4 pb-4 relative font-mono font-normal text-sm text-slate-200">
             <div class="w-full flex items-center absolute top-0 left-0 text-slate-200 light:bg-sky-800 bg-stone-800 px-4 py-2 text-xs font-sans justify-between rounded-t-md">
@@ -36,7 +37,7 @@ const markdown = markdownIt({
     }
 
     return (
-      `<div class="whitespace-pre-line w-full rounded-lg bg-black-900 light:bg-gray-200 px-4 pb-4 relative font-mono font-normal text-sm text-slate-200">
+      `<div class="whitespace-pre-line w-full hljs ${theme} light:border light:border-gray-700 rounded-lg px-4 pb-4 relative font-mono font-normal text-sm text-slate-200">
         <div class="w-full flex items-center absolute top-0 left-0 text-slate-200 bg-stone-800 px-4 py-2 text-xs font-sans justify-between rounded-t-md">
           <div class="flex gap-2"><code class="text-xs"></code></div>
           <button data-code-snippet data-code="code-${uuid}" class="flex items-center gap-x-2">
-- 
GitLab