Documentation
¶
Overview ¶
Package mathjax converts TeX math to SVG without a JavaScript runtime.
Its compatibility target is the custom MathJax 3.2.2 component embedded by D2. Render uses that component's display-mode, 16-pixel em, 8-pixel ex, and uncached-font-path defaults.
Index ¶
Constants ¶
const CompatibilityVersion = "3.2.2"
CompatibilityVersion is the upstream MathJax version whose behavior this module preserves.
Variables ¶
This section is empty.
Functions ¶
func Measure ¶
Measure renders TeX with DefaultOptions and returns its rounded-up width and height in pixels. It preserves D2's MathJax 3.2.2 measurement contract: the serialized SVG dimensions are expressed in ex units and one ex is 8 pixels.
Types ¶
type FontCacheMode ¶
type FontCacheMode uint8
FontCacheMode controls how glyph paths are represented in rendered SVG. MathJax-go initially supports FontCacheNone, which is the mode used by D2's frozen MathJax 3.2.2 component.
const ( // FontCacheNone emits an independent SVG path for each glyph occurrence. FontCacheNone FontCacheMode = iota )
type Options ¶
type Options struct {
// Em is the em size in pixels used to resolve relative lengths.
Em float64
// Ex is the ex size in pixels used to resolve relative lengths and report
// the serialized SVG dimensions.
Ex float64
// Display selects display math when true and inline math when false.
Display bool
// FontCache controls SVG glyph reuse. Only FontCacheNone is supported.
FontCache FontCacheMode
}
Options controls TeX-to-SVG conversion.
func DefaultOptions ¶
func DefaultOptions() Options
DefaultOptions returns the options used by D2's frozen MathJax 3.2.2 integration.
Directories
¶
| Path | Synopsis |
|---|---|
|
internal
|
|
|
font
Package font provides the MathJax 3.2.2 TeX font metrics, SVG outlines, variant fallback rules, and stretchy-delimiter data.
|
Package font provides the MathJax 3.2.2 TeX font metrics, SVG outlines, variant fallback rules, and stretchy-delimiter data. |
|
jscompat
Package jscompat implements JavaScript numeric behavior that is observable in MathJax 3.2.2's SVG output.
|
Package jscompat implements JavaScript numeric behavior that is observable in MathJax 3.2.2's SVG output. |
|
layout
Package layout implements MathJax's common TeX layout rules.
|
Package layout implements MathJax's common TeX layout rules. |
|
mhchem
Package mhchem ports mhchemparser 4.1.1, the parser used by MathJax 3.2.2.
|
Package mhchem ports mhchemparser 4.1.1, the parser used by MathJax 3.2.2. |
|
mml
Package mml defines MathJax's internal MathML tree representation.
|
Package mml defines MathJax's internal MathML tree representation. |
|
oracle
Package oracle runs an optional, frozen JavaScript differential oracle from tests.
|
Package oracle runs an optional, frozen JavaScript differential oracle from tests. |
|
ordered
Package ordered provides deterministic insertion-ordered string maps.
|
Package ordered provides deterministic insertion-ordered string maps. |
|
pipeline
Package pipeline defines the narrow contracts between the TeX parser, MathML tree, and SVG output stages.
|
Package pipeline defines the narrow contracts between the TeX parser, MathML tree, and SVG output stages. |
|
svg
Package svg implements MathJax 3.2.2's SVG output jax.
|
Package svg implements MathJax 3.2.2's SVG output jax. |
|
tex
Package tex is a source-shaped Go port of MathJax 3.2.2's TeX input jax.
|
Package tex is a source-shaped Go port of MathJax 3.2.2's TeX input jax. |
|
tex/extensions/cancel
Package cancel describes MathJax 3.2.2's TeX cancel extension.
|
Package cancel describes MathJax 3.2.2's TeX cancel extension. |
|
tex/extensions/color
Package color ports MathJax 3.2.2's TeX color extension.
|
Package color ports MathJax 3.2.2's TeX color extension. |
|
tex/extensions/enclose
Package enclose describes MathJax 3.2.2's TeX enclose extension.
|
Package enclose describes MathJax 3.2.2's TeX enclose extension. |
|
tex/extensions/gensymb
Package gensymb describes MathJax 3.2.2's TeX gensymb extension.
|
Package gensymb describes MathJax 3.2.2's TeX gensymb extension. |
|
tex/extensions/spec
Package spec defines dependency-free TeX extension registration data.
|
Package spec defines dependency-free TeX extension registration data. |