Skip to content

fix: inline math parsing — use GitHub/pandoc dollar sign rules - #103

Merged
mitschabaude merged 2 commits into
mainfrom
fix/inline-math-dollar-heuristic
Mar 4, 2026
Merged

mitschabaude merged 2 commits into
mainfrom
fix/inline-math-dollar-heuristic

Conversation

@mitschabaude

Copy link
Copy Markdown
Member

Replace the opening-side currency heuristic (reject $ followed by digit) with the standard closing-side rules used by GitHub and pandoc:

  1. Opening $ must not be followed by whitespace
  2. Closing $ must not be preceded by whitespace
  3. Closing $ must not be followed by a digit

This correctly handles both currency ($1,200) and math starting with digits ($2^{31}$, $1$) without false positives.

Before: $2^{31} \equiv 1 \pmod{P}$ was rejected because the old heuristic treated any $+digit as currency.

After: Parsed correctly as LaTeX math, matching GitHub's behavior.

Replace the opening-side currency heuristic (reject $ followed by digit)
with the standard closing-side rules used by GitHub and pandoc:

1. Opening $ must not be followed by whitespace
2. Closing $ must not be preceded by whitespace
3. Closing $ must not be followed by a digit

This correctly handles both currency ($1,200) and math starting with
digits ($2^{31}$, $1$) without false positives.
@vercel

vercel Bot commented Mar 4, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
vibenote Ready Ready Preview, Comment Mar 4, 2026 5:22pm

@mitschabaude
mitschabaude merged commit b20579b into main Mar 4, 2026
3 checks passed
@mitschabaude
mitschabaude deleted the fix/inline-math-dollar-heuristic branch March 4, 2026 17:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant