Attributes preserves MathJax's four attribute layers: explicit, inherited,
per-node defaults, and global math attributes. Clone returns an independent shallow copy.(*Attributes) DefaultNames() []string Defaults returns the per-kind default map. Explicit returns the mutable explicit-attribute map.(*Attributes) ExplicitNames() []string Get resolves explicit, inherited, default, and global layers in that order. GetDefault resolves the per-kind default and global layers. GetExplicit returns only an explicitly set value. GetInherited resolves the inherited layer and its default/global prototypes.(*Attributes) GlobalNames() []string Globals returns the global math-attribute map. HasDefault reports whether name has a kind or global default. Inherited returns the mutable inherited-attribute map.(*Attributes) InheritedNames() []string IsSet reports whether name is explicit or directly inherited. Set sets an explicit attribute. SetInherited sets an inherited value. SetList sets explicit attributes in the source map's insertion order.
func NewAttributes(defaults, global *ordered.Map[Property]) *Attributes
func (*Attributes).Clone() *Attributes
Factory constructs nodes with registered kind definitions and shared global
math attributes. It is intentionally small so parser and layout packages can
evolve independently. Create constructs kind and links children. CreateFencedNodes ports MmlMfenced.addFakeNodes/fakeNode. Its caller must
apply the original incoming inheritance context to the returned operators,
rather than copying the resolved attributes of their mfenced parent. Definition returns a registered definition. Globals returns the shared global math-attribute map. Register registers or replaces a node definition. Text constructs an internal text node.
func NewFactory() *Factory
func NewMathJaxFactory() *Factory
FencedNodes are MmlMfenced's non-authored operator nodes. A non-nil value
distinguishes an initialized fence with no operators from one whose MML
inheritance pass has not run. These nodes do not participate in Walk/Find.Close*NodeOpen*NodeSeparators[]*Node
Node is one node in MathJax's internal MathML tree. Kind-specific state that
is not an attribute lives in Properties.Attributes*AttributesChildren[]*NodeFenced*FencedNodesFlagsFlagsKindstring OperatorLspace/OperatorRspace are MmlMo's dictionary-derived defaults,
distinct from explicit/inherited lspace/rspace attributes (in ems). OperatorLspace/OperatorRspace are MmlMo's dictionary-derived defaults,
distinct from explicit/inherited lspace/rspace attributes (in ems).Parent*NodePrevClassTeXClassPrevLevelintProperties*ordered.Map[Property]TeXClassTeXClassTextstring AppendChild appends child and returns it. ChildIndex returns child's index, or -1 if child is absent. Clone deep-copies n without retaining a parent pointer. Core returns the child containing an embellished operator, or n. CoreMO follows embellished children to their core mo node. Find returns all descendants, including n, whose kind matches. IsKind reports whether n has kind. ParentNode returns the semantic parent, skipping inferred/not-parent nodes. Property returns internal node state. RemoveChild removes child and returns an error when it is absent. RemoveProperty removes internal node state. ReplaceChild replaces oldChild and returns an error when it is absent. SetChildren replaces n's children and maintains parent pointers. SetProperty sets internal node state. Walk visits n and its descendants in pre-order.
func NewNode(kind string, defaults, global *ordered.Map[Property], children ...*Node) *Node
func NewText(text string) *Node
func (*Factory).Create(kind string, children ...*Node) *Node
func (*Factory).Text(text string) *Node
func (*Node).AppendChild(child *Node) *Node
func (*Node).Clone() *Node
func (*Node).Core() *Node
func (*Node).CoreMO() *Node
func (*Node).Find(kind string) []*Node
func (*Node).ParentNode() *Node
func github.com/d2lang/mathjax-go/internal/pipeline.Compiler.Compile(tex string, display bool) (*Node, error)
func github.com/d2lang/mathjax-go/internal/tex.(*Compiler).Compile(source string, display bool) (*Node, error)
func NewNode(kind string, defaults, global *ordered.Map[Property], children ...*Node) *Node
func (*Factory).Create(kind string, children ...*Node) *Node
func (*Factory).CreateFencedNodes(node *Node)
func (*Node).AppendChild(child *Node) *Node
func (*Node).ChildIndex(child *Node) int
func (*Node).RemoveChild(child *Node) error
func (*Node).ReplaceChild(newChild, oldChild *Node) error
func (*Node).SetChildren(children []*Node)
func github.com/d2lang/mathjax-go/internal/pipeline.Typesetter.Typeset(root *Node, options pipeline.Options) (string, error)
func github.com/d2lang/mathjax-go/internal/svg.(*Typesetter).Typeset(root *Node, options pipeline.Options) (string, error)
Property is a MathML attribute or internal-property value.
IsInherit reports whether value is the Inherit sentinel.
MactionSelectionNumber applies the numeric coercions used by the source
maction selected getter to supported scalar attribute values.
NewAttributes constructs an attribute set. Inputs are cloned; nil inputs are
treated as empty maps.
NewFactory returns an empty factory.
NewMathJaxFactory returns the complete pinned MathJax 3.2.2 registry.
Each factory owns immutable definitions; Create clones their attribute maps.
NewNode creates a node with empty attribute and property maps.
NewText creates an internal text node.
TeXSpacing returns MathJax's named space between two TeX atom classes.
script suppresses entries marked as display/text-style-only. Negative table
entries are the ones retained in scripts in MathJax's TEXSPACE encoding.
Package-Level Variables (total 2)
Inherit marks a default that resolves directly from the math node's global
attributes, matching MathJax's _inherit_ sentinel.
UnboundedArity is the integer representation used by the Go tree for
MathJax's JavaScript Infinity arity. Negative one remains reserved for the
inferred-mrow content model.
The pages are generated with Goldsv0.8.7. (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu.
PR and bug reports are welcome and can be submitted to the issue list.
Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds.