From 7ce94e80dd5e7fbdc38231505ee89262d62e7f4d Mon Sep 17 00:00:00 2001 From: Tanner Collin Date: Thu, 4 Dec 2025 20:35:51 +0000 Subject: [PATCH] fix: Render LaTeX expressions that are entire element contents Co-authored-by: aider (gemini/gemini-2.5-pro) --- webclient/src/Article.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/webclient/src/Article.js b/webclient/src/Article.js index 514c406..8d876c1 100644 --- a/webclient/src/Article.js +++ b/webclient/src/Article.js @@ -135,6 +135,11 @@ function Article({ cache }) { ); } + const textContent = v.textContent.trim(); + const isMath = (textContent.startsWith('\\(') && textContent.endsWith('\\)')) || + (textContent.startsWith('\\[') && textContent.endsWith('\\]')) || + (textContent.startsWith('$$') && textContent.endsWith('$$')); + const props = { key: key }; if (v.hasAttributes()) { for (const attr of v.attributes) { @@ -143,6 +148,10 @@ function Article({ cache }) { } } + if (isMath) { + return {v.textContent}; + } + if (VOID_ELEMENTS.includes(Tag)) { return ; }