ast

package
v0.19.0 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsBlockNode added in v0.18.2

func IsBlockNode(node Node) bool

Types

type AutoLink struct {
	BaseInline

	URL       string
	IsRawText bool
}

func (*AutoLink) Restore added in v0.18.2

func (n *AutoLink) Restore() string

func (*AutoLink) Type added in v0.18.2

func (*AutoLink) Type() NodeType

type BaseBlock added in v0.18.1

type BaseBlock struct {
	BaseNode
}

type BaseInline added in v0.18.1

type BaseInline struct {
	BaseNode
}

type BaseNode added in v0.18.1

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

func (*BaseNode) NextSibling added in v0.18.1

func (n *BaseNode) NextSibling() Node

func (*BaseNode) PrevSibling added in v0.18.1

func (n *BaseNode) PrevSibling() Node

func (*BaseNode) SetNextSibling added in v0.18.1

func (n *BaseNode) SetNextSibling(node Node)

func (*BaseNode) SetPrevSibling added in v0.18.1

func (n *BaseNode) SetPrevSibling(node Node)

type Blockquote added in v0.18.1

type Blockquote struct {
	BaseBlock

	Children []Node
}

func (*Blockquote) Restore added in v0.18.2

func (n *Blockquote) Restore() string

func (*Blockquote) Type added in v0.18.1

func (*Blockquote) Type() NodeType

type Bold added in v0.18.1

type Bold struct {
	BaseInline

	// Symbol is "*" or "_".
	Symbol   string
	Children []Node
}

func (*Bold) Restore added in v0.18.2

func (n *Bold) Restore() string

func (*Bold) Type added in v0.18.1

func (*Bold) Type() NodeType

type BoldItalic added in v0.18.1

type BoldItalic struct {
	BaseInline

	// Symbol is "*" or "_".
	Symbol  string
	Content string
}

func (*BoldItalic) Restore added in v0.18.2

func (n *BoldItalic) Restore() string

func (*BoldItalic) Type added in v0.18.1

func (*BoldItalic) Type() NodeType

type Code added in v0.18.1

type Code struct {
	BaseInline

	Content string
}

func (*Code) Restore added in v0.18.2

func (n *Code) Restore() string

func (*Code) Type added in v0.18.1

func (*Code) Type() NodeType

type CodeBlock added in v0.18.1

type CodeBlock struct {
	BaseBlock

	Language string
	Content  string
}

func (*CodeBlock) Restore added in v0.18.2

func (n *CodeBlock) Restore() string

func (*CodeBlock) Type added in v0.18.1

func (*CodeBlock) Type() NodeType

type EmbeddedContent added in v0.19.0

type EmbeddedContent struct {
	BaseBlock

	ResourceName string
	Params       string
}

func (*EmbeddedContent) Restore added in v0.19.0

func (n *EmbeddedContent) Restore() string

func (*EmbeddedContent) Type added in v0.19.0

func (*EmbeddedContent) Type() NodeType

type EscapingCharacter added in v0.18.2

type EscapingCharacter struct {
	BaseInline

	Symbol string
}

func (*EscapingCharacter) Restore added in v0.18.2

func (n *EscapingCharacter) Restore() string

func (*EscapingCharacter) Type added in v0.18.2

func (*EscapingCharacter) Type() NodeType

type Heading added in v0.18.1

type Heading struct {
	BaseBlock

	Level    int
	Children []Node
}

func (*Heading) Restore added in v0.18.2

func (n *Heading) Restore() string

func (*Heading) Type added in v0.18.1

func (*Heading) Type() NodeType

type Highlight added in v0.18.2

type Highlight struct {
	BaseInline

	Content string
}

func (*Highlight) Restore added in v0.18.2

func (n *Highlight) Restore() string

func (*Highlight) Type added in v0.18.2

func (*Highlight) Type() NodeType

type HorizontalRule added in v0.18.1

type HorizontalRule struct {
	BaseBlock

	// Symbol is "*" or "-" or "_".
	Symbol string
}

func (*HorizontalRule) Restore added in v0.18.2

func (n *HorizontalRule) Restore() string

func (*HorizontalRule) Type added in v0.18.1

func (*HorizontalRule) Type() NodeType

type Image added in v0.18.1

type Image struct {
	BaseInline

	AltText string
	URL     string
}

func (*Image) Restore added in v0.18.2

func (n *Image) Restore() string

func (*Image) Type added in v0.18.1

func (*Image) Type() NodeType

type Italic added in v0.18.1

type Italic struct {
	BaseInline

	// Symbol is "*" or "_".
	Symbol  string
	Content string
}

func (*Italic) Restore added in v0.18.2

func (n *Italic) Restore() string

func (*Italic) Type added in v0.18.1

func (*Italic) Type() NodeType

type LineBreak added in v0.18.1

type LineBreak struct {
	BaseBlock
}

func (*LineBreak) Restore added in v0.18.2

func (*LineBreak) Restore() string

func (*LineBreak) Type added in v0.18.1

func (*LineBreak) Type() NodeType
type Link struct {
	BaseInline

	Text string
	URL  string
}

func (*Link) Restore added in v0.18.2

func (n *Link) Restore() string

func (*Link) Type added in v0.18.1

func (*Link) Type() NodeType

type Math added in v0.18.2

type Math struct {
	BaseInline

	Content string
}

func (*Math) Restore added in v0.18.2

func (n *Math) Restore() string

