directive

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var KindDirective = ast.NewNodeKind("Directive")

Functions

This section is empty.

Types

type InlineParser

type InlineParser struct {
}

func (*InlineParser) Parse

func (*InlineParser) Parse(parent ast.Node, block text.Reader, pc parser.Context) ast.Node

Parse implements parser.InlineParser.

func (*InlineParser) Trigger

func (*InlineParser) Trigger() []byte

Trigger implements parser.InlineParser.

type MarkdownDirectiveRenderer

type MarkdownDirectiveRenderer interface {
	Render(r *markdown.Render, directive *Node, entering bool) (ast.WalkStatus, error)
}

type MarkdownDirectiveRendererFunc

type MarkdownDirectiveRendererFunc func(r *markdown.Render, directive *Node, entering bool) (ast.WalkStatus, error)

type MarkdownNodeRenderer

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

func NewMarkdownNodeRenderer

func NewMarkdownNodeRenderer(funcs ...MarkdownNodeRendererOptionFunc) *MarkdownNodeRenderer

func (*MarkdownNodeRenderer) Render

func (mr *MarkdownNodeRenderer) Render(r *markdown.Render, node ast.Node, entering bool) (ast.WalkStatus, error)

Render implements markdown.NodeRenderer.

type MarkdownNodeRendererOptionFunc

type MarkdownNodeRendererOptionFunc func(opts *MarkdownNodeRendererOptions)

func WithMarkdownDirectiveRenderer

func WithMarkdownDirectiveRenderer(directiveType Type, renderer MarkdownDirectiveRenderer) MarkdownNodeRendererOptionFunc

func WithMarkdownDirectiveRendererFunc

func WithMarkdownDirectiveRendererFunc(directiveType Type, render MarkdownDirectiveRendererFunc) MarkdownNodeRendererOptionFunc

type MarkdownNodeRendererOptions

type MarkdownNodeRendererOptions struct {
	Renderers map[Type]MarkdownDirectiveRenderer
}

type Node

type Node struct {
	ast.BaseInline
	// contains filtered or unexported fields
}

func (*Node) DirectiveType

func (n *Node) DirectiveType() Type

func (*Node) Dump

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

Dump implements ast.Node.

func (*Node) Kind

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

Kind implements ast.Node.

type NodeRenderer

type NodeRenderer interface {
	Render(writer util.BufWriter, source []byte, node *Node)
}

type NodeRendererFunc

type NodeRendererFunc func(writer util.BufWriter, source []byte, node *Node)

type NodeTransformer

type NodeTransformer interface {
	Transform(node *Node, reader text.Reader, pc parser.Context) error
}

type NodeTransformerFunc

type NodeTransformerFunc func(node *Node, reader text.Reader, pc parser.Context) error

type PostTranformer added in v0.3.0

type PostTranformer interface {
	PostTransform(doc *ast.Document, reader text.Reader, pc parser.Context) error
}

type PrioritizedNodeTransformer added in v0.3.0

type PrioritizedNodeTransformer interface {
	NodeTransformer
	Priority() int
}

type Renderer

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

func NewRenderer

func NewRenderer(funcs ...RendererOptionFunc) *Renderer

func (*Renderer) RegisterFuncs

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

func (*Renderer) Render

func (r *Renderer) Render(writer util.BufWriter, source []byte, node ast.Node, entering bool) (ast.WalkStatus, error)

Render implements renderer.Renderer.

type RendererOptionFunc

type RendererOptionFunc func(opts *RendererOptions)

func WithRenderer

func WithRenderer(directiveType Type, Renderer NodeRenderer) RendererOptionFunc

func WithRendererFunc

func WithRendererFunc(directiveType Type, transform NodeRendererFunc) RendererOptionFunc

type RendererOptions

type RendererOptions struct {
	Renderers map[Type]NodeRenderer
}

func NewRendererOptions

func NewRendererOptions(funcs ...RendererOptionFunc) *RendererOptions

type Transformer

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

func NewTransformer

func NewTransformer(funcs ...TransformerOptionFunc) *Transformer

func (*Transformer) Transform

func (t *Transformer) Transform(doc *ast.Document, reader text.Reader, pc parser.Context)

Transform implements parser.ASTTransformer.

type TransformerOptionFunc

type TransformerOptionFunc func(opts *TransformerOptions)

func WithTransformer

func WithTransformer(directiveType Type, transformer NodeTransformer) TransformerOptionFunc

func WithTransformerFunc

func WithTransformerFunc(directiveType Type, transform NodeTransformerFunc) TransformerOptionFunc

type TransformerOptions

type TransformerOptions struct {
	Transformers map[Type]NodeTransformer
}

func NewTransformerOptions

func NewTransformerOptions(funcs ...TransformerOptionFunc) *TransformerOptions

type Type

type Type string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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