pi-rich-renderer
Pi extension that renders LaTeX formulas as terminal images while preserving original LLM context.
Package details
Install pi-rich-renderer from npm and Pi will load the resources declared by the package manifest.
$ pi install npm:pi-rich-renderer- Package
pi-rich-renderer- Version
0.1.0- Published
- Jun 24, 2026
- Downloads
- 216/mo · 34/wk
- Author
- dbydd
- License
- MIT
- Types
- extension
- Size
- 15.6 KB
- Dependencies
- 0 dependencies · 2 peers
Pi manifest JSON
{
"extensions": [
"./index.ts"
]
}Security note
Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.
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.