Skip to content

Render Mermaid diagrams and LaTeX math in chat - #1

Merged
aidenwboudr merged 15 commits into
aidenfrom
claude/render-math-mermaid
Oct 7, 2026
Merged

aidenwboudr merged 15 commits into
aidenfrom
claude/render-math-mermaid

Conversation

@aidenwboudr

@aidenwboudr aidenwboudr commented Oct 7, 2026 •

Copy link
Copy Markdown
Owner

Makes T3 render Mermaid diagrams and LaTeX math in chat, on top of the v0.0.45 release (the aiden branch).

What's in it (all cherry-picked from upstream, credit to their authors):

Backport conflicts resolved by hand

Verification

  • apps/web typecheck passes.
  • Full web unit suite: 416 files, 5530 tests, all passing. (A repo-root .env.local with the client config breaks three connectCliAuth tests, so the build script reads that config from ~/.config instead.)
  • Production build, real thread: Claude replied with a document holding inline and display math, prose dollars, inline code and two Mermaid diagrams. Headless Chrome saw 4 KaTeX formulas, 0 KaTeX errors, 2 diagram SVGs and $HOME as <code>, in dark and light themes.
  • AppImage installed on aiden-laptop13 and the app restarted on it. app-update.yml points at this fork, and the app reconnected to both homelab environments.

🤖 Generated with Claude Code

maria-rcks and others added 15 commits October 7, 2026 00:54
Co-authored-by: maria-rcks <254055478+maria-rcks@users.noreply.github.com>
Typeset $…$, $$…$$, \(…\) and \[…\] in chat and Markdown previews behind
Settings → Appearance → Render math (off by default). Math is parsed by a
micromark construct, so code, links, escapes and source offsets keep their
CommonMark meaning; KaTeX loads lazily only when a formula renders.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
A `$$` or `\[` block needs its closing line before it typesets, so a
formula arriving token by token no longer flips between KaTeX output and
source on every prefix.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Upstream keeps math opt-in. This fork is for a user who wants it on, so
flip the client-setting default; Settings → Appearance can still turn it off.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
"It costs $5 and $10, and `$HOME`" turned "$5 … `$" into a broken formula
and swallowed the code span, because inline math scanned straight through the
backtick to the `$` inside it. A formula now gives up at a backtick, so the
code span wins as CommonMark precedence says it should.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@aidenwboudr
aidenwboudr marked this pull request as ready for review October 7, 2026 06:16
@aidenwboudr
aidenwboudr merged commit ad86a87 into aiden Oct 7, 2026
@aidenwboudr
aidenwboudr deleted the claude/render-math-mermaid branch October 7, 2026 06:16
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.

4 participants