Skip to content

Render standalone display math in the TUI - #45612

Merged
copyberry[bot] merged 1 commit into
mainfrom
copyberry/codex-internal-to-codex-oss/ab54675f2e27a243f5d7165c76d9d7355f9fabd1
Sep 15, 2026
Merged

copyberry[bot] merged 1 commit into
mainfrom
copyberry/codex-internal-to-codex-oss/ab54675f2e27a243f5d7165c76d9d7355f9fabd1

Conversation

@copyberry

@copyberry copyberry Bot commented Sep 15, 2026 •

Copy link
Copy Markdown

Render standalone display math in the TUI

Why

The TUI renders supported inline math as Unicode but leaves display equations to ordinary Markdown rendering. Display fractions need spatial layout, and streamed equations must remain mutable while their closing delimiter is pending.

What changed

  • Render supported standalone $$...$$ and \[...\] equations as Unicode, with stacked fractions and aligned baselines.
  • Fall back to source for unsupported expressions, nested fractions, and spatial layouts that exceed the available width or occur inside lists or block quotes.
  • Preview unfinished display math as wrapped source and hold it out of scrollback within the conversion budget, then render it when closed.
  • Preserve display delimiter boundaries across incremental rendering and bound lookahead for rejected openers so shell echo $$ does not retain the entire response.

Testing

Add snapshots and regression tests for display layouts, narrow widths, literal fallback, streaming closure, resize reflow, raw source preservation, shell dollars, and bounded incremental rendering.

## Why

The TUI renders supported inline math as Unicode but leaves display equations to ordinary Markdown rendering. Display fractions need spatial layout, and streamed equations must remain mutable while their closing delimiter is pending.

## What changed

- Render supported standalone `$$...$$` and `\[...\]` equations as Unicode, with stacked fractions and aligned baselines.
- Fall back to source for unsupported expressions, nested fractions, and spatial layouts that exceed the available width or occur inside lists or block quotes.
- Preview unfinished display math as wrapped source and hold it out of scrollback within the conversion budget, then render it when closed.
- Preserve display delimiter boundaries across incremental rendering and bound lookahead for rejected openers so shell `echo $$` does not retain the entire response.

## Testing

Add snapshots and regression tests for display layouts, narrow widths, literal fallback, streaming closure, resize reflow, raw source preservation, shell dollars, and bounded incremental rendering.

GitOrigin-RevId: ab54675f2e27a243f5d7165c76d9d7355f9fabd1
@copyberry
copyberry Bot force-pushed the copyberry/codex-internal-to-codex-oss/ab54675f2e27a243f5d7165c76d9d7355f9fabd1 branch from b44b134 to a8964cb Compare September 15, 2026 05:44
@copyberry
copyberry Bot merged commit a8964cb into main Sep 15, 2026
@copyberry
copyberry Bot deleted the copyberry/codex-internal-to-codex-oss/ab54675f2e27a243f5d7165c76d9d7355f9fabd1 branch September 15, 2026 05:44
@github-actions github-actions Bot locked and limited conversation to collaborators Sep 15, 2026

This branch was previously deployed

1 inactive deployment
issue-triage — a8964cb1 Deployed Sep 15, 2026 by SCIMMS via Generate label suggestions #45669
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.