Documentation
¶
Overview ¶
Package goldmark provides a goldmark extension for rendering LaTeX math in the terminal using termtex.
It recognizes $...$ for inline math and $$...$$ for display math blocks, parsing them into custom AST nodes that are rendered by calling termtex.
Usage with goldmark directly:
md := goldmark.New(goldmark.WithExtensions(goldmark.NewMathExtension())) md.Convert(source, os.Stdout)
Usage with glamour (requires building a custom renderer — see example/):
// See the example program for the full glamour integration pattern.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var KindMathBlock = ast.NewNodeKind("MathBlock")
KindMathBlock is the AST node kind for display math ($$...$$).
var KindMathInline = ast.NewNodeKind("MathInline")
KindMathInline is the AST node kind for inline math ($...$).
Functions ¶
This section is empty.
Types ¶
type MathExtension ¶
MathExtension is a goldmark extension that adds LaTeX math support. It recognizes $...$ for inline math and $$...$$ for display math, rendering them with termtex.
func NewMathExtension ¶
func NewMathExtension() *MathExtension
NewMathExtension creates a new math extension with the default (zero-value) style.
func NewMathExtensionWithStyle ¶
func NewMathExtensionWithStyle(style termtex.Style) *MathExtension
NewMathExtensionWithStyle creates a new math extension with custom style.
func (*MathExtension) Extend ¶
func (e *MathExtension) Extend(m goldmark.Markdown)
Extend implements goldmark.Extender.
type MathInline ¶
type MathInline struct {
ast.BaseInline
Expression []byte
}
MathInline represents an inline math expression.
func (*MathInline) Dump ¶
func (n *MathInline) Dump(source []byte, level int)
func (*MathInline) Kind ¶
func (n *MathInline) Kind() ast.NodeKind