forked from tanner/qotnews
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:
@@ -106,7 +106,7 @@ function Article({ cache }) {
|
|||||||
|
|
||||||
if (v.nodeName === '#text') {
|
if (v.nodeName === '#text') {
|
||||||
const text = v.data;
|
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>;
|
return <Latex key={key} delimiters={latexDelimiters}>{text}</Latex>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user