Documentation
¶
Overview ¶
Package mathml provides a Goldmark extension that parses GitHub-style mathematical expressions and renders them server-side as native MathML.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( KindInline = ast.NewNodeKind("MathInline") KindBlock = ast.NewNodeKind("MathBlock") )
Functions ¶
func Assets ¶ added in v0.2.0
Assets returns the Temml stylesheet and its small supplemental font as an fs.FS rooted at the assets directory. Web applications can serve it with http.FileServerFS. The stylesheet is optional for basic MathML rendering but works around browser differences and improves accents and script glyphs.
Types ¶
type ErrorReporter ¶ added in v0.3.0
type Inline ¶
type Inline struct {
ast.BaseInline
Equation []byte
Display bool
}
Inline is an inline mathematical expression. Display is true for an expression delimited by double dollar signs in a paragraph.
type Option ¶ added in v0.3.0
type Option interface {
// contains filtered or unexported methods
}
Option configures the extension.
func WithErrorFallback ¶ added in v0.3.0
func WithErrorFallback(reporter ErrorReporter) Option
WithErrorFallback makes rendering continue when Temml rejects an expression. Invalid inline expressions are emitted as visible warning spans and invalid display expressions as warning blocks, with the original expression safely escaped. If reporter is non-nil, it is called for each rejected expression as an out-of-band notification and does not affect the rendered output. Without this option, rendering stops and returns the error.
type RenderError ¶ added in v0.4.0
RenderError reports an expression that Temml could not render. It can be identified with errors.As.
func (*RenderError) Error ¶ added in v0.4.0
func (e *RenderError) Error() string
func (*RenderError) Unwrap ¶ added in v0.4.0
func (e *RenderError) Unwrap() error