See math as it is meant to be seen. MathRender renders LaTeX formulas from Codex and Claude Code responses in a VS Code side panel powered by KaTeX.
Instead of reading raw $$\int_0^1 x^2 dx$$ in the terminal, you get properly typeset mathematics in real time.
Features
- Codex + Claude Code support - automatic hook installation plus a zero-click Codex transcript fallback
- Real-time rendering - formulas appear as agent responses finish
- Full markdown support - text, headings, code blocks, tables, and math together
- Display and inline math -
$$...$$, $...$, \[...\], and \(...\)
- Session history - scroll back through captured formula responses
- Search - filter responses by text or formula content
- Copy source - copy raw LaTeX/markdown with one click
- Pause/Resume - temporarily stop capturing without closing the panel
- Zero Python package dependencies - the hook uses Python stdlib only
How It Works
Codex or Claude Code responds with formulas
|
Codex transcript watcher or Stop hook runs
|
MathRender detects LaTeX outside code blocks
|
Local delivery to the VS Code extension
|
WebView panel renders markdown + KaTeX
The extension runs a lightweight HTTP server inside VS Code. Codex responses are also picked up from local Codex session transcripts while the panel is open, which avoids depending on hook trust for the zero-click path. Hook scripts still send formula-bearing assistant responses to the local server for Claude Code and compatible Codex sessions. No external browser window is required.
Quick Start
1. Install the extension
Install from VS Code Marketplace, then open the command palette.
2. Open the panel
Run:
MathRender: Show Panel
On activation, MathRender automatically copies its hook script to ~/.mathrender/hook_send_formulas.py and installs supported agent hooks:
- Codex:
~/.codex/hooks.json
- Claude Code:
~/.claude/settings.json
Codex may still require hook trust review through /hooks before running a newly installed or changed hook. MathRender installs the hook automatically; Codex controls that security review. MathRender's Codex transcript watcher runs separately from hook trust and starts when the panel is open.
Commands
Open with Ctrl+Shift+P and type MathRender.
| Command |
Description |
MathRender: Show Panel |
Open the formula panel and start the server |
MathRender: Enable |
Same as Show Panel |
MathRender: Disable |
Stop the server and close the panel |
MathRender: Status |
Show server, hook, history, and pause state |
MathRender: Send Test Formula |
Inject a test formula without Codex or Claude Code |
Settings
Open with Ctrl+, and search MathRender.
| Setting |
Default |
Description |
mathrender.port |
18573 |
Port for the local HTTP server. Reopen the panel after changing it. |
mathrender.macros |
{} |
Custom KaTeX macros merged with built-ins. Example: {"\\vec": "\\mathbf{#1}"} |
Built-in macros: \R \N \Z \C \Q.
Requirements
- VS Code 1.85+
- Python 3.10+
- Codex and/or Claude Code
Links
License
MIT
This is an independent community project. It is not affiliated with, endorsed by, or officially connected to OpenAI, Anthropic, or the Codex/Claude Code teams.