pi-rich-renderer
extensionmaintainedPi extension that renders LaTeX formulas as terminal images while preserving original LLM context.
by — · v0.1.0 · published 1mo ago
$ pi install npm:pi-rich-rendererSignals
Download trend
305 downloads · last 12 weeks (weekly)
README
pi-rich-renderer
Local Pi extension that renders LaTeX formulas in assistant replies as tight terminal images.
It does not send rendered images to the model. Assistant context is restored to the original Markdown before the next LLM call.
Requirements
- Pi coding agent
- A TeX installation with
latexanddvipng
On macOS with MacTeX these are usually available at /Library/TeX/texbin.
Install
From npm:
pi install npm:pi-rich-renderer
For local development, add the extension path to ~/.pi/agent/settings.json:
{
"extensions": ["~/.pi/agent/extensions/pi-rich-renderer/index.ts"]
}
Then run /reload in Pi.
Configuration
Configure in ~/.pi/agent/settings.json or project-local .pi/settings.json:
{
"richRenderer": {
"imageScale": 0.5,
"cacheTtlMs": 604800000
}
}
imageScale: terminal display scale for rendered formula images. Default0.5.cacheTtlMs: delete cached PNGs older than this many milliseconds on extension load. Default604800000(7 days). Set0to disable cleanup.
Project .pi/settings.json overrides global settings.
Cache
Rendered PNGs are cached in:
~/.pi/cache/rich-renderer/
Cache keys are SHA-256 hashes of formula content, foreground color, and DPI.
Notes
- Code blocks are not rendered as images; Pi's native Markdown code rendering is preserved.
- Formulas inside fenced code blocks are ignored.
- The extension rewrites only the displayed assistant message; the next model context receives the original Markdown.