Skip to content

fix(ui): render digit-led single-$ math — move currency guard to close side - #376

Merged
aarontrowbridge merged 2 commits into
local/amicodefrom
fix/digit-led-inline-math
Oct 7, 2026
Merged

aarontrowbridge merged 2 commits into
local/amicodefrom
fix/digit-led-inline-math

Conversation

@aarontrowbridge

Copy link
Copy Markdown
Member

Closes #375.

What

The single-$ inline-math rule rejected any math whose opening $ was immediately followed by a digit (an anti-currency guard on the wrong side). All digit-led inline math — the most common physics reporting shape, e.g. .53\times10^{-5}$ — fell through to markdown and rendered raw, while $\alpha$ rendered fine, which made the failure look random.

Fix

Move the digit guard from the open side of the delimiter to the close side — Pandoc's actual currency rule ("the closing $ must not be followed by a digit"):

  • singleDollarTokenizerRegex and singleDollarInlineRegex drop \d from the open-side lookahead and add it to the close side
  • comment block updated to document the close-side rule

-and- pairs stay literal because the first closing $ abuts a digit; and, env-var dollars, escaped \$, halves of `400591…$$, and code spans are all unaffected (test-covered).

Testing

  • bun test src/context/marked-math.test.ts from packages/ui — 10 pass (2 new tests: digit-led positives incl. the two reported snippets, tight digit-pair currency negative)
  • bun typecheck from packages/ui — clean; full bun typecheck at repo root — 30/30 green

Also includes: unblocking fix for the base branch

The base (local/amicode @ 4cf9ef2) typechecks red — #374 indexes the runtime-injected Idempotency-Key/X-Session-Id headers on the static per-provider header union, so its own test file fails tsgo and the pre-push/typecheck gate is blocked. Commit b2143c4 widens the lookup through a Record in that test file only — no production code touched. @jack-champagne FYI, happy to split it into its own PR if you'd rather.

Follow-up (after merge)

Re-extract the app-bundle overlay at the new fork tag so drift_gate.mjs stays green (separate PR in harmoniqs/amicode), then scripts/rebuild_amicode_locally.sh.

#374 indexes Idempotency-Key/X-Session-Id on the static per-provider header
union, which only carries the harmoniqs branch — the test file typechecks
red at the branch base. Widen through a Record so the suite (and the
pre-push typecheck gate) passes.
@coderabbitai

coderabbitai Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: ee2447f5-6760-4651-98c6-4ab80b9cc92a
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@aarontrowbridge
aarontrowbridge marked this pull request as ready for review October 7, 2026 23:07
@aarontrowbridge
aarontrowbridge merged commit 659d75e into local/amicode Oct 7, 2026
4 checks passed
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.

fix(ui): digit-led single-$ inline math renders raw in chat

1 participant