Documentation
¶
Overview ¶
Package markdown reads a document's body into an outline: the tree of its blocks and inline pieces as goldmark parses them, each holding its position in the body as written. It knows nothing of documents, sections or rules, and is the only package that imports goldmark.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Line ¶
Line is one line of a leaf block's content: the bytes of the body it was read from, and the columns of a tab before them that a container's marker covered only in part, which the content holds as spaces.
type Node ¶
type Node struct {
Type Type
Span
Children []*Node
// Lines is a leaf block's content, line by line.
Lines []Line
// Text is a text's text with escapes and entities resolved, a code span's
// or code block's content, raw HTML and an HTML block as written, and an
// autolink's text.
Text string
Level int // a heading's level
Setext bool // a heading written with an underline
Ordered bool // a list
Number int // an ordered list's first number
Delimiter byte // a list's marker: '-', '+', '*', '.' or ')'
Tight bool // a list
Fenced bool // a code block
Info string
Closed bool // a fenced code block or an HTML block its end marker closes
Align string // a table cell: "left", "center", "right" or ""
Hard bool // a line break
// ClosedByMarker is an HTML block of CommonMark types 1 to 5, opened by
// script, pre, style or textarea, a comment, a processing instruction, a
// declaration or CDATA, which only its end marker closes.
ClosedByMarker bool
// Destination and Title are a link's, an image's or a link reference
// definition's, resolved. Label is a reference's or a definition's label
// as written, which the parser matches labels by, ignoring case and runs
// of spaces for a link and neither for a footnote. Each part's span is its bytes as written, and a
// link's or an image's TextSpan the bytes between its brackets. A link
// or image by reference has its definition's destination and title, and
// no span for either.
TextSpan Span
Destination, Title, Label string
DestinationSpan, TitleSpan, LabelSpan Span
HasDestination, HasTitle, HasLabel bool
AutoLink bool // a link written as <...> or found by the linkify extension
Reference bool // a link or image by reference
}
Node is a block or an inline piece of the outline.
type Span ¶
type Span struct{ Start, End int }
Span is a range of bytes in the body, the end exclusive.