math

package
v0.0.0-...-e61ee7f Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var KindBlock = ast.NewNodeKind("MathBlock")

KindBlock is the node kind for math blocks

View Source
var KindInline = ast.NewNodeKind("MathInline")

KindInline is the kind for math inline

Functions

func NewBlockParser

func NewBlockParser(parseDollars, parseSquare bool) parser.BlockParser

NewBlockParser creates a new math BlockParser

func NewBlockRenderer

func NewBlockRenderer(renderInternal *nocturnal.RenderInternal) renderer.NodeRenderer

NewBlockRenderer creates a new renderer for math Blocks

func NewInlineBracketParser

func NewInlineBracketParser() parser.InlineParser

func NewInlineDollarParser

func NewInlineDollarParser() parser.InlineParser

func NewInlineRenderer

func NewInlineRenderer(renderInternal *nocturnal.RenderInternal) renderer.NodeRenderer

NewInlineRenderer returns a new renderer for inline math

Types

type Block

type Block struct {
	ast.BaseBlock
	Dollars bool
	Indent  int
	Closed  bool
	Inline  bool
}

Block represents a display math block e.g. $$...$$ or \[...\]

func NewBlock

func NewBlock(dollars bool, indent int) *Block

NewBlock creates a new math Block

func (*Block) Dump

func (n *Block) Dump(source []byte, level int)

Dump dumps the block to a string

func (*Block) IsRaw

func (n *Block) IsRaw() bool

IsRaw returns true as this block should not be processed further

func (*Block) Kind

func (n *Block) Kind() ast.NodeKind

Kind returns KindBlock for math Blocks

type BlockRenderer

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

BlockRenderer represents a renderer for math Blocks

func (*BlockRenderer) RegisterFuncs

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

RegisterFuncs registers the renderer for math Blocks

type Extension

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

Extension is a math extension

func NewExtension

func NewExtension(renderInternal *nocturnal.RenderInternal, opts ...Options) *Extension

NewExtension creates a new math extension with the provided options

func (*Extension) Extend

func (e *Extension) Extend(m goldmark.Markdown)

Extend extends goldmark with our parsers and renderers

type Inline

type Inline struct {
	ast.BaseInline
}

Inline struct represents inline math e.g. $...$ or \(...\)

func NewInline

func NewInline() *Inline

NewInline creates a new ast math inline node

func (*Inline) Dump

func (n *Inline) Dump(source []byte, level int)

Dump renders this inline math as debug

func (*Inline) Inline

func (n *Inline) Inline()

Inline implements Inline.Inline.

func (*Inline) IsBlank

func (n *Inline) IsBlank(source []byte) bool

IsBlank returns if this inline node is empty

func (*Inline) Kind

func (n *Inline) Kind() ast.NodeKind

Kind returns KindInline

type InlineRenderer

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

InlineRenderer is an inline renderer

func (*InlineRenderer) RegisterFuncs

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

RegisterFuncs registers the renderer for inline math nodes

type Options

type Options struct {
	Enabled           bool
	ParseDollarInline bool
	ParseDollarBlock  bool
	ParseSquareBlock  bool
}

Jump to

Keyboard shortcuts

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