Repository navigation
feat(web): render LaTeX equations in chat - #16724
matuscvengros wants to merge 7 commits into
Conversation
|
Difficult to use T3 Code for heavy math work atm. Consider implementing. |
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
⛔ Files ignored due to path filters (1)
📒 Files selected for processing (2)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review. 📝 WalkthroughWalkthroughThe web chat Markdown pipeline now parses and renders inline and display math with KaTeX in both raw-HTML modes. Clipboard serialization emits rendered equations as Markdown TeX and handles partial selections. Tests cover rendering, streaming equivalence, and clipboard behavior. ChangesChat Markdown math
Priority: ⬇️ Low Estimated code review effort: 3 (Moderate) | ~25 minutes Change: Feature Sequence Diagram(s)sequenceDiagram
participant ChatMarkdown
participant remarkChatMath
participant rehypeSanitize
participant rehypeKatex
ChatMarkdown->>remarkChatMath: Parse inline and display math
ChatMarkdown->>rehypeSanitize: Sanitize authored HTML in parsed-HTML mode
rehypeSanitize->>rehypeKatex: Pass sanitized math nodes
ChatMarkdown->>rehypeKatex: Render math in literal-HTML mode
Possibly related PRs
Suggested reviewers: Merge Risk: ⚪ Minimal · up to The change adds equation rendering and TeX-preserving copy behavior. No unresolved issue in the reviewed boundaries blocks merging, subject to normal checks. Security Architecture ReviewSecurity architecture risk: 🔵 Low · up to The renderer preserves HTML sanitization and disables TeX commands that create links, images, or arbitrary HTML. A narrow disclosure risk remains: copying part of an equation can put the complete equation into rich-text clipboard data. This requires a user copy/paste action and affects content already present in the rendered message. Retained concerns
Security review detailsSecurity Blast Radius
Security Findings and Attack Paths
Trust Boundaries and Controls
Resilience and Maintainability Implications
Hardening Proposals
Caution Pre-merge checks failedPlease resolve all errors before merging. Addressing warnings is optional.
❌ Failed checks (1 error)
✅ Passed checks (4 passed)
Full details: ApprovabilityExplanation The pull request needs a maintainer's review. It adds three dependencies in
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
I second this, massive + nice implementation |
Problem
Chat displays raw TeX for
$...$and$$...$$equations, making technical explanations with fractions, subscripts and other notation difficult to read.Change
Add inline and display equation rendering with remark-math and KaTeX to the shared web/desktop chat renderer. Long display equations scroll within the message, and copying complete equations preserves their TeX source.
Keep currency, skill references, escaped dollars and code literal. Sanitize authored HTML before generating KaTeX markup.
Scope and approval
One capability in the shared web/desktop chat renderer: equation rendering with its necessary layout, streaming and clipboard behavior. Native mobile uses a separate renderer and is outside this change.
Verification
Before: raw TeX in the supplied example.
After: rendered equations in the dummy chat response.
Narrow web viewport: equations remain inside the message.
Implemented and verified with GPT-6.1-Sol through the Codex harness in T3 Code.