From 147cab94a881cae9a9a28c9384882cc39632fc2b Mon Sep 17 00:00:00 2001 From: Akarshan Biswas Date: Thu, 16 Oct 2025 12:15:24 +0530 Subject: [PATCH] fix: Escape dollar signs followed by numbers in Markdown (#6797) This commit introduces a change to prevent **Markdown** rendering issues where a dollar sign followed by a number (like **`$1`**) is incorrectly interpreted as **LaTeX** by the rendering engine. --- The `normalizeLatex` function in `RenderMarkdown.tsx` now explicitly escapes these sequences (e.g., **`$1`** becomes **`\$1`**), ensuring they are displayed literally instead of being processed as mathematical expressions. This improves the fidelity of text that might contain currency or similar numerical notations. --- web-app/src/containers/RenderMarkdown.tsx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/web-app/src/containers/RenderMarkdown.tsx b/web-app/src/containers/RenderMarkdown.tsx index c941b512d..3225e5b72 100644 --- a/web-app/src/containers/RenderMarkdown.tsx +++ b/web-app/src/containers/RenderMarkdown.tsx @@ -62,6 +62,10 @@ const normalizeLatex = (input: string): string => { (_, pre, inner) => `${pre}$${inner.trim()}$` ) + // --- Escape $ to prevent Markdown from treating it as LaTeX + // Example: "$1" → "\$1" + s = s.replace(/\$(\d+)/g, '\\$$1') + return s }) .join('')