From 4d6b981a54d676a4d70b767418ec842bb4f3114a Mon Sep 17 00:00:00 2001 From: butterfly Date: Tue, 26 Mar 2024 11:43:55 +0800 Subject: [PATCH] bugfix: Delete the escapeDollarNumber function, which causes errors in rendering a latex string --- app/components/markdown.tsx | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) diff --git a/app/components/markdown.tsx b/app/components/markdown.tsx index 7c70fe1a5ac..c6290d8e015 100644 --- a/app/components/markdown.tsx +++ b/app/components/markdown.tsx @@ -99,23 +99,6 @@ export function PreCode(props: { children: any }) { ); } -function escapeDollarNumber(text: string) { - let escapedText = ""; - - for (let i = 0; i < text.length; i += 1) { - let char = text[i]; - const nextChar = text[i + 1] || " "; - - if (char === "$" && nextChar >= "0" && nextChar <= "9") { - char = "\\$"; - } - - escapedText += char; - } - - return escapedText; -} - function escapeBrackets(text: string) { const pattern = /(```[\s\S]*?```|`.*?`)|\\\[([\s\S]*?[^\\])\\\]|\\\((.*?)\\\)/g; @@ -136,7 +119,7 @@ function escapeBrackets(text: string) { function _MarkDownContent(props: { content: string }) { const escapedContent = useMemo( - () => escapeBrackets(escapeDollarNumber(props.content)), + () => escapeBrackets(props.content), [props.content], );