pi-terminal-math

内容来源:README.md(说明文档) · 原始地址 · 查看安装指南

原始内容

pi-terminal-math

pi-terminal-math renders LaTeX equations as terminal-native text in pi assistant messages. It uses Unicode characters and ordinary terminal cells rather than image protocols, so equations remain readable in terminal transcripts.

Install

pi install npm:pi-terminal-math

Restart pi or run /reload after installation.

Usage

Math rendering starts off in each session. Enable it when you need to read LaTeX output:

/math on       Enable rendering
/math off      Disable rendering
/math          Toggle rendering

The footer shows ∑ math while rendering is enabled.

Write equations with standard LaTeX delimiters:

Inline: $x^2 + y^2 = z^2$

Display: $$CC_{\mathrm{norm}} = \frac{CC_{\mathrm{abs}}}{CC_{\max}}$$

The extension renders common notation directly in assistant output:

x² + y² = z²
         CC
           abs
CC     = ─────
  norm   CC
           max

It supports common fractions, roots, sums, limits, subscripts, superscripts, Greek letters, and operators. Wide expressions wrap to the available terminal width. Incomplete, malformed, or unsupported LaTeX remains visible as source text instead of interrupting the transcript.

Math inside inline code or fenced code blocks is left unchanged. Currency-like dollar expressions are not treated as math.

Scope

Rendering is available in pi's interactive TUI and defaults to off. Enabling it loads MathJax and adds brief prompt guidance encouraging display math for substantial equations. The extension does not modify stored assistant messages or add duplicate preview messages.

Development

npm install
npm test
npm run check

License

MIT