func (*Math) Type added in v0.18.2

func (*Math) Type() NodeType

type MathBlock added in v0.18.2

type MathBlock struct {
	BaseBlock

	Content string
}

func (*MathBlock) Restore added in v0.18.2

func (n *MathBlock) Restore() string

func (*MathBlock) Type added in v0.18.2

func (*MathBlock) Type() NodeType

type Node

type Node interface {
	// Type returns a node type.
	Type() NodeType

	// Restore returns a string representation of this node.
	Restore() string

	// PrevSibling returns a previous sibling node of this node.
	PrevSibling() Node

	// NextSibling returns a next sibling node of this node.
	NextSibling() Node

	// SetPrevSibling sets a previous sibling node to this node.
	SetPrevSibling(Node)

	// SetNextSibling sets a next sibling node to this node.
	SetNextSibling(Node)
}

func FindNextSiblingExceptLineBreak added in v0.18.2

func FindNextSiblingExceptLineBreak(node Node) Node

func FindPrevSiblingExceptLineBreak added in v0.18.2

func FindPrevSiblingExceptLineBreak(node Node) Node

type NodeType added in v0.18.1

type NodeType uint32
const (
	UnknownNode NodeType = iota
	// Block nodes.
	LineBreakNode
	ParagraphNode
	CodeBlockNode
	HeadingNode
	HorizontalRuleNode
	BlockquoteNode
	OrderedListNode
	UnorderedListNode
	TaskListNode
	MathBlockNode
	TableNode
	EmbeddedContentNode
	// Inline nodes.
	TextNode
	BoldNode
	ItalicNode
	BoldItalicNode
	CodeNode
	ImageNode
	LinkNode
	AutoLinkNode
	TagNode
	StrikethroughNode
	EscapingCharacterNode
	MathNode
	HighlightNode
	SubscriptNode
	SuperscriptNode
	ReferencedContentNode
)

type OrderedList added in v0.18.2

type OrderedList struct {
	BaseBlock

	// Number is the number of the list.
	Number string
	// Indent is the number of spaces.
	Indent   int
	Children []Node
}

func (*OrderedList) Restore added in v0.18.2

func (n *OrderedList) Restore() string

func (*OrderedList) Type added in v0.18.2

func (*OrderedList) Type() NodeType

type Paragraph added in v0.18.1

type Paragraph struct {
	BaseBlock

	Children []Node
}

func (*Paragraph) Restore added in v0.18.2

func (n *Paragraph) Restore() string

func (*Paragraph) Type added in v0.18.1

func (*Paragraph) Type() NodeType

type ReferencedContent added in v0.19.0

type ReferencedContent struct {
	BaseInline

	ResourceName string
	Params       string
}

func (*ReferencedContent) Restore added in v0.19.0

func (n *ReferencedContent) Restore() string

func (*ReferencedContent) Type added in v0.19.0

func (*ReferencedContent) Type() NodeType

type Strikethrough added in v0.18.1

type Strikethrough struct {
	BaseInline

	Content string
}

func (*Strikethrough) Restore added in v0.18.2

func (n *Strikethrough) Restore() string

func (*Strikethrough) Type added in v0.18.1

func (*Strikethrough) Type() NodeType

type Subscript added in v0.19.0

type Subscript struct {
	BaseInline

	Content string
}

func (*Subscript) Restore added in v0.19.0

func (n *Subscript) Restore() string

func (*Subscript) Type added in v0.19.0

func (*Subscript) Type() NodeType

type Superscript added in v0.19.0

type Superscript struct {
	BaseInline

	Content string
}

func (*Superscript) Restore added in v0.19.0

func (n *Superscript) Restore() string

func (*Superscript) Type added in v0.19.0

func (*Superscript) Type() NodeType

type Table added in v0.18.2

type Table struct {
	BaseBlock

	Header    []string
	Delimiter []string
	Rows      [][]string
}

func (*Table) Restore added in v0.18.2

func (n *Table) Restore() string

func (*Table) Type added in v0.18.2

func (*Table) Type() NodeType

type Tag added in v0.18.1

type Tag struct {
	BaseInline

	Content string
}

func (*Tag) Restore added in v0.18.2

func (n *Tag) Restore() string

func (*Tag) Type added in v0.18.1

func (*Tag) Type() NodeType

type TaskList added in v0.18.2

type TaskList struct {
	BaseBlock

	// Symbol is "*" or "-" or "+".
	Symbol string
	// Indent is the number of spaces.
	Indent   int
	Complete bool
	Children []Node
}

func (*TaskList) Restore added in v0.18.2

func (n *TaskList) Restore() string

func (*TaskList) Type added in v0.18.2

func (*TaskList) Type() NodeType

type Text added in v0.18.1

type Text struct {
	BaseInline

	Content string
}

func (*Text) Restore added in v0.18.2

func (n *Text) Restore() string

func (*Text) Type added in v0.18.1

func (*Text) Type() NodeType

type UnorderedList added in v0.18.2

type UnorderedList struct {
	BaseBlock

	// Symbol is "*" or "-" or "+".
	Symbol string
	// Indent is the number of spaces.
	Indent   int
	Children []Node
}

func (*UnorderedList) Restore added in v0.18.2

func (n *UnorderedList) Restore() string

func (*UnorderedList) Type added in v0.18.2

func (*UnorderedList) Type() NodeType

Jump to

Keyboard shortcuts

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