Skip to content

Commit 7743a77

Browse files
committed
perf: skip highlight auto-detect for known languages
1 parent 64e5960 commit 7743a77

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

src/lib/components/chat/Messages/CodeBlock.svelte

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -561,8 +561,10 @@
561561
result) &&
562562
'border-bottom-left-radius: 0px; border-bottom-right-radius: 0px;'}"><code
563563
class="language-{lang} rounded-t-none whitespace-pre text-sm"
564-
>{@html hljs.highlightAuto(code, hljs.getLanguage(lang)?.aliases).value ||
565-
code}</code
564+
>{@html (hljs.getLanguage(lang)
565+
? hljs.highlight(code, { language: lang, ignoreIllegals: true })
566+
: hljs.highlightAuto(code)
567+
).value || code}</code
566568
></pre>
567569
{/if}
568570
{:else}

0 commit comments

Comments
 (0)