Skip to content

Render single $ literally instead of as inline math - #514

Merged
xfgong merged 2 commits into
mainfrom
fix/2026-08-20-markdown-dollar-math
Aug 21, 2026
Merged

Render single $ literally instead of as inline math#514
xfgong merged 2 commits into
mainfrom
fix/2026-08-20-markdown-dollar-math

Conversation

@xfgong

@xfgong xfgong commented Aug 20, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • remark-math was treating a single $…$ as inline KaTeX. Sentences with currency like "Monthly revenue increased from $271,677.37 in January to $272,748.58 in February" were mis-rendered as a formula.
  • Disabled single-dollar text math (singleDollarTextMath: false) in MarkdownWithCitations.tsx. Display math via $$…$$ still renders.
  • Added regression tests: currency amounts render literally (no .katex markup), and $$…$$ still renders as KaTeX.

Test plan

  • pnpm --filter web test MarkdownWithCitations → 5 passed
  • New test asserts no .katex span for $271,677.37 … $272,748.58 and that the amounts survive as literal text
  • New test confirms $$E=mc^2$$ still renders as KaTeX

🤖 Generated with WorkBuddy

remark-math treats single $...$ as inline KaTeX, so currency like
"$271,677.37 ... $272,748.58" was wrongly rendered as a formula.
Disable single-dollar text math (singleDollarTextMath:false); display
math via $$…$$ still renders. Add regression tests.
@github-actions github-actions Bot added bug Something isn't working frontend Frontend code labels Aug 20, 2026
@xfgong
xfgong merged commit 42564b5 into main Aug 21, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working frontend Frontend code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant