Skip to content

feat(tui): LaTeX math rendering via Unicode substitution - #4973

Closed
SparkofSpike wants to merge 4 commits into
Hmbown:mainfrom
SparkofSpike:feat/math-rendering
Closed

feat(tui): LaTeX math rendering via Unicode substitution#4973
SparkofSpike wants to merge 4 commits into
Hmbown:mainfrom
SparkofSpike:feat/math-rendering

Conversation

@SparkofSpike

Copy link
Copy Markdown
Contributor

Summary

Add LaTeX math expression rendering for the TUI transcript. Math delimiters ($...$, ..., (...), [...]) are detected before markdown rendering and converted to Unicode approximations, improving readability of formulas in AI responses.

Changes

  • New file: crates/tui/src/tui/history/latex_render.rs (451 lines) — LaTeX-to-Unicode converter with 200+ symbol mappings (Greek, blackboard bold, calligraphic, relations, operators, arrows), superscript/subscript via Unicode combining chars, fractions as (a/b), sqrt, and basic integral/sum/product constructs
  • Modify: crates/tui/src/tui/history.rs — Add mod latex_render
  • Modify: crates/tui/src/tui/history/message.rs — Three integration points in streaming and full render paths

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change
  • Documentation update
  • Refactoring (no functional changes)
  • Tests

Testing

  • cargo fmt
  • cargo clippy
  • cargo test
  • Manual testing — compiled, launched, tested with various formulas

Checklist

  • Updated docs or comments as needed
  • Added or updated tests where relevant
  • Verified TUI behavior manually if UI changes
  • Harvested/co-authored credit

Related Issues

Closes #4957

@SparkofSpike
SparkofSpike requested a review from Hmbown as a code owner July 29, 2026 15:05
@SparkofSpike
SparkofSpike marked this pull request as draft July 29, 2026 15:12
@SparkofSpike
SparkofSpike force-pushed the feat/math-rendering branch from 43d77e2 to 3b33d0d Compare July 29, 2026 15:12
@Hmbown

Hmbown commented Jul 29, 2026

Copy link
Copy Markdown
Owner

Thanks for carrying this through and rebasing it onto current main. I added one maintainer hardening commit on top of your latest head after the local semantic test caught the \\mathbb{R} path: it now preserves Markdown code spans/fences, currency, escaped dollars, and unknown commands, and adds regression coverage. Local cargo fmt, all 9 focused tests, and the exact workspace clippy gate pass. Protected auto-merge is enabled so your contribution and authorship land once the refreshed matrix is green.

@Hmbown
Hmbown marked this pull request as ready for review July 29, 2026 15:28
Copilot AI review requested due to automatic review settings July 29, 2026 15:28
@Hmbown
Hmbown enabled auto-merge July 29, 2026 15:28

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

auto-merge was automatically disabled July 29, 2026 15:29

Head branch was pushed to by a user without write access

@SparkofSpike
SparkofSpike force-pushed the feat/math-rendering branch from 105825a to fe05f31 Compare July 29, 2026 15:29
@SparkofSpike

Copy link
Copy Markdown
Contributor Author

Oops, so sorry about that — I didn't see your message before force-pushing. Could you please push your commit again? Thanks! @Hmbown

@Hmbown

Hmbown commented Jul 29, 2026

Copy link
Copy Markdown
Owner

I moved the combined work to stable maintainer integration PR #4974 because the fork head was being force-updated while release CI was running. #4974 preserves your feature commits/authorship and supersedes the dead-code-only follow-up with removal of the unused helpers, so the repository stays at its 482/482 budget. I have disabled auto-merge here to avoid racing the mutable head; I’ll close this PR only after #4974 lands.

@SparkofSpike

Copy link
Copy Markdown
Contributor Author

I just saw your commit — it aligns perfectly with what I was thinking! I was actually about to handle the $ swallowing issue minutes ago. To be honest, this is one of my first times contributing to an open-source project, and the fact that we came up with the same idea independently feels amazing.
Since you're taking it from here, I'll step back for now — it's already past midnight here. I'll take a look at your code tomorrow and see if there are any features I can add. Thanks for your hard work!

@Hmbown

Hmbown commented Jul 29, 2026

Copy link
Copy Markdown
Owner

Landed through stable integration PR #4974 in merge 135001271ad563dbb298249325dc66d1146e084f, preserving your feature commits and authorship. Thank you for the contribution and the quick follow-up fixes.

@Hmbown Hmbown closed this Jul 29, 2026
@SparkofSpike
SparkofSpike deleted the feat/math-rendering branch August 1, 2026 11:06
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.

TUI does not render LaTeX math expressions - raw $...$ source displayed instead

3 participants