Skip to content

Commit

Permalink
Fix markdown issue where type is missing in backticks (#2719)
Browse files Browse the repository at this point in the history
  • Loading branch information
timothycarambat authored Nov 26, 2024
1 parent b2c18ba commit c9d49a5
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions frontend/src/utils/chat/markdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -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">
Expand All @@ -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">
Expand Down

0 comments on commit c9d49a5

Please sign in to comment.