Documentation
¶
Overview ¶
Package ast defines AST nodes that represent markdown elements.
Index ¶
- Variables
- func IsParagraph(node Node) bool
- func Walk(n Node, walker Walker) error
- func WithLinkReference(kind ReferenceLinkKind, value text.MultiLineValue) interface{ ... }
- func WithLinkTitle(title text.MultiLineValue) interface{ ... }
- type Attribute
- type AutoLink
- func (n *AutoLink) Attribute(name string) (text.MultiLineValue, bool)
- func (n *AutoLink) Attributes() []Attribute
- func (n *AutoLink) Dump(_ []byte) *NodeDump
- func (n *AutoLink) Kind() NodeKind
- func (n *AutoLink) NextSibling() Node
- func (n *AutoLink) Parent() Node
- func (n *AutoLink) PreviousSibling() Node
- func (n *AutoLink) RemoveAttributes()
- func (n *AutoLink) SetAttribute(name string, value text.MultiLineValue)
- func (n *AutoLink) SetNextSibling(v Node)
- func (n *AutoLink) SetParent(v Node)
- func (n *AutoLink) SetPreviousSibling(v Node)
- type AutoLinkOption
- type BaseBlock
- func (b *BaseBlock) AppendSource(seg text.Segment)
- func (n *BaseBlock) Attribute(name string) (text.MultiLineValue, bool)
- func (n *BaseBlock) Attributes() []Attribute
- func (b *BaseBlock) HasBlankPreviousLines() bool
- func (n *BaseBlock) NextSibling() Node
- func (n *BaseBlock) Parent() Node
- func (n *BaseBlock) PreviousSibling() Node
- func (n *BaseBlock) RemoveAttributes()
- func (n *BaseBlock) SetAttribute(name string, value text.MultiLineValue)
- func (b *BaseBlock) SetBlankPreviousLines(v bool)
- func (n *BaseBlock) SetNextSibling(v Node)
- func (n *BaseBlock) SetParent(v Node)
- func (n *BaseBlock) SetPreviousSibling(v Node)
- func (b *BaseBlock) SetSource(v []text.Segment)
- func (b *BaseBlock) Source() []text.Segment
- type BaseInline
- func (n *BaseInline) Attribute(name string) (text.MultiLineValue, bool)
- func (n *BaseInline) Attributes() []Attribute
- func (b *BaseInline) FirstRune(source []byte) (rune, bool)
- func (b *BaseInline) LastRune(source []byte) (rune, bool)
- func (n *BaseInline) NextSibling() Node
- func (n *BaseInline) Parent() Node
- func (n *BaseInline) PreviousSibling() Node
- func (n *BaseInline) RemoveAttributes()
- func (n *BaseInline) SetAttribute(name string, value text.MultiLineValue)
- func (n *BaseInline) SetNextSibling(v Node)
- func (n *BaseInline) SetParent(v Node)
- func (n *BaseInline) SetPreviousSibling(v Node)
- type BaseNode
- func (n *BaseNode) AppendChild(v Node)
- func (n *BaseNode) Attribute(name string) (text.MultiLineValue, bool)
- func (n *BaseNode) Attributes() []Attribute
- func (n *BaseNode) ChildCount() int
- func (n *BaseNode) Children() iter.Seq[Node]
- func (n *BaseNode) FirstChild() Node
- func (n *BaseNode) HasChildren() bool
- func (n *BaseNode) Init(self Node)
- func (n *BaseNode) InsertAfter(target, insertee Node)
- func (n *BaseNode) InsertBefore(target, insertee Node)
- func (n *BaseNode) LastChild() Node
- func (n *BaseNode) NextSibling() Node
- func (n *BaseNode) OwnerDocument() *Document
- func (n *BaseNode) Parent() Node
- func (n *BaseNode) Pos() int
- func (n *BaseNode) PreviousSibling() Node
- func (n *BaseNode) RemoveAttributes()
- func (n *BaseNode) RemoveChild(v Node)
- func (n *BaseNode) RemoveChildren()
- func (n *BaseNode) ReplaceChild(target, insertee Node)
- func (n *BaseNode) ReplaceChildInPlace(target, insertee Node)
- func (n *BaseNode) SetAttribute(name string, value text.MultiLineValue)
- func (n *BaseNode) SetNextSibling(v Node)
- func (n *BaseNode) SetParent(v Node)
- func (n *BaseNode) SetPos(v int)
- func (n *BaseNode) SetPreviousSibling(v Node)
- type BlockNode
- type Blockquote
- func (n *Blockquote) Attribute(name string) (text.MultiLineValue, bool)
- func (n *Blockquote) Attributes() []Attribute
- func (n *Blockquote) Dump(_ []byte) *NodeDump
- func (n *Blockquote) Kind() NodeKind
- func (n *Blockquote) NextSibling() Node
- func (n *Blockquote) Parent() Node
- func (n *Blockquote) PreviousSibling() Node
- func (n *Blockquote) RemoveAttributes()
- func (n *Blockquote) SetAttribute(name string, value text.MultiLineValue)
- func (n *Blockquote) SetNextSibling(v Node)
- func (n *Blockquote) SetParent(v Node)
- func (n *Blockquote) SetPreviousSibling(v Node)
- type CodeBlock
- func (b *CodeBlock) AppendSource(_ text.Segment)
- func (n *CodeBlock) Dump(_ []byte) *NodeDump
- func (b *CodeBlock) HasBlankPreviousLines() bool
- func (n *CodeBlock) Kind() NodeKind
- func (n *CodeBlock) Language(source []byte) (string, bool)
- func (b *CodeBlock) Pos() int
- func (b *CodeBlock) SetBlankPreviousLines(v bool)
- func (b *CodeBlock) SetPos(v int)
- func (b *CodeBlock) SetSource(_ []text.Segment)
- func (b *CodeBlock) Source() []text.Segment
- type CodeBlockKind
- type CodeBlockOption
- type CodeSpan
- func (n *CodeSpan) AppendChild(_ Node)
- func (n *CodeSpan) Attribute(name string) (text.MultiLineValue, bool)
- func (n *CodeSpan) Attributes() []Attribute
- func (n *CodeSpan) ChildCount() int
- func (n *CodeSpan) Children() iter.Seq[Node]
- func (n *CodeSpan) Dump(_ []byte) *NodeDump
- func (n *CodeSpan) FirstChild() Node
- func (n *CodeSpan) FirstRune(source []byte) (rune, bool)
- func (n *CodeSpan) HasChildren() bool
- func (n *CodeSpan) InsertAfter(_ Node, _ Node)
- func (n *CodeSpan) InsertBefore(_ Node, _ Node)
- func (n *CodeSpan) IsBlank(source []byte) bool
- func (n *CodeSpan) Kind() NodeKind
- func (n *CodeSpan) LastChild() Node
- func (n *CodeSpan) LastRune(source []byte) (rune, bool)
- func (n *CodeSpan) NextSibling() Node
- func (n *CodeSpan) OwnerDocument() *Document
- func (n *CodeSpan) Parent() Node
- func (n *CodeSpan) Pos() int
- func (n *CodeSpan) PreviousSibling() Node
- func (n *CodeSpan) RemoveAttributes()
- func (n *CodeSpan) RemoveChild(_ Node)
- func (n *CodeSpan) RemoveChildren()
- func (n *CodeSpan) ReplaceChild(_ Node, _ Node)
- func (n *CodeSpan) SetAttribute(name string, value text.MultiLineValue)
- func (n *CodeSpan) SetNextSibling(v Node)
- func (n *CodeSpan) SetParent(v Node)
- func (n *CodeSpan) SetPos(_ int)
- func (n *CodeSpan) SetPreviousSibling(v Node)
- type Document
- func (n *Document) AddMeta(key string, value any)
- func (n *Document) Attribute(name string) (text.MultiLineValue, bool)
- func (n *Document) Attributes() []Attribute
- func (n *Document) Dump(_ []byte) *NodeDump
- func (n *Document) Kind() NodeKind
- func (n *Document) Metadata() map[string]any
- func (n *Document) NextSibling() Node
- func (n *Document) OwnerDocument() *Document
- func (n *Document) Parent() Node
- func (n *Document) Pos() int
- func (n *Document) PreviousSibling() Node
- func (n *Document) RemoveAttributes()
- func (n *Document) SetAttribute(name string, value text.MultiLineValue)
- func (n *Document) SetMetadata(meta map[string]any)
- func (n *Document) SetNextSibling(v Node)
- func (n *Document) SetParent(v Node)
- func (n *Document) SetPreviousSibling(v Node)
- type Emphasis
- func (n *Emphasis) Attribute(name string) (text.MultiLineValue, bool)
- func (n *Emphasis) Attributes() []Attribute
- func (n *Emphasis) Dump(_ []byte) *NodeDump
- func (n *Emphasis) Kind() NodeKind
- func (n *Emphasis) NextSibling() Node
- func (n *Emphasis) Parent() Node
- func (n *Emphasis) PreviousSibling() Node
- func (n *Emphasis) RemoveAttributes()
- func (n *Emphasis) SetAttribute(name string, value text.MultiLineValue)
- func (n *Emphasis) SetNextSibling(v Node)
- func (n *Emphasis) SetParent(v Node)
- func (n *Emphasis) SetPreviousSibling(v Node)
- type HTMLBlock
- func (b *HTMLBlock) AppendSource(_ text.Segment)
- func (n *HTMLBlock) Dump(_ []byte) *NodeDump
- func (b *HTMLBlock) HasBlankPreviousLines() bool
- func (n *HTMLBlock) Kind() NodeKind
- func (b *HTMLBlock) Pos() int
- func (b *HTMLBlock) SetBlankPreviousLines(v bool)
- func (b *HTMLBlock) SetPos(v int)
- func (b *HTMLBlock) SetSource(_ []text.Segment)
- func (b *HTMLBlock) Source() []text.Segment
- type HTMLBlockKind
- type Heading
- func (n *Heading) Attribute(name string) (text.MultiLineValue, bool)
- func (n *Heading) Attributes() []Attribute
- func (n *Heading) Dump(_ []byte) *NodeDump
- func (n *Heading) Kind() NodeKind
- func (n *Heading) NextSibling() Node
- func (n *Heading) Parent() Node
- func (n *Heading) PreviousSibling() Node
- func (n *Heading) RemoveAttributes()
- func (n *Heading) SetAttribute(name string, value text.MultiLineValue)
- func (n *Heading) SetNextSibling(v Node)
- func (n *Heading) SetParent(v Node)
- func (n *Heading) SetPreviousSibling(v Node)
- type HeadingKind
- type Image
- func (n *Image) Attribute(name string) (text.MultiLineValue, bool)
- func (n *Image) Attributes() []Attribute
- func (n *Image) Dump(_ []byte) *NodeDump
- func (n *Image) Kind() NodeKind
- func (n *Image) NextSibling() Node
- func (n *Image) Parent() Node
- func (n *Image) PreviousSibling() Node
- func (n *Image) RemoveAttributes()
- func (n *Image) SetAttribute(name string, value text.MultiLineValue)
- func (n *Image) SetNextSibling(v Node)
- func (n *Image) SetParent(v Node)
- func (n *Image) SetPreviousSibling(v Node)
- type ImageOption
- type InlineNode
- type Link
- func (n *Link) Attribute(name string) (text.MultiLineValue, bool)
- func (n *Link) Attributes() []Attribute
- func (n *Link) Dump(_ []byte) *NodeDump
- func (n *Link) Kind() NodeKind
- func (n *Link) NextSibling() Node
- func (n *Link) Parent() Node
- func (n *Link) PreviousSibling() Node
- func (n *Link) RemoveAttributes()
- func (n *Link) SetAttribute(name string, value text.MultiLineValue)
- func (n *Link) SetNextSibling(v Node)
- func (n *Link) SetParent(v Node)
- func (n *Link) SetPreviousSibling(v Node)
- type LinkOption
- type LinkReferenceDefinition
- func (b *LinkReferenceDefinition) AppendSource(_ text.Segment)
- func (l *LinkReferenceDefinition) Dump(_ []byte) *NodeDump
- func (b *LinkReferenceDefinition) HasBlankPreviousLines() bool
- func (l *LinkReferenceDefinition) Kind() NodeKind
- func (b *LinkReferenceDefinition) Pos() int
- func (b *LinkReferenceDefinition) SetBlankPreviousLines(v bool)
- func (b *LinkReferenceDefinition) SetPos(v int)
- func (b *LinkReferenceDefinition) SetSource(_ []text.Segment)
- func (b *LinkReferenceDefinition) Source() []text.Segment
- type LinkReferenceDefinitionOption
- type List
- func (n *List) Attribute(name string) (text.MultiLineValue, bool)
- func (n *List) Attributes() []Attribute
- func (l *List) CanContinue(marker byte, isOrdered bool) bool
- func (l *List) Dump(_ []byte) *NodeDump
- func (l *List) IsOrdered() bool
- func (l *List) Kind() NodeKind
- func (n *List) NextSibling() Node
- func (n *List) Parent() Node
- func (n *List) PreviousSibling() Node
- func (n *List) RemoveAttributes()
- func (n *List) SetAttribute(name string, value text.MultiLineValue)
- func (n *List) SetNextSibling(v Node)
- func (n *List) SetParent(v Node)
- func (n *List) SetPreviousSibling(v Node)
- type ListItem
- func (n *ListItem) Attribute(name string) (text.MultiLineValue, bool)
- func (n *ListItem) Attributes() []Attribute
- func (n *ListItem) Dump(_ []byte) *NodeDump
- func (n *ListItem) Kind() NodeKind
- func (n *ListItem) NextSibling() Node
- func (n *ListItem) Offset() int
- func (n *ListItem) Parent() Node
- func (n *ListItem) PreviousSibling() Node
- func (n *ListItem) RemoveAttributes()
- func (n *ListItem) SetAttribute(name string, value text.MultiLineValue)
- func (n *ListItem) SetNextSibling(v Node)
- func (n *ListItem) SetOffset(v int)
- func (n *ListItem) SetParent(v Node)
- func (n *ListItem) SetPreviousSibling(v Node)
- type Node
- type NodeDump
- type NodeKind
- type Paragraph
- func (n *Paragraph) Attribute(name string) (text.MultiLineValue, bool)
- func (n *Paragraph) Attributes() []Attribute
- func (n *Paragraph) Dump(_ []byte) *NodeDump
- func (n *Paragraph) Kind() NodeKind
- func (n *Paragraph) NextSibling() Node
- func (n *Paragraph) Parent() Node
- func (n *Paragraph) Pos() int
- func (n *Paragraph) PreviousSibling() Node
- func (n *Paragraph) RemoveAttributes()
- func (n *Paragraph) SetAttribute(name string, value text.MultiLineValue)
- func (n *Paragraph) SetNextSibling(v Node)
- func (n *Paragraph) SetParent(v Node)
- func (n *Paragraph) SetPreviousSibling(v Node)
- type PrettyPrintOption
- type RawHTML
- func (n *RawHTML) AppendChild(_ Node)
- func (n *RawHTML) Attribute(name string) (text.MultiLineValue, bool)
- func (n *RawHTML) Attributes() []Attribute
- func (n *RawHTML) ChildCount() int
- func (n *RawHTML) Children() iter.Seq[Node]
- func (n *RawHTML) Dump(_ []byte) *NodeDump
- func (n *RawHTML) FirstChild() Node
- func (n *RawHTML) FirstRune(_ []byte) (rune, bool)
- func (n *RawHTML) HasChildren() bool
- func (n *RawHTML) InsertAfter(_ Node, _ Node)
- func (n *RawHTML) InsertBefore(_ Node, _ Node)
- func (n *RawHTML) Kind() NodeKind
- func (n *RawHTML) LastChild() Node
- func (n *RawHTML) LastRune(_ []byte) (rune, bool)
- func (n *RawHTML) NextSibling() Node
- func (n *RawHTML) OwnerDocument() *Document
- func (n *RawHTML) Parent() Node
- func (n *RawHTML) Pos() int
- func (n *RawHTML) PreviousSibling() Node
- func (n *RawHTML) RemoveAttributes()
- func (n *RawHTML) RemoveChild(_ Node)
- func (n *RawHTML) RemoveChildren()
- func (n *RawHTML) ReplaceChild(_ Node, _ Node)
- func (n *RawHTML) SetAttribute(name string, value text.MultiLineValue)
- func (n *RawHTML) SetNextSibling(v Node)
- func (n *RawHTML) SetParent(v Node)
- func (n *RawHTML) SetPos(_ int)
- func (n *RawHTML) SetPreviousSibling(v Node)
- type ReferenceLink
- type ReferenceLinkKind
- type Strong
- func (n *Strong) Attribute(name string) (text.MultiLineValue, bool)
- func (n *Strong) Attributes() []Attribute
- func (n *Strong) Dump(_ []byte) *NodeDump
- func (n *Strong) Kind() NodeKind
- func (n *Strong) NextSibling() Node
- func (n *Strong) Parent() Node
- func (n *Strong) PreviousSibling() Node
- func (n *Strong) RemoveAttributes()
- func (n *Strong) SetAttribute(name string, value text.MultiLineValue)
- func (n *Strong) SetNextSibling(v Node)
- func (n *Strong) SetParent(v Node)
- func (n *Strong) SetPreviousSibling(v Node)
- type Text
- func (n *Text) AppendChild(_ Node)
- func (n *Text) Attribute(name string) (text.MultiLineValue, bool)
- func (n *Text) Attributes() []Attribute
- func (n *Text) ChildCount() int
- func (n *Text) Children() iter.Seq[Node]
- func (n *Text) Dump(_ []byte) *NodeDump
- func (n *Text) FirstChild() Node
- func (n *Text) FirstRune(source []byte) (rune, bool)
- func (n *Text) HardLineBreak() bool
- func (n *Text) HasChildren() bool
- func (n *Text) InsertAfter(_ Node, _ Node)
- func (n *Text) InsertBefore(_ Node, _ Node)
- func (n *Text) Kind() NodeKind
- func (n *Text) LastChild() Node
- func (n *Text) LastRune(source []byte) (rune, bool)
- func (n *Text) NextSibling() Node
- func (n *Text) OwnerDocument() *Document
- func (n *Text) Parent() Node
- func (n *Text) Pos() int
- func (n *Text) PreviousSibling() Node
- func (n *Text) RemoveAttributes()
- func (n *Text) RemoveChild(_ Node)
- func (n *Text) RemoveChildren()
- func (n *Text) ReplaceChild(_ Node, _ Node)
- func (n *Text) SetAttribute(name string, value text.MultiLineValue)
- func (n *Text) SetHardLineBreak(v bool)
- func (n *Text) SetNextSibling(v Node)
- func (n *Text) SetParent(v Node)
- func (n *Text) SetPos(_ int)
- func (n *Text) SetPreviousSibling(v Node)
- func (n *Text) SetSoftLineBreak(v bool)
- func (n *Text) SoftLineBreak() bool
- type ThematicBreak
- func (b *ThematicBreak) AppendSource(_ text.Segment)
- func (n *ThematicBreak) Dump(_ []byte) *NodeDump
- func (b *ThematicBreak) HasBlankPreviousLines() bool
- func (n *ThematicBreak) Kind() NodeKind
- func (b *ThematicBreak) Pos() int
- func (b *ThematicBreak) SetBlankPreviousLines(v bool)
- func (b *ThematicBreak) SetPos(v int)
- func (b *ThematicBreak) SetSource(_ []text.Segment)
- func (b *ThematicBreak) Source() []text.Segment
- type WalkStatus
- type Walker
Constants ¶
This section is empty.
Variables ¶
var KindAutoLink = NewNodeKind("AutoLink")
KindAutoLink is a NodeKind of the AutoLink node.
var KindBlockquote = NewNodeKind("Blockquote")
KindBlockquote is a NodeKind of the Blockquote node.
var KindCodeBlock = NewNodeKind("CodeBlock")
KindCodeBlock is a NodeKind of the CodeBlock node.
var KindCodeSpan = NewNodeKind("CodeSpan")
KindCodeSpan is a NodeKind of the CodeSpan node.
var KindDocument = NewNodeKind("Document")
KindDocument is a NodeKind of the Document node.
var KindEmphasis = NewNodeKind("Emphasis")
KindEmphasis is a NodeKind of the Emphasis node.
var KindHTMLBlock = NewNodeKind("HTMLBlock")
KindHTMLBlock is a NodeKind of the HTMLBlock node.
var KindHeading = NewNodeKind("Heading")
KindHeading is a NodeKind of the Heading node.
var KindImage = NewNodeKind("Image")
KindImage is a NodeKind of the Image node.
var KindLink = NewNodeKind("Link")
KindLink is a NodeKind of the Link node.
var KindLinkReferenceDefinition = NewNodeKind("LinkReferenceDefinition")
KindLinkReferenceDefinition is a NodeKind of the LinkReferenceDefinition node.
var KindList = NewNodeKind("List")
KindList is a NodeKind of the List node.
var KindListItem = NewNodeKind("ListItem")
KindListItem is a NodeKind of the ListItem node.
var KindParagraph = NewNodeKind("Paragraph")
KindParagraph is a NodeKind of the Paragraph node.
var KindRawHTML = NewNodeKind("RawHTML")
KindRawHTML is a NodeKind of the RawHTML node.
var KindStrong = NewNodeKind("Strong")
KindStrong is a NodeKind of the Strong node.
var KindText = NewNodeKind("Text")
KindText is a NodeKind of the Text node.
var KindThematicBreak = NewNodeKind("ThematicBreak")
KindThematicBreak is a NodeKind of the ThematicBreak node.
Functions ¶
func IsParagraph ¶
IsParagraph returns true if the given node is a Paragraph node, otherwise false.
func WithLinkReference ¶
func WithLinkReference(kind ReferenceLinkKind, value text.MultiLineValue) interface { LinkOption ImageOption }
WithLinkReference returns a LinkOption that sets the reference of a link or image.
func WithLinkTitle ¶
func WithLinkTitle(title text.MultiLineValue) interface { LinkOption ImageOption LinkReferenceDefinitionOption }
WithLinkTitle returns a LinkOption that sets the title of a link or image.
Types ¶
type Attribute ¶
type Attribute struct {
Name string
Value text.MultiLineValue
}
An Attribute is an attribute of the Node.
type AutoLink ¶
type AutoLink struct {
BaseInline
// Destination is the URL used for the href attribute.
// For email autolinks, it includes the "mailto:" prefix.
Destination text.SingleLineValue
// Label is the display text shown inside the link element.
Label text.SingleLineValue
// Text is the original text as parsed from source, including any
// surrounding syntax characters (e.g. "<" and ">" for CommonMark autolinks).
Text text.SingleLineValue
}
An AutoLink struct represents an autolink of the Markdown text.
func NewAutoLink ¶
func NewAutoLink(destination, label text.SingleLineValue, opts ...AutoLinkOption) *AutoLink
NewAutoLink returns a new AutoLink node with the given destination, label, and options.
func (*AutoLink) Attribute ¶ added in v2.1.6
func (n *AutoLink) Attribute(name string) (text.MultiLineValue, bool)
Attribute implements Node.Attribute.
func (*AutoLink) Attributes ¶ added in v2.1.6
func (n *AutoLink) Attributes() []Attribute
Attributes implements Node.Attributes.
func (*AutoLink) NextSibling ¶ added in v2.1.6
func (n *AutoLink) NextSibling() Node
NextSibling implements Node.NextSibling.
func (*AutoLink) Parent ¶ added in v2.1.6
func (n *AutoLink) Parent() Node
Parent implements Node.Parent.
func (*AutoLink) PreviousSibling ¶ added in v2.1.6
func (n *AutoLink) PreviousSibling() Node
PreviousSibling implements Node.PreviousSibling.
func (*AutoLink) RemoveAttributes ¶ added in v2.1.6
func (n *AutoLink) RemoveAttributes()
RemoveAttributes implements Node.RemoveAttributes.
func (*AutoLink) SetAttribute ¶ added in v2.1.6
func (n *AutoLink) SetAttribute(name string, value text.MultiLineValue)
SetAttribute implements Node.SetAttribute.
func (*AutoLink) SetNextSibling ¶ added in v2.1.6
func (n *AutoLink) SetNextSibling(v Node)
SetNextSibling implements Node.SetNextSibling.
func (*AutoLink) SetParent ¶ added in v2.1.6
func (n *AutoLink) SetParent(v Node)
SetParent implements Node.SetParent.
func (*AutoLink) SetPreviousSibling ¶ added in v2.1.6
func (n *AutoLink) SetPreviousSibling(v Node)
SetPreviousSibling implements Node.SetPreviousSibling.
type AutoLinkOption ¶
type AutoLinkOption interface {
// contains filtered or unexported methods
}
AutoLinkOption is an option for AutoLink nodes.
func WithAutoLinkText ¶
func WithAutoLinkText(text text.SingleLineValue) AutoLinkOption
WithAutoLinkText returns an AutoLinkOption that sets the original source text of an autolink.
type BaseBlock ¶
type BaseBlock struct {
BaseNode
// contains filtered or unexported fields
}
A BaseBlock struct implements the Node interface partially.
func (*BaseBlock) AppendSource ¶
AppendSource implements BlockNode.AppendSource.
func (*BaseBlock) Attribute ¶ added in v2.1.6
func (n *BaseBlock) Attribute(name string) (text.MultiLineValue, bool)
Attribute implements Node.Attribute.
func (*BaseBlock) Attributes ¶ added in v2.1.6
func (n *BaseBlock) Attributes() []Attribute
Attributes implements Node.Attributes.
func (*BaseBlock) HasBlankPreviousLines ¶
HasBlankPreviousLines implements Node.HasBlankPreviousLines.
func (*BaseBlock) NextSibling ¶ added in v2.1.6
func (n *BaseBlock) NextSibling() Node
NextSibling implements Node.NextSibling.
func (*BaseBlock) Parent ¶ added in v2.1.6
func (n *BaseBlock) Parent() Node
Parent implements Node.Parent.
func (*BaseBlock) PreviousSibling ¶ added in v2.1.6
func (n *BaseBlock) PreviousSibling() Node
PreviousSibling implements Node.PreviousSibling.
func (*BaseBlock) RemoveAttributes ¶ added in v2.1.6
func (n *BaseBlock) RemoveAttributes()
RemoveAttributes implements Node.RemoveAttributes.
func (*BaseBlock) SetAttribute ¶ added in v2.1.6
func (n *BaseBlock) SetAttribute(name string, value text.MultiLineValue)
SetAttribute implements Node.SetAttribute.
func (*BaseBlock) SetBlankPreviousLines ¶
SetBlankPreviousLines implements Node.SetBlankPreviousLines.
func (*BaseBlock) SetNextSibling ¶ added in v2.1.6
func (n *BaseBlock) SetNextSibling(v Node)
SetNextSibling implements Node.SetNextSibling.
func (*BaseBlock) SetParent ¶ added in v2.1.6
func (n *BaseBlock) SetParent(v Node)
SetParent implements Node.SetParent.
func (*BaseBlock) SetPreviousSibling ¶ added in v2.1.6
func (n *BaseBlock) SetPreviousSibling(v Node)
SetPreviousSibling implements Node.SetPreviousSibling.
type BaseInline ¶
type BaseInline struct {
BaseNode
}
A BaseInline struct implements the Node interface partially.
func (*BaseInline) Attribute ¶ added in v2.1.6
func (n *BaseInline) Attribute(name string) (text.MultiLineValue, bool)
Attribute implements Node.Attribute.
func (*BaseInline) Attributes ¶ added in v2.1.6
func (n *BaseInline) Attributes() []Attribute
Attributes implements Node.Attributes.
func (*BaseInline) FirstRune ¶ added in v2.0.2
func (b *BaseInline) FirstRune(source []byte) (rune, bool)
FirstRune implements InlineNode.FirstRune.
func (*BaseInline) LastRune ¶ added in v2.0.2
func (b *BaseInline) LastRune(source []byte) (rune, bool)
LastRune implements InlineNode.LastRune.
func (*BaseInline) NextSibling ¶ added in v2.1.6
func (n *BaseInline) NextSibling() Node
NextSibling implements Node.NextSibling.
func (*BaseInline) Parent ¶ added in v2.1.6
func (n *BaseInline) Parent() Node
Parent implements Node.Parent.
func (*BaseInline) PreviousSibling ¶ added in v2.1.6
func (n *BaseInline) PreviousSibling() Node
PreviousSibling implements Node.PreviousSibling.
func (*BaseInline) RemoveAttributes ¶ added in v2.1.6
func (n *BaseInline) RemoveAttributes()
RemoveAttributes implements Node.RemoveAttributes.
func (*BaseInline) SetAttribute ¶ added in v2.1.6
func (n *BaseInline) SetAttribute(name string, value text.MultiLineValue)
SetAttribute implements Node.SetAttribute.
func (*BaseInline) SetNextSibling ¶ added in v2.1.6
func (n *BaseInline) SetNextSibling(v Node)
SetNextSibling implements Node.SetNextSibling.
func (*BaseInline) SetParent ¶ added in v2.1.6
func (n *BaseInline) SetParent(v Node)
SetParent implements Node.SetParent.
func (*BaseInline) SetPreviousSibling ¶ added in v2.1.6
func (n *BaseInline) SetPreviousSibling(v Node)
SetPreviousSibling implements Node.SetPreviousSibling.
type BaseNode ¶
type BaseNode struct {
// contains filtered or unexported fields
}
A BaseNode struct implements the Node interface partially.
func (*BaseNode) AppendChild ¶
AppendChild implements Node.AppendChild .
func (*BaseNode) Attribute ¶
func (n *BaseNode) Attribute(name string) (text.MultiLineValue, bool)
Attribute implements Node.Attribute.
func (*BaseNode) Attributes ¶
func (n *BaseNode) Attributes() []Attribute
Attributes implements Node.Attributes.
func (*BaseNode) ChildCount ¶
ChildCount implements Node.ChildCount .
func (*BaseNode) FirstChild ¶
FirstChild implements Node.FirstChild .
func (*BaseNode) HasChildren ¶
HasChildren implements Node.HasChildren .
func (*BaseNode) InsertAfter ¶
InsertAfter implements Node.InsertAfter .
func (*BaseNode) InsertBefore ¶
InsertBefore implements Node.InsertBefore .
func (*BaseNode) NextSibling ¶
func (n *BaseNode) NextSibling() Node
NextSibling implements Node.NextSibling.
func (*BaseNode) OwnerDocument ¶
OwnerDocument implements Node.OwnerDocument.
func (*BaseNode) PreviousSibling ¶
func (n *BaseNode) PreviousSibling() Node
PreviousSibling implements Node.PreviousSibling.
func (*BaseNode) RemoveAttributes ¶
func (n *BaseNode) RemoveAttributes()
RemoveAttributes implements Node.RemoveAttributes.
func (*BaseNode) RemoveChild ¶
RemoveChild implements Node.RemoveChild .
func (*BaseNode) RemoveChildren ¶
func (n *BaseNode) RemoveChildren()
RemoveChildren implements Node.RemoveChildren .
func (*BaseNode) ReplaceChild ¶
ReplaceChild implements Node.ReplaceChild .
func (*BaseNode) ReplaceChildInPlace ¶ added in v2.1.6
ReplaceChildInPlace swaps target with insertee at target's slot in n's child list without touching target's own parent/prev/next fields.
func (*BaseNode) SetAttribute ¶
func (n *BaseNode) SetAttribute(name string, value text.MultiLineValue)
SetAttribute implements Node.SetAttribute.
func (*BaseNode) SetNextSibling ¶
func (n *BaseNode) SetNextSibling(v Node)
SetNextSibling implements Node.SetNextSibling.
func (*BaseNode) SetParent ¶
func (n *BaseNode) SetParent(v Node)
SetParent implements Node.SetParent.
func (*BaseNode) SetPreviousSibling ¶
func (n *BaseNode) SetPreviousSibling(v Node)
SetPreviousSibling implements Node.SetPreviousSibling.
type BlockNode ¶
type BlockNode interface {
Node
// HasBlankPreviousLines returns true if the row before this node is blank,
// otherwise false.
HasBlankPreviousLines() bool
// SetBlankPreviousLines sets whether the row before this node is blank.
SetBlankPreviousLines(v bool)
// Source returns text segments that hold positions in a source.
// For nodes whose content is parsed into inline nodes, this holds the raw
// source text used as the input for inline parsing. Nodes that do not parse
// their content as inline elements return an empty slice.
Source() []text.Segment
// SetSource sets text segments that hold positions in a source.
SetSource([]text.Segment)
// AppendSource appends a text segment to the source.
AppendSource(text.Segment)
// contains filtered or unexported methods
}
A BlockNode interface is a Node that represents a block element. Some block nodes (e.g. Paragraph, Heading) hold source text segments that are later parsed into inline nodes; others (e.g. CodeBlock, HTMLBlock) do not use this mechanism and leave Source empty.
type Blockquote ¶
type Blockquote struct {
BaseBlock
}
A Blockquote struct represents an blockquote block of Markdown text.
func (*Blockquote) Attribute ¶ added in v2.1.6
func (n *Blockquote) Attribute(name string) (text.MultiLineValue, bool)
Attribute implements Node.Attribute.
func (*Blockquote) Attributes ¶ added in v2.1.6
func (n *Blockquote) Attributes() []Attribute
Attributes implements Node.Attributes.
func (*Blockquote) NextSibling ¶ added in v2.1.6
func (n *Blockquote) NextSibling() Node
NextSibling implements Node.NextSibling.
func (*Blockquote) Parent ¶ added in v2.1.6
func (n *Blockquote) Parent() Node
Parent implements Node.Parent.
func (*Blockquote) PreviousSibling ¶ added in v2.1.6
func (n *Blockquote) PreviousSibling() Node
PreviousSibling implements Node.PreviousSibling.
func (*Blockquote) RemoveAttributes ¶ added in v2.1.6
func (n *Blockquote) RemoveAttributes()
RemoveAttributes implements Node.RemoveAttributes.
func (*Blockquote) SetAttribute ¶ added in v2.1.6
func (n *Blockquote) SetAttribute(name string, value text.MultiLineValue)
SetAttribute implements Node.SetAttribute.
func (*Blockquote) SetNextSibling ¶ added in v2.1.6
func (n *Blockquote) SetNextSibling(v Node)
SetNextSibling implements Node.SetNextSibling.
func (*Blockquote) SetParent ¶ added in v2.1.6
func (n *Blockquote) SetParent(v Node)
SetParent implements Node.SetParent.
func (*Blockquote) SetPreviousSibling ¶ added in v2.1.6
func (n *Blockquote) SetPreviousSibling(v Node)
SetPreviousSibling implements Node.SetPreviousSibling.
type CodeBlock ¶
type CodeBlock struct {
// CodeBlockKind indicates whether this is an indented or fenced code block.
CodeBlockKind CodeBlockKind
// Info is the info string of a fenced code block (e.g. language identifier).
// It is empty for indented code blocks.
Info text.SingleLineValue
// Value holds the raw content of this code block for rendering.
Value text.Lines
// contains filtered or unexported fields
}
A CodeBlock struct represents a code block of Markdown text.
func NewCodeBlock ¶
func NewCodeBlock(kind CodeBlockKind, value text.Lines, opts ...CodeBlockOption) *CodeBlock
NewCodeBlock returns a new CodeBlock node with the given kind and value.
func (*CodeBlock) AppendSource ¶ added in v2.1.6
func (*CodeBlock) HasBlankPreviousLines ¶ added in v2.1.6
func (b *CodeBlock) HasBlankPreviousLines() bool
func (*CodeBlock) Language ¶
Language returns the language extracted from the info string. Language returns false if there is no info string.
func (*CodeBlock) SetBlankPreviousLines ¶ added in v2.1.6
func (b *CodeBlock) SetBlankPreviousLines(v bool)
type CodeBlockKind ¶
type CodeBlockKind int
CodeBlockKind represents the kind of a CodeBlock: indented or fenced.
const ( // CodeBlockKindIndented indicates an indented code block (4-space or tab indent). CodeBlockKindIndented CodeBlockKind = iota + 1 // CodeBlockKindFenced indicates a fenced code block (“` or ~~~). CodeBlockKindFenced )
func (CodeBlockKind) String ¶
func (k CodeBlockKind) String() string
String returns a human-readable name of the CodeBlockKind.
type CodeBlockOption ¶
type CodeBlockOption interface {
// contains filtered or unexported methods
}
CodeBlockOption is an option for CodeBlock nodes.
func WithCodeBlockInfo ¶
func WithCodeBlockInfo(info text.SingleLineValue) CodeBlockOption
WithCodeBlockInfo returns a CodeBlockOption that sets the info string of a fenced code block.
type CodeSpan ¶
type CodeSpan struct {
// Value holds the content of this code span.
// The content is sourced from the raw Markdown text and may span multiple
// source lines.
//
// This value is expected to be a single line; CommonMark requires that code span content is
// normalized to a single line by replacing newlines with spaces.
//
// Code spans that span multiple lines and return multiple indices from [text.Value].Indices()
// should return normalized single-line data from the Bytes, Str, and Value methods of [text.Value].
Value text.Value
// contains filtered or unexported fields
}
A CodeSpan struct represents a code span of Markdown text.
func NewCodeSpan ¶
NewCodeSpan returns a new CodeSpan node with the given value.
Given value is expected to be a single line; CommonMark requires that code span content is normalized to a single line by replacing newlines with spaces.
You should use CodeBlock for code that you really want to treat as multiple lines.
Code spans that span multiple lines and return multiple indices from text.Value.Indices() should return normalized single-line data from the Bytes, Str, and Value methods of text.Value.
func (*CodeSpan) AppendChild ¶ added in v2.1.6
func (n *CodeSpan) AppendChild(_ Node)
AppendChild implements Node.AppendChild.
func (*CodeSpan) Attribute ¶ added in v2.1.6
func (n *CodeSpan) Attribute(name string) (text.MultiLineValue, bool)
Attribute implements Node.Attribute.
func (*CodeSpan) Attributes ¶ added in v2.1.6
func (n *CodeSpan) Attributes() []Attribute
Attributes implements Node.Attributes.
func (*CodeSpan) ChildCount ¶ added in v2.1.6
func (n *CodeSpan) ChildCount() int
ChildCount implements Node.ChildCount.
func (*CodeSpan) FirstChild ¶ added in v2.1.6
func (n *CodeSpan) FirstChild() Node
FirstChild implements Node.FirstChild.
func (*CodeSpan) FirstRune ¶ added in v2.0.2
FirstRune implements InlineNode.FirstRune.
func (*CodeSpan) HasChildren ¶ added in v2.1.6
func (n *CodeSpan) HasChildren() bool
HasChildren implements Node.HasChildren.
func (*CodeSpan) InsertAfter ¶ added in v2.1.6
InsertAfter implements Node.InsertAfter.
func (*CodeSpan) InsertBefore ¶ added in v2.1.6
InsertBefore implements Node.InsertBefore.
func (*CodeSpan) LastChild ¶ added in v2.1.6
func (n *CodeSpan) LastChild() Node
LastChild implements Node.LastChild.
func (*CodeSpan) LastRune ¶ added in v2.0.2
LastRune implements InlineNode.LastRune.
func (*CodeSpan) NextSibling ¶ added in v2.1.6
func (n *CodeSpan) NextSibling() Node
NextSibling implements Node.NextSibling.
func (*CodeSpan) OwnerDocument ¶ added in v2.1.6
func (n *CodeSpan) OwnerDocument() *Document
OwnerDocument implements Node.OwnerDocument.
func (*CodeSpan) Parent ¶ added in v2.1.6
func (n *CodeSpan) Parent() Node
Parent implements Node.Parent.
func (*CodeSpan) PreviousSibling ¶ added in v2.1.6
func (n *CodeSpan) PreviousSibling() Node
PreviousSibling implements Node.PreviousSibling.
func (*CodeSpan) RemoveAttributes ¶ added in v2.1.6
func (n *CodeSpan) RemoveAttributes()
RemoveAttributes implements Node.RemoveAttributes.
func (*CodeSpan) RemoveChild ¶ added in v2.1.6
func (n *CodeSpan) RemoveChild(_ Node)
RemoveChild implements Node.RemoveChild.
func (*CodeSpan) RemoveChildren ¶ added in v2.1.6
func (n *CodeSpan) RemoveChildren()
RemoveChildren implements Node.RemoveChildren.
func (*CodeSpan) ReplaceChild ¶ added in v2.1.6
ReplaceChild implements Node.ReplaceChild.
func (*CodeSpan) SetAttribute ¶ added in v2.1.6
func (n *CodeSpan) SetAttribute(name string, value text.MultiLineValue)
SetAttribute implements Node.SetAttribute.
func (*CodeSpan) SetNextSibling ¶ added in v2.1.6
func (n *CodeSpan) SetNextSibling(v Node)
SetNextSibling implements Node.SetNextSibling.
func (*CodeSpan) SetParent ¶ added in v2.1.6
func (n *CodeSpan) SetParent(v Node)
SetParent implements Node.SetParent.
func (*CodeSpan) SetPreviousSibling ¶ added in v2.1.6
func (n *CodeSpan) SetPreviousSibling(v Node)
SetPreviousSibling implements Node.SetPreviousSibling.
type Document ¶
type Document struct {
BaseBlock
// contains filtered or unexported fields
}
A Document struct is a root node of Markdown text.
func (*Document) Attribute ¶ added in v2.1.6
func (n *Document) Attribute(name string) (text.MultiLineValue, bool)
Attribute implements Node.Attribute.
func (*Document) Attributes ¶ added in v2.1.6
func (n *Document) Attributes() []Attribute
Attributes implements Node.Attributes.
func (*Document) NextSibling ¶ added in v2.1.6
func (n *Document) NextSibling() Node
NextSibling implements Node.NextSibling.
func (*Document) OwnerDocument ¶
OwnerDocument implements Node.OwnerDocument.
func (*Document) Parent ¶ added in v2.1.6
func (n *Document) Parent() Node
Parent implements Node.Parent.
func (*Document) PreviousSibling ¶ added in v2.1.6
func (n *Document) PreviousSibling() Node
PreviousSibling implements Node.PreviousSibling.
func (*Document) RemoveAttributes ¶ added in v2.1.6
func (n *Document) RemoveAttributes()
RemoveAttributes implements Node.RemoveAttributes.
func (*Document) SetAttribute ¶ added in v2.1.6
func (n *Document) SetAttribute(name string, value text.MultiLineValue)
SetAttribute implements Node.SetAttribute.
func (*Document) SetMetadata ¶
SetMetadata sets given metadata to this document.
func (*Document) SetNextSibling ¶ added in v2.1.6
func (n *Document) SetNextSibling(v Node)
SetNextSibling implements Node.SetNextSibling.
func (*Document) SetParent ¶ added in v2.1.6
func (n *Document) SetParent(v Node)
SetParent implements Node.SetParent.
func (*Document) SetPreviousSibling ¶ added in v2.1.6
func (n *Document) SetPreviousSibling(v Node)
SetPreviousSibling implements Node.SetPreviousSibling.
type Emphasis ¶
type Emphasis struct {
BaseInline
}
An Emphasis struct represents an emphasis of Markdown text (e.g. *text* or _text_).
func (*Emphasis) Attribute ¶ added in v2.1.6
func (n *Emphasis) Attribute(name string) (text.MultiLineValue, bool)
Attribute implements Node.Attribute.
func (*Emphasis) Attributes ¶ added in v2.1.6
func (n *Emphasis) Attributes() []Attribute
Attributes implements Node.Attributes.
func (*Emphasis) NextSibling ¶ added in v2.1.6
func (n *Emphasis) NextSibling() Node
NextSibling implements Node.NextSibling.
func (*Emphasis) Parent ¶ added in v2.1.6
func (n *Emphasis) Parent() Node
Parent implements Node.Parent.
func (*Emphasis) PreviousSibling ¶ added in v2.1.6
func (n *Emphasis) PreviousSibling() Node
PreviousSibling implements Node.PreviousSibling.
func (*Emphasis) RemoveAttributes ¶ added in v2.1.6
func (n *Emphasis) RemoveAttributes()
RemoveAttributes implements Node.RemoveAttributes.
func (*Emphasis) SetAttribute ¶ added in v2.1.6
func (n *Emphasis) SetAttribute(name string, value text.MultiLineValue)
SetAttribute implements Node.SetAttribute.
func (*Emphasis) SetNextSibling ¶ added in v2.1.6
func (n *Emphasis) SetNextSibling(v Node)
SetNextSibling implements Node.SetNextSibling.
func (*Emphasis) SetParent ¶ added in v2.1.6
func (n *Emphasis) SetParent(v Node)
SetParent implements Node.SetParent.
func (*Emphasis) SetPreviousSibling ¶ added in v2.1.6
func (n *Emphasis) SetPreviousSibling(v Node)
SetPreviousSibling implements Node.SetPreviousSibling.
type HTMLBlock ¶
type HTMLBlock struct {
// HTMLBlockKind is the kind of this html block.
HTMLBlockKind HTMLBlockKind
// Value holds the raw HTML content of this block for rendering.
Value text.Lines
// contains filtered or unexported fields
}
An HTMLBlock struct represents an html block of Markdown text.
func NewHTMLBlock ¶
func NewHTMLBlock(kind HTMLBlockKind) *HTMLBlock
NewHTMLBlock returns a new HTMLBlock node.
func (*HTMLBlock) AppendSource ¶ added in v2.1.6
func (*HTMLBlock) HasBlankPreviousLines ¶ added in v2.1.6
func (b *HTMLBlock) HasBlankPreviousLines() bool
func (*HTMLBlock) SetBlankPreviousLines ¶ added in v2.1.6
func (b *HTMLBlock) SetBlankPreviousLines(v bool)
type HTMLBlockKind ¶
type HTMLBlockKind int
HTMLBlockKind represents the kind of an HTMLBlock. See https://spec.commonmark.org/0.30/#html-blocks
const ( // HTMLBlockKind1 represents type 1 html blocks. HTMLBlockKind1 HTMLBlockKind = iota + 1 // HTMLBlockKind2 represents type 2 html blocks. HTMLBlockKind2 // HTMLBlockKind3 represents type 3 html blocks. HTMLBlockKind3 // HTMLBlockKind4 represents type 4 html blocks. HTMLBlockKind4 // HTMLBlockKind5 represents type 5 html blocks. HTMLBlockKind5 // HTMLBlockKind6 represents type 6 html blocks. HTMLBlockKind6 // HTMLBlockKind7 represents type 7 html blocks. HTMLBlockKind7 )
func (HTMLBlockKind) String ¶
func (k HTMLBlockKind) String() string
String returns a human-readable name of the HTMLBlockKind.
type Heading ¶
type Heading struct {
BaseBlock
// Level is the level of this heading.
// This value is between 1 and 6.
Level int
// HeadingKind indicates whether this is an ATX or Setext heading.
HeadingKind HeadingKind
}
A Heading struct represents headings like SetextHeading and ATXHeading.
func NewHeading ¶
func NewHeading(level int, kind HeadingKind) *Heading
NewHeading returns a new Heading node.
func (*Heading) Attribute ¶ added in v2.1.6
func (n *Heading) Attribute(name string) (text.MultiLineValue, bool)
Attribute implements Node.Attribute.
func (*Heading) Attributes ¶ added in v2.1.6
func (n *Heading) Attributes() []Attribute
Attributes implements Node.Attributes.
func (*Heading) NextSibling ¶ added in v2.1.6
func (n *Heading) NextSibling() Node
NextSibling implements Node.NextSibling.
func (*Heading) Parent ¶ added in v2.1.6
func (n *Heading) Parent() Node
Parent implements Node.Parent.
func (*Heading) PreviousSibling ¶ added in v2.1.6
func (n *Heading) PreviousSibling() Node
PreviousSibling implements Node.PreviousSibling.
func (*Heading) RemoveAttributes ¶ added in v2.1.6
func (n *Heading) RemoveAttributes()
RemoveAttributes implements Node.RemoveAttributes.
func (*Heading) SetAttribute ¶ added in v2.1.6
func (n *Heading) SetAttribute(name string, value text.MultiLineValue)
SetAttribute implements Node.SetAttribute.
func (*Heading) SetNextSibling ¶ added in v2.1.6
func (n *Heading) SetNextSibling(v Node)
SetNextSibling implements Node.SetNextSibling.
func (*Heading) SetParent ¶ added in v2.1.6
func (n *Heading) SetParent(v Node)
SetParent implements Node.SetParent.
func (*Heading) SetPreviousSibling ¶ added in v2.1.6
func (n *Heading) SetPreviousSibling(v Node)
SetPreviousSibling implements Node.SetPreviousSibling.
type HeadingKind ¶
type HeadingKind int
HeadingKind represents the kind of a Heading: ATX or Setext.
const ( // HeadingKindATX represents an ATX heading (e.g. ## heading). HeadingKindATX HeadingKind = iota + 1 // HeadingKindSetext represents a Setext heading (underline style). HeadingKindSetext )
func (HeadingKind) String ¶
func (k HeadingKind) String() string
String returns a human-readable name of the HeadingKind.
type Image ¶
type Image struct {
BaseInline
// Destination is a destination(URL) of this link.
Destination text.SingleLineValue
// Title is a title of this link.
Title text.MultiLineValue
// Reference is a reference of this link. This field is used for reference links.
// If this link is not a reference link, this field is nil.
Reference *ReferenceLink
}
An Image struct represents an image of the Markdown text.
func NewImage ¶
func NewImage(destination text.SingleLineValue, opts ...ImageOption) *Image
NewImage returns a new Image node with the given destination and options.
func (*Image) Attribute ¶ added in v2.1.6
func (n *Image) Attribute(name string) (text.MultiLineValue, bool)
Attribute implements Node.Attribute.
func (*Image) Attributes ¶ added in v2.1.6
func (n *Image) Attributes() []Attribute
Attributes implements Node.Attributes.
func (*Image) NextSibling ¶ added in v2.1.6
func (n *Image) NextSibling() Node
NextSibling implements Node.NextSibling.
func (*Image) PreviousSibling ¶ added in v2.1.6
func (n *Image) PreviousSibling() Node
PreviousSibling implements Node.PreviousSibling.
func (*Image) RemoveAttributes ¶ added in v2.1.6
func (n *Image) RemoveAttributes()
RemoveAttributes implements Node.RemoveAttributes.
func (*Image) SetAttribute ¶ added in v2.1.6
func (n *Image) SetAttribute(name string, value text.MultiLineValue)
SetAttribute implements Node.SetAttribute.
func (*Image) SetNextSibling ¶ added in v2.1.6
func (n *Image) SetNextSibling(v Node)
SetNextSibling implements Node.SetNextSibling.
func (*Image) SetParent ¶ added in v2.1.6
func (n *Image) SetParent(v Node)
SetParent implements Node.SetParent.
func (*Image) SetPreviousSibling ¶ added in v2.1.6
func (n *Image) SetPreviousSibling(v Node)
SetPreviousSibling implements Node.SetPreviousSibling.
type ImageOption ¶ added in v2.0.2
type ImageOption interface {
// contains filtered or unexported methods
}
ImageOption is an option for Image nodes.
type InlineNode ¶
type InlineNode interface {
Node
// FirstRune returns the first visible rune of this node's value
// and true if the node has a visible rune, otherwise false.
FirstRune(source []byte) (rune, bool)
// LastRune returns the last visible rune of this node's value
// and true if the node has a visible rune, otherwise false.
LastRune(source []byte) (rune, bool)
// contains filtered or unexported methods
}
An InlineNode interface is a Node that represents an inline element.
type Link ¶
type Link struct {
BaseInline
// Destination is a destination(URL) of this link.
Destination text.SingleLineValue
// Title is a title of this link.
Title text.MultiLineValue
// Reference is a reference of this link. This field is used for reference links.
// If this link is not a reference link, this field is nil.
Reference *ReferenceLink
}
A Link struct represents a link of the Markdown text.
func NewLink ¶
func NewLink(destination text.SingleLineValue, opts ...LinkOption) *Link
NewLink returns a new Link node with the given destination and options.
func (*Link) Attribute ¶ added in v2.1.6
func (n *Link) Attribute(name string) (text.MultiLineValue, bool)
Attribute implements Node.Attribute.
func (*Link) Attributes ¶ added in v2.1.6
func (n *Link) Attributes() []Attribute
Attributes implements Node.Attributes.
func (*Link) NextSibling ¶ added in v2.1.6
func (n *Link) NextSibling() Node
NextSibling implements Node.NextSibling.
func (*Link) PreviousSibling ¶ added in v2.1.6
func (n *Link) PreviousSibling() Node
PreviousSibling implements Node.PreviousSibling.
func (*Link) RemoveAttributes ¶ added in v2.1.6
func (n *Link) RemoveAttributes()
RemoveAttributes implements Node.RemoveAttributes.
func (*Link) SetAttribute ¶ added in v2.1.6
func (n *Link) SetAttribute(name string, value text.MultiLineValue)
SetAttribute implements Node.SetAttribute.
func (*Link) SetNextSibling ¶ added in v2.1.6
func (n *Link) SetNextSibling(v Node)
SetNextSibling implements Node.SetNextSibling.
func (*Link) SetParent ¶ added in v2.1.6
func (n *Link) SetParent(v Node)
SetParent implements Node.SetParent.
func (*Link) SetPreviousSibling ¶ added in v2.1.6
func (n *Link) SetPreviousSibling(v Node)
SetPreviousSibling implements Node.SetPreviousSibling.
type LinkOption ¶
type LinkOption interface {
// contains filtered or unexported methods
}
LinkOption is an option for Link and Image nodes.
type LinkReferenceDefinition ¶
type LinkReferenceDefinition struct {
// Label is a label of this link reference definition.
Label text.MultiLineValue
// Destination is a destination of this link reference definition.
Destination text.SingleLineValue
// Title is a title of this link reference definition.
Title text.MultiLineValue
// contains filtered or unexported fields
}
A LinkReferenceDefinition struct represents a list of Markdown text.
func NewLinkReferenceDefinition ¶
func NewLinkReferenceDefinition( label text.MultiLineValue, destination text.SingleLineValue, opts ...LinkReferenceDefinitionOption) *LinkReferenceDefinition
NewLinkReferenceDefinition returns a new LinkReferenceDefinition node.
func (*LinkReferenceDefinition) AppendSource ¶ added in v2.1.6
func (*LinkReferenceDefinition) Dump ¶
func (l *LinkReferenceDefinition) Dump(_ []byte) *NodeDump
Dump implements Node.Dump.
func (*LinkReferenceDefinition) HasBlankPreviousLines ¶ added in v2.1.6
func (b *LinkReferenceDefinition) HasBlankPreviousLines() bool
func (*LinkReferenceDefinition) Kind ¶
func (l *LinkReferenceDefinition) Kind() NodeKind
Kind implements Node.Kind.
func (*LinkReferenceDefinition) SetBlankPreviousLines ¶ added in v2.1.6
func (b *LinkReferenceDefinition) SetBlankPreviousLines(v bool)
func (*LinkReferenceDefinition) SetPos ¶ added in v2.1.6
func (b *LinkReferenceDefinition) SetPos(v int)
type LinkReferenceDefinitionOption ¶
type LinkReferenceDefinitionOption interface {
// contains filtered or unexported methods
}
LinkReferenceDefinitionOption is an option for LinkReferenceDefinition nodes.
type List ¶
type List struct {
BaseBlock
// Marker is a marker character like '-', '+', ')' and '.'.
Marker byte
// IsTight is a true if this list is a 'tight' list.
// See https://spec.commonmark.org/0.30/#loose for details.
IsTight bool
// Start is an initial number of this ordered list.
// If this list is not an ordered list, Start is 0.
Start int
}
A List struct represents a list of Markdown text.
func (*List) Attribute ¶ added in v2.1.6
func (n *List) Attribute(name string) (text.MultiLineValue, bool)
Attribute implements Node.Attribute.
func (*List) Attributes ¶ added in v2.1.6
func (n *List) Attributes() []Attribute
Attributes implements Node.Attributes.
func (*List) CanContinue ¶
CanContinue returns true if this list can continue with the given marker character and orderedness, otherwise false.
func (*List) NextSibling ¶ added in v2.1.6
func (n *List) NextSibling() Node
NextSibling implements Node.NextSibling.
func (*List) PreviousSibling ¶ added in v2.1.6
func (n *List) PreviousSibling() Node
PreviousSibling implements Node.PreviousSibling.
func (*List) RemoveAttributes ¶ added in v2.1.6
func (n *List) RemoveAttributes()
RemoveAttributes implements Node.RemoveAttributes.
func (*List) SetAttribute ¶ added in v2.1.6
func (n *List) SetAttribute(name string, value text.MultiLineValue)
SetAttribute implements Node.SetAttribute.
func (*List) SetNextSibling ¶ added in v2.1.6
func (n *List) SetNextSibling(v Node)
SetNextSibling implements Node.SetNextSibling.
func (*List) SetParent ¶ added in v2.1.6
func (n *List) SetParent(v Node)
SetParent implements Node.SetParent.
func (*List) SetPreviousSibling ¶ added in v2.1.6
func (n *List) SetPreviousSibling(v Node)
SetPreviousSibling implements Node.SetPreviousSibling.
type ListItem ¶
type ListItem struct {
BaseBlock
// contains filtered or unexported fields
}
A ListItem struct represents a list item of Markdown text.
func (*ListItem) Attribute ¶ added in v2.1.6
func (n *ListItem) Attribute(name string) (text.MultiLineValue, bool)
Attribute implements Node.Attribute.
func (*ListItem) Attributes ¶ added in v2.1.6
func (n *ListItem) Attributes() []Attribute
Attributes implements Node.Attributes.
func (*ListItem) NextSibling ¶ added in v2.1.6
func (n *ListItem) NextSibling() Node
NextSibling implements Node.NextSibling.
func (*ListItem) Offset ¶
Offset returns the content indentation offset used during parsing. This is set by the list parser and is not meaningful for programmatic construction.
func (*ListItem) Parent ¶ added in v2.1.6
func (n *ListItem) Parent() Node
Parent implements Node.Parent.
func (*ListItem) PreviousSibling ¶ added in v2.1.6
func (n *ListItem) PreviousSibling() Node
PreviousSibling implements Node.PreviousSibling.
func (*ListItem) RemoveAttributes ¶ added in v2.1.6
func (n *ListItem) RemoveAttributes()
RemoveAttributes implements Node.RemoveAttributes.
func (*ListItem) SetAttribute ¶ added in v2.1.6
func (n *ListItem) SetAttribute(name string, value text.MultiLineValue)
SetAttribute implements Node.SetAttribute.
func (*ListItem) SetNextSibling ¶ added in v2.1.6
func (n *ListItem) SetNextSibling(v Node)
SetNextSibling implements Node.SetNextSibling.
func (*ListItem) SetOffset ¶
SetOffset sets the content indentation offset. This is called by the list parser during parsing.
func (*ListItem) SetParent ¶ added in v2.1.6
func (n *ListItem) SetParent(v Node)
SetParent implements Node.SetParent.
func (*ListItem) SetPreviousSibling ¶ added in v2.1.6
func (n *ListItem) SetPreviousSibling(v Node)
SetPreviousSibling implements Node.SetPreviousSibling.
type Node ¶
type Node interface {
// Kind returns a kind of this node.
Kind() NodeKind
// Pos returns a position of this node in a source.
// If this node position is not defined, Pos returns -1.
Pos() int
// SetPos sets a position of this node in a source.
// Some node may ignore this method. For example, Paragraph node ignores this method because
// it calculates its position from its lines.
SetPos(v int)
// NextSibling returns a next sibling node of this node.
NextSibling() Node
// PreviousSibling returns a previous sibling node of this node.
PreviousSibling() Node
// Parent returns a parent node of this node.
Parent() Node
// SetParent sets a parent node to this node.
SetParent(Node)
// SetPreviousSibling sets a previous sibling node to this node.
SetPreviousSibling(Node)
// SetNextSibling sets a next sibling node to this node.
SetNextSibling(Node)
// HasChildren returns true if this node has any children, otherwise false.
HasChildren() bool
// ChildCount returns a total number of children.
ChildCount() int
// Children returns an iterator of children of this node.
Children() iter.Seq[Node]
// FirstChild returns a first child of this node.
FirstChild() Node
// LastChild returns a last child of this node.
LastChild() Node
// AppendChild append a node child to the tail of the children.
AppendChild(child Node)
// RemoveChild removes a node child from this node.
// If a node child is not children of this node, RemoveChild nothing to do.
RemoveChild(child Node)
// RemoveChildren removes all children from this node.
RemoveChildren()
// ReplaceChild replaces a node target with a node insertee.
// If target is not a child of this node, ReplaceChild appends insertee to the
// tail of the children.
ReplaceChild(target, insertee Node)
// InsertBefore inserts a node insertee before a node target.
// If target is not a child of this node, InsertBefore appends insertee to the
// tail of the children.
InsertBefore(target, insertee Node)
// InsertAfter inserts a node insertee after a node target.
// If target is not a child of this node, InsertAfter appends insertee to the
// tail of the children.
InsertAfter(target, insertee Node)
// OwnerDocument returns this node's owner document.
// If this node is not a child of the Document node, OwnerDocument
// returns nil.
OwnerDocument() *Document
// Dump dumps an AST node.
Dump(source []byte) *NodeDump
// SetAttribute sets the given value to the attributes.
SetAttribute(name string, value text.MultiLineValue)
// Attribute returns a (attribute value, true) if an attribute
// associated with the given name is found, otherwise
// (zero MultiLineValue, false)
Attribute(name string) (text.MultiLineValue, bool)
// Attributes returns a list of attributes.
// This may be a nil if there are no attributes.
Attributes() []Attribute
// RemoveAttributes removes all attributes from this node.
RemoveAttributes()
}
A Node interface defines basic AST node functionalities.
func N ¶
N is a helper function to create a new node with children.
Children must be a Node or a string. If a child is a string, N creates a Text node with the string and append it to the children. Given string must be a decoded string:
- Good: `N(NewParagraph(), "Hello, World!")` - Bad: `N(NewParagraph(), "Hello, World!")`
N panics if a child is not a Node or a string.
type NodeDump ¶
type NodeDump struct {
// Node is the node to be dumped.
Node Node
// Properties is a map of additional properties to be dumped.
// Property names should be PascalCase.
Properties map[string]any
}
NodeDump is a struct that holds information for dumping a node.
func NewNodeDump ¶
NewNodeDump returns a new NodeDump.
func (*NodeDump) PrettyPrint ¶
PrettyPrint pretty prints this node dump to the given writer.
PrettyPrint format may change in the future. Do not rely on the format. This method is intended for debugging purpose only. The returned error is from the writer. If the writer never returns an error, the returned error is always nil.
type NodeKind ¶
type NodeKind int
NodeKind identifies the concrete type of a Node.
var CurrentKindValue NodeKind
CurrentKindValue is the current value of NodeKind.
You **MUST NOT** use this value. This value is public for the goldmark internal package to use.
type Paragraph ¶
type Paragraph struct {
BaseBlock
}
A Paragraph struct represents a paragraph of Markdown text.
func (*Paragraph) Attribute ¶ added in v2.1.6
func (n *Paragraph) Attribute(name string) (text.MultiLineValue, bool)
Attribute implements Node.Attribute.
func (*Paragraph) Attributes ¶ added in v2.1.6
func (n *Paragraph) Attributes() []Attribute
Attributes implements Node.Attributes.
func (*Paragraph) NextSibling ¶ added in v2.1.6
func (n *Paragraph) NextSibling() Node
NextSibling implements Node.NextSibling.
func (*Paragraph) Parent ¶ added in v2.1.6
func (n *Paragraph) Parent() Node
Parent implements Node.Parent.
func (*Paragraph) PreviousSibling ¶ added in v2.1.6
func (n *Paragraph) PreviousSibling() Node
PreviousSibling implements Node.PreviousSibling.
func (*Paragraph) RemoveAttributes ¶ added in v2.1.6
func (n *Paragraph) RemoveAttributes()
RemoveAttributes implements Node.RemoveAttributes.
func (*Paragraph) SetAttribute ¶ added in v2.1.6
func (n *Paragraph) SetAttribute(name string, value text.MultiLineValue)
SetAttribute implements Node.SetAttribute.
func (*Paragraph) SetNextSibling ¶ added in v2.1.6
func (n *Paragraph) SetNextSibling(v Node)
SetNextSibling implements Node.SetNextSibling.
func (*Paragraph) SetParent ¶ added in v2.1.6
func (n *Paragraph) SetParent(v Node)
SetParent implements Node.SetParent.
func (*Paragraph) SetPreviousSibling ¶ added in v2.1.6
func (n *Paragraph) SetPreviousSibling(v Node)
SetPreviousSibling implements Node.SetPreviousSibling.
type PrettyPrintOption ¶
type PrettyPrintOption func(*ppCfg)
PrettyPrintOption is a function that modifies the configuration of PrettyPrint.
func WithLevel ¶
func WithLevel(level int) PrettyPrintOption
WithLevel returns an option that sets the indentation level for PrettyPrint.
func WithSource ¶
func WithSource(include bool) PrettyPrintOption
WithSource returns an option that sets whether to include the source text in the PrettyPrint output.
type RawHTML ¶
type RawHTML struct {
// Value holds the raw HTML content.
Value text.MultiLineValue
// contains filtered or unexported fields
}
A RawHTML struct represents an inline raw HTML of the Markdown text.
func NewRawHTML ¶
func NewRawHTML(value text.MultiLineValue) *RawHTML
NewRawHTML returns a new RawHTML node with the given value.
func (*RawHTML) AppendChild ¶ added in v2.1.6
func (n *RawHTML) AppendChild(_ Node)
AppendChild implements Node.AppendChild.
func (*RawHTML) Attribute ¶ added in v2.1.6
func (n *RawHTML) Attribute(name string) (text.MultiLineValue, bool)
Attribute implements Node.Attribute.
func (*RawHTML) Attributes ¶ added in v2.1.6
func (n *RawHTML) Attributes() []Attribute
Attributes implements Node.Attributes.
func (*RawHTML) ChildCount ¶ added in v2.1.6
func (n *RawHTML) ChildCount() int
ChildCount implements Node.ChildCount.
func (*RawHTML) FirstChild ¶ added in v2.1.6
func (n *RawHTML) FirstChild() Node
FirstChild implements Node.FirstChild.
func (*RawHTML) FirstRune ¶ added in v2.1.6
FirstRune implements InlineNode.FirstRune.
func (*RawHTML) HasChildren ¶ added in v2.1.6
func (n *RawHTML) HasChildren() bool
HasChildren implements Node.HasChildren.
func (*RawHTML) InsertAfter ¶ added in v2.1.6
InsertAfter implements Node.InsertAfter.
func (*RawHTML) InsertBefore ¶ added in v2.1.6
InsertBefore implements Node.InsertBefore.
func (*RawHTML) LastChild ¶ added in v2.1.6
func (n *RawHTML) LastChild() Node
LastChild implements Node.LastChild.
func (*RawHTML) LastRune ¶ added in v2.1.6
LastRune implements InlineNode.LastRune.
func (*RawHTML) NextSibling ¶ added in v2.1.6
func (n *RawHTML) NextSibling() Node
NextSibling implements Node.NextSibling.
func (*RawHTML) OwnerDocument ¶ added in v2.1.6
func (n *RawHTML) OwnerDocument() *Document
OwnerDocument implements Node.OwnerDocument.
func (*RawHTML) Parent ¶ added in v2.1.6
func (n *RawHTML) Parent() Node
Parent implements Node.Parent.
func (*RawHTML) PreviousSibling ¶ added in v2.1.6
func (n *RawHTML) PreviousSibling() Node
PreviousSibling implements Node.PreviousSibling.
func (*RawHTML) RemoveAttributes ¶ added in v2.1.6
func (n *RawHTML) RemoveAttributes()
RemoveAttributes implements Node.RemoveAttributes.
func (*RawHTML) RemoveChild ¶ added in v2.1.6
func (n *RawHTML) RemoveChild(_ Node)
RemoveChild implements Node.RemoveChild.
func (*RawHTML) RemoveChildren ¶ added in v2.1.6
func (n *RawHTML) RemoveChildren()
RemoveChildren implements Node.RemoveChildren.
func (*RawHTML) ReplaceChild ¶ added in v2.1.6
ReplaceChild implements Node.ReplaceChild.
func (*RawHTML) SetAttribute ¶ added in v2.1.6
func (n *RawHTML) SetAttribute(name string, value text.MultiLineValue)
SetAttribute implements Node.SetAttribute.
func (*RawHTML) SetNextSibling ¶ added in v2.1.6
func (n *RawHTML) SetNextSibling(v Node)
SetNextSibling implements Node.SetNextSibling.
func (*RawHTML) SetParent ¶ added in v2.1.6
func (n *RawHTML) SetParent(v Node)
SetParent implements Node.SetParent.
func (*RawHTML) SetPreviousSibling ¶ added in v2.1.6
func (n *RawHTML) SetPreviousSibling(v Node)
SetPreviousSibling implements Node.SetPreviousSibling.
type ReferenceLink ¶
type ReferenceLink struct {
// ReferenceLinkKind is the kind of this reference link.
ReferenceLinkKind ReferenceLinkKind
// Value is a value of this reference link.
Value text.MultiLineValue
}
ReferenceLink struct represents a reference link of the Markdown text.
func NewReferenceLink ¶
func NewReferenceLink(kind ReferenceLinkKind, value text.MultiLineValue) *ReferenceLink
NewReferenceLink returns a new ReferenceLink with the given kind and value.
type ReferenceLinkKind ¶
type ReferenceLinkKind int
ReferenceLinkKind represents the kind of a reference link.
const ( // ReferenceLinkKindFull indicates that a reference link has a full reference like [foo][bar]. ReferenceLinkKindFull ReferenceLinkKind = iota + 1 // ReferenceLinkKindCollapsed indicates that a reference link has a collapsed reference like [foo][]. ReferenceLinkKindCollapsed // ReferenceLinkKindShortcut indicates that a reference link has a shortcut reference like [foo]. ReferenceLinkKindShortcut )
func (ReferenceLinkKind) String ¶
func (t ReferenceLinkKind) String() string
String returns a string representation of this reference link kind.
type Strong ¶
type Strong struct {
BaseInline
}
A Strong struct represents strong importance of Markdown text (e.g. **text** or __text__).
func (*Strong) Attribute ¶ added in v2.1.6
func (n *Strong) Attribute(name string) (text.MultiLineValue, bool)
Attribute implements Node.Attribute.
func (*Strong) Attributes ¶ added in v2.1.6
func (n *Strong) Attributes() []Attribute
Attributes implements Node.Attributes.
func (*Strong) NextSibling ¶ added in v2.1.6
func (n *Strong) NextSibling() Node
NextSibling implements Node.NextSibling.
func (*Strong) Parent ¶ added in v2.1.6
func (n *Strong) Parent() Node
Parent implements Node.Parent.
func (*Strong) PreviousSibling ¶ added in v2.1.6
func (n *Strong) PreviousSibling() Node
PreviousSibling implements Node.PreviousSibling.
func (*Strong) RemoveAttributes ¶ added in v2.1.6
func (n *Strong) RemoveAttributes()
RemoveAttributes implements Node.RemoveAttributes.
func (*Strong) SetAttribute ¶ added in v2.1.6
func (n *Strong) SetAttribute(name string, value text.MultiLineValue)
SetAttribute implements Node.SetAttribute.
func (*Strong) SetNextSibling ¶ added in v2.1.6
func (n *Strong) SetNextSibling(v Node)
SetNextSibling implements Node.SetNextSibling.
func (*Strong) SetParent ¶ added in v2.1.6
func (n *Strong) SetParent(v Node)
SetParent implements Node.SetParent.
func (*Strong) SetPreviousSibling ¶ added in v2.1.6
func (n *Strong) SetPreviousSibling(v Node)
SetPreviousSibling implements Node.SetPreviousSibling.
type Text ¶
type Text struct {
// Value is the text value. It is either a source position or an owned string.
Value text.SingleLineValue
// contains filtered or unexported fields
}
A Text struct represents a textual content of the Markdown text.
func (*Text) AppendChild ¶ added in v2.1.6
func (n *Text) AppendChild(_ Node)
AppendChild implements Node.AppendChild.
func (*Text) Attribute ¶ added in v2.1.6
func (n *Text) Attribute(name string) (text.MultiLineValue, bool)
Attribute implements Node.Attribute.
func (*Text) Attributes ¶ added in v2.1.6
func (n *Text) Attributes() []Attribute
Attributes implements Node.Attributes.
func (*Text) ChildCount ¶ added in v2.1.6
func (n *Text) ChildCount() int
ChildCount implements Node.ChildCount.
func (*Text) FirstChild ¶ added in v2.1.6
func (n *Text) FirstChild() Node
FirstChild implements Node.FirstChild.
func (*Text) FirstRune ¶ added in v2.1.6
FirstRune implements InlineNode.FirstRune.
func (*Text) HardLineBreak ¶
HardLineBreak returns true if this node ends with a hard line break. See https://spec.commonmark.org/0.30/#hard-line-breaks for details.
func (*Text) HasChildren ¶ added in v2.1.6
func (n *Text) HasChildren() bool
HasChildren implements Node.HasChildren.
func (*Text) InsertAfter ¶ added in v2.1.6
InsertAfter implements Node.InsertAfter.
func (*Text) InsertBefore ¶ added in v2.1.6
InsertBefore implements Node.InsertBefore.
func (*Text) LastChild ¶ added in v2.1.6
func (n *Text) LastChild() Node
LastChild implements Node.LastChild.
func (*Text) LastRune ¶ added in v2.1.6
LastRune implements InlineNode.LastRune.
func (*Text) NextSibling ¶ added in v2.1.6
func (n *Text) NextSibling() Node
NextSibling implements Node.NextSibling.
func (*Text) OwnerDocument ¶ added in v2.1.6
func (n *Text) OwnerDocument() *Document
OwnerDocument implements Node.OwnerDocument.
func (*Text) PreviousSibling ¶ added in v2.1.6
func (n *Text) PreviousSibling() Node
PreviousSibling implements Node.PreviousSibling.
func (*Text) RemoveAttributes ¶ added in v2.1.6
func (n *Text) RemoveAttributes()
RemoveAttributes implements Node.RemoveAttributes.
func (*Text) RemoveChild ¶ added in v2.1.6
func (n *Text) RemoveChild(_ Node)
RemoveChild implements Node.RemoveChild.
func (*Text) RemoveChildren ¶ added in v2.1.6
func (n *Text) RemoveChildren()
RemoveChildren implements Node.RemoveChildren.
func (*Text) ReplaceChild ¶ added in v2.1.6
ReplaceChild implements Node.ReplaceChild.
func (*Text) SetAttribute ¶ added in v2.1.6
func (n *Text) SetAttribute(name string, value text.MultiLineValue)
SetAttribute implements Node.SetAttribute.
func (*Text) SetHardLineBreak ¶
SetHardLineBreak sets whether this node ends with a hard line break.
func (*Text) SetNextSibling ¶ added in v2.1.6
func (n *Text) SetNextSibling(v Node)
SetNextSibling implements Node.SetNextSibling.
func (*Text) SetParent ¶ added in v2.1.6
func (n *Text) SetParent(v Node)
SetParent implements Node.SetParent.
func (*Text) SetPreviousSibling ¶ added in v2.1.6
func (n *Text) SetPreviousSibling(v Node)
SetPreviousSibling implements Node.SetPreviousSibling.
func (*Text) SetSoftLineBreak ¶
SetSoftLineBreak sets whether this node ends with a new line.
func (*Text) SoftLineBreak ¶
SoftLineBreak returns true if this node ends with a new line, otherwise false.
type ThematicBreak ¶
type ThematicBreak struct {
// contains filtered or unexported fields
}
A ThematicBreak struct represents a thematic break of Markdown text.
func NewThematicBreak ¶
func NewThematicBreak() *ThematicBreak
NewThematicBreak returns a new ThematicBreak node.
func (*ThematicBreak) AppendSource ¶ added in v2.1.6
func (*ThematicBreak) Dump ¶
func (n *ThematicBreak) Dump(_ []byte) *NodeDump
Dump implements Node.Dump .
func (*ThematicBreak) HasBlankPreviousLines ¶ added in v2.1.6
func (b *ThematicBreak) HasBlankPreviousLines() bool
func (*ThematicBreak) SetBlankPreviousLines ¶ added in v2.1.6
func (b *ThematicBreak) SetBlankPreviousLines(v bool)
type WalkStatus ¶
type WalkStatus int
WalkStatus represents a current status of the Walk function.
const ( // WalkStop indicates no more walking needed. WalkStop WalkStatus = iota + 1 // WalkSkipChildren indicates that Walk will not walk on children of the current // node. WalkSkipChildren // WalkContinue indicates that Walk can continue to walk. WalkContinue )