Skip to content

Commit 64b39a9

Browse files
committed
fix: make latex a bit more robust
1 parent 88b66c3 commit 64b39a9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/lib/components/chat/MarkdownRenderer.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
const escapedRight = right.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
5757
5858
// Create regex pattern that matches content between delimiters
59-
const pattern = new RegExp(`${escapedLeft}([^]*?)${escapedRight}`, "g");
59+
const pattern = new RegExp(`(?<!\\w)${escapedLeft}([^]*?)${escapedRight}(?!\\w)`, "g");
6060
6161
parsed = parsed.replace(pattern, (match, latex) => {
6262
try {

0 commit comments

Comments
 (0)