-
Notifications
You must be signed in to change notification settings - Fork 2.6k
feat: add LaTeX math equation rendering in chat window (#4258) #4786
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
hannesrudolph
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for implementing LaTeX math rendering support! This is a valuable feature that many users have been requesting.
Overall Assessment
The implementation is clean and follows existing patterns in the codebase. The integration with the markdown rendering pipeline using remark-math and rehype-katex is well done, and the styling appropriately uses VSCode theme variables.
Summary of Suggestions
I've left several inline comments covering:
- Bundle size considerations due to KaTeX's ~280KB footprint
- Error handling for invalid LaTeX syntax
- Security options to limit potentially dangerous LaTeX commands
- Performance impact of font loading
- Accessibility and configurability improvements
- Test coverage to ensure stability
None of these are blocking issues, but addressing them would make this feature more robust and maintainable.
Testing Verification
Based on your PR description, you've tested:
- ✅ Inline math (
$E = mc^2$) - ✅ Display math blocks
- ✅ Complex equations with various symbols
- ✅ CSP configuration for font loading
Great work on this implementation! The feature works as described and will be a welcome addition for users who need mathematical notation in their conversations.
Added a new setting `disableDiffVisualization` that allows users to disable the diff view when editing files. When enabled, files will open directly in the editor instead of showing a side-by-side diff view. This helps prevent Language Server Protocol (LSP) crashes that can occur with very large files, particularly affecting C# developers. The changes made by Roo are still visible in the chat window. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
- Moved disableDiffVisualization from global settings to experimental settings - Updated all references to access it through experiments instead - Fixed test cases to include the new experiment - Updated translations to reflect experimental nature - Setting now properly affects ALL edit tools (write_to_file, apply_diff, insert_content, search_and_replace) 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
- Add KaTeX dependencies for LaTeX rendering
- Integrate remark-math and rehype-katex plugins in MarkdownBlock
- Add KaTeX CSS styling for proper equation display
- Update CSP to allow KaTeX font loading with data: URLs
- Configure Vite to handle KaTeX font assets
- Update .vscodeignore to include KaTeX fonts in extension bundle
Users can now write LaTeX equations using standard syntax:
- Inline math: = mc^2$
- Display math: 95668\int_{-\infty}^{\infty} e^{-x^2} dx = \sqrt{\pi}95668
Fixes #4258
- Removed DISABLE_DIFF_VISUALIZATION from experiment types and configurations - Removed disableDiffVisualization parameter from Task and DiffViewProvider - Removed all DISABLE_DIFF_VISUALIZATION translations from locale files - Removed disable-diff-visualization changeset - Keep only LaTeX rendering related changes in this PR
2dc38cd to
9c9f030
Compare
daniel-lxs
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Co-authored-by: Claude <[email protected]> Co-authored-by: Daniel Riccio <[email protected]>


Description
Fixes #4258
This PR adds LaTeX math equation rendering support to the Roo Code chat window, allowing users to display mathematical equations beautifully formatted using KaTeX.
Changes Made
katex,rehype-katex,remark-math) to render LaTeX equationsMarkdownBlock.tsxdata:URLs.vscodeignoreto include KaTeX fonts in the extension bundleTesting
Tested with various LaTeX equations:
$E = mc^2$renders correctly inline$$\int_{-\infty}^{\infty} e^{-x^2} dx = \sqrt{\pi}$$renders as centered block equationsVerification of Acceptance Criteria
Screenshots
As shown in the issue, LaTeX equations now render properly in chat messages:
Checklist
Important
Adds LaTeX math rendering in chat using KaTeX, updates dependencies, and configures asset handling and security policies.
MarkdownBlock.tsx.katex,rehype-katex,remark-mathtopackage.json.ClineProvider.tsto allowdata:URLs for fonts.vite.config.tsto handle KaTeX font assets..vscodeignoreto include KaTeX fonts in the extension bundle.index.cssfor styling equations.This description was created by
for 161eb33. You can customize this summary. It will automatically update as commits are pushed.