[FEATURE] Add LaTeX / Math formula rendering support to Claude Code for VS Code using KaTeX
Preflight Checklist
- [x] I have searched existing requests and this feature hasn't been requested yet
- [x] This is a single feature request (not multiple features)
Problem Statement
The Claude Code VS Code extension's chat panel (Webview) renders Markdown well (bold, lists, code blocks with highlighting), but does not render LaTeX/Math formulas. Claude frequently outputs formulas using standard delimiters like $...$ (inline) or $$...$$ / \[...\] (display), but they appear as plain text or unparsed code blocks.
This is a significant limitation for users in math-heavy domains (e.g., physics, engineering, data science, ML theory, education), as formulas become hard to read compared to claude.ai web version (which supports LaTeX rendering in preview).
Proposed Solution
Integrate a lightweight KaTeX renderer into the chat Webview:
- Use KaTeX (preferred over MathJax for performance/size in Webview)
- Automatically detect and render LaTeX in streamed Markdown responses
- Support both inline (
$...$) and display ($$...$$or\[...\]) modes - Handle common environments (e.g., align, cases, matrix)
Implementation sketch (high-level):
- Bundle KaTeX (via CDN or npm in extension build)
- In the Webview's HTML/JS (likely in src/webview or similar):
- After receiving streamed Markdown, use markdown-it + markdown-it-katex plugin (or direct KaTeX render)
- Or post-process the rendered HTML to find math delimiters and replace with KaTeX output
- Respect VS Code Webview CSP: use
vscode.Urifor local assets if bundled - Add optional setting: “Claude Code: Enable Math Rendering” (default: true)
This would align the extension experience closer to the web version and greatly improve usability for scientific/STEM users.
Alternative Solutions
_No response_
Priority
Medium - Would be very helpful
Feature Category
Other
Use Case Example
_No response_
Additional Context
_No response_
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