A Rust CLI tool that renders LaTeX math expressions as ASCII art in markdown files.
- Inline math:
$x^2$→x² - Display math:
$$\frac{a}{b}$$→ multi-line ASCII art fractions - Multiline display math:
$$ ... \\\\ ... $$→ vertically stacked equations - Full Unicode support: Greek letters, operators, sub/superscripts
- Scaling delimiters:
\left( ... \right)scales to content height - Limit display:
\lim_{x \to a}shows limit below "lim" - Blackboard bold:
\mathbb{R},\mathbb{N}, etc. - Pipe to glow:
calcifer file.md | gloworcalcifer --glow file.md
cargo install --path .Or build from source:
cargo build --release
# Binary at target/release/calcifer# Render a file
calcifer README.md
# Pipe to glow
calcifer README.md | glow
# Auto-pipe to glow
calcifer --glow README.md
# Read from stdin
echo '$\alpha + \beta = \gamma$' | calcifer| LaTeX | Rendered |
|---|---|
$x^2$ |
x² |
$x_i$ |
xᵢ |
$\alpha + \beta$ |
α + β |
$\frac{a}{b}$ |
a/b |
$\sqrt{x}$ |
√(x) |
$$\frac{a + b}{c}$$
Renders as:
a + b
─────
c
$$\sum_{i=1}^{n} i^2$$
Renders as:
n
∑ i²
i=1
$$\lim_{x \to 0} \frac{\sin x}{x} = 1$$
Renders as:
sin x
lim ────── = 1
x → 0 x
$$\left( \frac{a}{b} \right)$$
Renders as:
⎛ a ⎞
⎜ ─ ⎟
⎝ b ⎠
Greek letters: \alpha, \beta, \gamma, \delta, \epsilon, \theta, \lambda, \mu, \pi, \sigma, \omega, and uppercase variants
Operators: \sum, \prod, \int, \bigcup, \bigcap
Relations: \leq, \geq, \neq, \approx, \equiv, \in, \subset, \supset
Arrows: \rightarrow, \leftarrow, \Rightarrow, \Leftrightarrow, \mapsto, \to
Functions: \sin, \cos, \tan, \log, \ln, \exp, \lim, \max, \min
Structures: \frac{}{}, \sqrt{}, \sqrt[n]{}, ^{} (superscript), _{} (subscript)
Delimiters: \left( ... \right), \left[ ... \right], \left\{ ... \right\}, \langle, \rangle, \lceil, \rceil, \lfloor, \rfloor
Environments: matrix, pmatrix, bmatrix, Bmatrix, vmatrix, Vmatrix, array, cases, align, aligned
Number sets: \mathbb{R}, \mathbb{N}, \mathbb{Z}, \mathbb{Q}, \mathbb{C}, etc.
Misc: \infty, \partial, \nabla, \forall, \exists, \emptyset, \pm, \times, \cdot
Spacing: \,, \;, \:, \!, \quad, \qquad
See SYMBOLS.md for the complete list of 300+ supported symbols.
- Parse markdown with pulldown-cmark (with math extension)
- Tokenize LaTeX expressions
- Build an AST (fractions, sums, roots, etc.)
- Render to a 2D character grid with proper baseline alignment
- Output as markdown with math replaced by ASCII art in code blocks
MIT