katex_dart 0.1.1
katex_dart: ^0.1.1 copied to clipboard
A pure-Dart port of KaTeX. Parses LaTeX math to a backend-agnostic box tree and serializes it to SVG — no Flutter dependency.
Changelog #
0.1.1 #
- Bump
argsto ^2.7.0,metato ^1.18.3
0.1.0 #
Initial release. A fresh pure-Dart port of KaTeX — no Flutter dependency.
- Pipeline: Lexer → MacroExpander → Parser → parse-node AST → builders → backend-agnostic box tree → SVG.
- Public API:
renderToBox(tex, {options})andrenderToSvg(tex, {options})+KatexOptions. - CLI:
dart run katex_dart "\frac{a}{b}"emits self-contained SVG. - Coverage: fractions, sub/superscripts (+ primes), roots (+ index), big operators
(
\sum/\int/\prod/\oint/\bigcup) with limits/nolimits,\left…\rightand sized delimiters, accents (incl. stretchy\widehat/\vec/\overrightarrow), fonts (\mathbf/\mathbb/\mathcal/…), colors, sizing/styling, spacing, and environments (matrix/pmatrix/bmatrix/aligned/cases). - Verified against original KaTeX (pinned 0.17.0): box dimensions match the KaTeX oracle on the full test gallery within tolerance (most exactly).
- Vendored KaTeX fonts (SIL OFL) embedded in SVG output via
@font-face.
Stretchy delimiters/accents beyond the Size4 glyph and the full macro set are incremental follow-ups.