Fix: Prevent false positive single dollar math detection in text nodes

Co-authored-by: aider (gemini/gemini-2.5-pro) <aider@aider.chat>
This commit is contained in:
2025-12-08 23:52:36 +00:00
parent 73a139ef9a
commit 0c1c56b54a

View File

@@ -106,7 +106,7 @@ function Article({ cache }) {
if (v.nodeName === '#text') {
const text = v.data;
if (text.includes('\\[') || text.includes('\\(') || text.includes('$$') || text.includes('$')) {
if (text.includes('\\[') || text.includes('\\(') || text.includes('$$') || /\$(?:[^$]*[^\s$])\$/.test(text)) {
return <Latex key={key} delimiters={latexDelimiters}>{text}</Latex>;
}