Skip to content

Render LaTeX math ($...$ and $$...$$) in markdown viewer and terminal block output #9677

@twmitchel

Description

@twmitchel

Pre-submit Checks

Describe the solution you'd like?

Warp currently treats LaTeX math delimiters as plain text in both the markdown viewer and streaming terminal output. I'd like both surfaces to recognize and typeset LaTeX math:

  • Inline math: content between single $...$ delimiters
  • Display math: content between $$...$$ delimiters

This should apply in two places:

  1. Markdown file previews — when a .md / .markdown file contains math delimiters, render the math typeset rather than as raw $\sigma(x) = \frac{1}{1+e^{-x}}$.
  2. Streaming terminal block output from AI agents (Claude Code, Codex, Gemini CLI, Warp AI) — when the model emits LaTeX math in its response, render it typeset in-place inside the block.

Is your feature request related to a problem? Please describe.

A large and growing share of Warp users run AI coding/research agents in the terminal, and many of those conversations involve math: ML derivations, statistics, optimization, numerical methods, physics. Today the agent's responses display as raw $...$ and $$...$$ strings, which is hard to read and breaks the flow of an otherwise polished agentic experience. This really slows down iteration speed for me. Same problem when the agent writes .md files (plans, notes, derivations) and the user opens them in the viewer.

For the technical / research / academic segment of Warp's user base, this would be one of the highest-leverage rendering improvements available.

Additional context

Scope and behavior

  • Recognize $...$ (inline) and $$...$$ (display) as math delimiters, matching pandoc / GitHub markdown conventions.
  • Treat \$ as a literal dollar sign (not a delimiter).
  • Closing $ followed immediately by a digit should not parse as math (so $30,000 is unaffected) — same convention pandoc uses.
  • On parse error or unsupported LaTeX, fall back to displaying the raw source unchanged. Math support should never break existing rendering.
  • KaTeX-level coverage of LaTeX is sufficient for v1; full MathJax coverage isn't required.
  • Existing shell-block, table, and code-block behavior should be unaffected.
  • Inside fenced code blocks, do not parse $...$ as math (treat as literal code).

Implementation notes (optional, for whoever picks this up)

Candidate approaches for the Rust pipeline: latex2mathml + a MathML/SVG renderer, or a bundled KaTeX WASM / CLI build producing SVG glyphs that the existing viewer renderer can draw. The terminal-block path may need a more constrained renderer than the viewer pane (line-height / inline glyph alignment matters more there).

Request

@oss-maintainers — could you consider applying a readiness label (ready-to-spec or ready-to-implement)? Happy to refine the spec or verify implementations.

Operating system (OS)

macOS

How important is this feature to you?

5 (Can't work without it!)

Warp Internal (ignore) - linear-label:39cc6478-1249-4ee7-950b-c428edfeecd1

None

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:agentAgent workflows, conversations, prompts, cloud mode, and AI-specific UI.area:editor-notebooksEditors, notebooks, markdown rendering, LSP, and code display.area:shell-terminalTerminal input/output, shell integration, prompt behavior, and block rendering.enhancementNew feature or request.repro:highThe report includes enough evidence that the issue appears highly reproducible.triagedIssue has received an initial automated triage pass.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions