treeblood

package module
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 5, 2025 License: MIT Imports: 8 Imported by: 4

README

goldmark-treeblood

goldmark-treeblood is an extension for goldmark that renders $LaTeX$ expressions as MathML, an open web standard for describing mathematical notation. Unlike MathJax or KaTeX, TreeBlood runs server-side, is written in pure Go, and has no dependencies outside the Go standard library.

Usage

To use goldmark-treeblood, import the goldmark-treeblood package

import "github.com/wyatt915/goldmark-treeblood"

and include treeblood.MathML in the list of extensions passed to goldmark

goldmark.New(
  goldmark.WithExtensions(
    // ...
    treeblood.MathML(),
  ),
  // ...
).Convert(src, out)

This extension respects both TeX-style delimiters $...$ and $$...$$ as well as their more modern AMS $LaTeX$ counterparts \(...\) and \[...\].

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	KindMathInline = ast.NewNodeKind("MathInline")
	KindMathBlock  = ast.NewNodeKind("MathBlock")
)

Functions

func MathML

func MathML(macros ...map[string]string) goldmark.Extender

func NewMathRenderer

func NewMathRenderer(p *treeblood.Pitziil) renderer.NodeRenderer

NewMathRenderer returns a new MathRenderer.

func NewTexBlockRegionParser

func NewTexBlockRegionParser() *texBlockRegionParser

func NewTexInlineRegionParser

func NewTexInlineRegionParser() *texInlineRegionParser

Types

type MathRenderer

type MathRenderer struct {
	// contains filtered or unexported fields
}

func (*MathRenderer) RegisterFuncs

func (r *MathRenderer) RegisterFuncs(reg renderer.NodeRendererFuncRegisterer)

RegisterFuncs registers the renderer with the Goldmark renderer.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL