document

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2022 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Block

type Block interface {
	Kind() BlockKind
	Unwrap() ast.Node
	Value() []byte
}

type BlockKind added in v0.4.0

type BlockKind int
const (
	InnerBlockKind BlockKind = iota + 1
	CodeBlockKind
	MarkdownBlockKind
)

type Blocks

type Blocks []Block

type CodeBlock

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

func (*CodeBlock) Attributes

func (b *CodeBlock) Attributes() map[string]string

func (*CodeBlock) Content

func (b *CodeBlock) Content() []byte

func (*CodeBlock) Intro

func (b *CodeBlock) Intro() string

func (CodeBlock) Kind added in v0.4.0

func (CodeBlock) Kind() BlockKind

func (*CodeBlock) Language added in v0.4.0

func (b *CodeBlock) Language() string

func (*CodeBlock) Lines

func (b *CodeBlock) Lines() []string

func (*CodeBlock) Name

func (b *CodeBlock) Name() string

func (*CodeBlock) Unwrap added in v0.4.0

func (b *CodeBlock) Unwrap() ast.Node

func (*CodeBlock) Value added in v0.4.0

func (b *CodeBlock) Value() []byte

type CodeBlocks

type CodeBlocks []*CodeBlock

func CollectCodeBlocks added in v0.4.0

func CollectCodeBlocks(node *Node) (result CodeBlocks)

func (CodeBlocks) Lookup

func (b CodeBlocks) Lookup(name string) *CodeBlock

func (CodeBlocks) Names

func (b CodeBlocks) Names() (result []string)

type Document added in v0.4.0

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

func New added in v0.4.0

func New(source []byte, renderer Renderer) *Document

func (*Document) Parse added in v0.4.0

func (d *Document) Parse() (*Node, ast.Node, error)

type InnerBlock added in v0.4.0

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

InnerBlock represents a non-leaf block. It helps to handle nested fenced code blocks for block quotes and list items.

func (InnerBlock) Kind added in v0.4.0

func (InnerBlock) Kind() BlockKind

func (*InnerBlock) Unwrap added in v0.4.0

func (b *InnerBlock) Unwrap() ast.Node

func (*InnerBlock) Value added in v0.4.0

func (b *InnerBlock) Value() []byte

type MarkdownBlock

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

func (MarkdownBlock) Kind added in v0.4.0

func (MarkdownBlock) Kind() BlockKind

func (*MarkdownBlock) Unwrap added in v0.4.0

func (b *MarkdownBlock) Unwrap() ast.Node

func (*MarkdownBlock) Value added in v0.4.0

func (b *MarkdownBlock) Value() []byte

type Node added in v0.4.0

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

func FindNode added in v0.4.0

func FindNode(node *Node, fn func(*Node) bool) *Node

func (*Node) Bytes added in v0.4.0

func (n *Node) Bytes() []byte

func (*Node) Children added in v0.4.0

func (n *Node) Children() []*Node

func (*Node) Index added in v0.4.0

func (n *Node) Index() int

func (*Node) InsertAt added in v0.4.0

func (n *Node) InsertAt(idx int, item Block) *Node

func (*Node) Item added in v0.4.0

func (n *Node) Item() Block

func (*Node) Parent added in v0.4.0

func (n *Node) Parent() *Node

func (*Node) Remove added in v0.4.0

func (n *Node) Remove(nodeToRemove *Node) bool

func (*Node) String added in v0.4.0

func (n *Node) String() string

type Renderer added in v0.4.0

type Renderer func(ast.Node, []byte) ([]byte, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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