Package ast defines tree representation of a parsed markdown document.
This section is empty.
This section is empty.
func AppendChild(parent Node, child Node)
AppendChild appends child to children of parent It panics if either node is nil.
Print is for debugging. It prints a string representation of parsed markdown doc (result of parser.Parse()) to dst.
To make output readable, it shortens text output.
PrintWithPrefix is like Print but allows customizing prefix used for indentation. By default it's 2 spaces. You can change it to e.g. tab by passing "\t"
func RemoveFromTree(n Node)
RemoveFromTree removes this node from tree
ToString is like Dump but returns result as a string
WalkFunc is like Walk but accepts just a callback function
Aside represents an markdown aside node.
An attribute can be attached to block elements. They are specified as {#id .classs key="value"} where quotes for values are mandatory, multiple key/value pairs are separated by whitespace.
BlockQuote represents markdown block quote node
Callout is a node that can exist both in text (where it is an actual node) and in a code block.
type CanContain interface { CanContain(Node) bool }
return true if can contain children of a given node type used by custom nodes to over-ride logic in canNodeContain
Caption represents a figure, code or quote caption
CaptionFigure is a node (blockquote or codeblock) that has a caption
CellAlignFlags holds a type of alignment in a table cell.
These are the possible flag values for the table cell renderer. Only a single one of these values will be used; they are not ORed together. These are mostly of interest if you are writing a new output format.
Citation is a citation node.
CitationTypes holds the type of a citation, informative, normative or suppressed
const ( CitationTypeNone CitationTypes = iota CitationTypeSuppressed CitationTypeInformative CitationTypeNormative )
type Code struct { Leaf }
Code represents markdown code node
CodeBlock represents markdown code block node
Container is a type of node that can contain children
AsContainer returns itself as *Container
GetChildren returns children nodes
GetParent returns parent node
SetChildren sets children node
SetParent sets the parent node
CrossReference is a reference node.
Del represents markdown del node
Document represents markdown document node, a root of ast
DocumentMatter represents markdown node that signals a document division: frontmatter, mainmatter or backmatter.
DocumentMatters holds the type of a {front,main,back}matter in the document
const ( DocumentMatterNone DocumentMatters = iota DocumentMatterFront DocumentMatterMain DocumentMatterBack )
These are all possible Document divisions.
Emph represents markdown emphasis node
type Footnotes struct { }
Footnotes is a node that contains all footnotes
type HTMLBlock struct { Leaf }
HTMLBlock represents markdown html node
type HTMLSpan struct { Leaf }
HTMLSpan represents markdown html span node
type Hardbreak struct { Leaf }
Hardbreak represents markdown hard break node
Heading represents markdown heading node
type HorizontalRule struct { Leaf }
HorizontalRule represents markdown horizontal rule node
Image represents markdown image node
Index is a node that contains an Index item and an optional, subitem.
Leaf is a type of node that cannot have children
AsLeaf returns itself as *Leaf
GetChildren returns nil because Leaf cannot have children
GetParent returns parent node
func (l *Leaf) SetChildren(newChildren []Node)
SetChildren will panic if trying to set non-empty children because Leaf cannot have children
func (l *Leaf) SetParent(newParent Node)
SetParent sets the parent nodd
Link represents markdown link node
List represents markdown list node
ListItem represents markdown list item node
ListType contains bitwise or'ed flags for list and list item objects.
const ( ListTypeOrdered ListType = 1 << iota ListTypeDefinition ListTypeTerm ListItemContainsBlock ListItemBeginningOfList ListItemEndOfList )
These are the possible flag values for the ListItem renderer. Multiple flag values may be ORed together. These are mostly of interest if you are writing a new output format.
type Math struct { Leaf }
Math represents markdown MathAjax inline node
MathBlock represents markdown MathAjax block node
type Node interface { AsContainer() *Container AsLeaf() *Leaf GetParent() Node SetParent(newParent Node) GetChildren() []Node SetChildren(newChildren []Node) }
Node defines an ast node
GetFirstChild returns first child of node n It's implemented as stand-alone function to keep Node interface small
GetLastChild returns last child of node n It's implemented as stand-alone function to keep Node interface small
GetNextNode returns next sibling of node n (node after n) We can't make it part of Container or Leaf because we loose Node identity
GetPrevNode returns previous sibling of node n (node before n) We can't make it part of Container or Leaf because we loose Node identity
NodeVisitor is a callback to be called when traversing the syntax tree. Called twice for every node: once with entering=true when the branch is first visited, then with entering=false after all the children are done.
NodeVisitorFunc casts a function to match NodeVisitor interface
Visit calls visitor function
type NonBlockingSpace struct { Leaf }
NonBlockingSpace represents markdown non-blocking space node
Paragraph represents markdown paragraph node
type Softbreak struct { Leaf }
Softbreak represents markdown softbreak node Note: not used currently
Strong represents markdown strong node
type Subscript struct { Leaf }
Subscript is a subscript node
type Superscript struct { Leaf }
Subscript is a superscript node
Table represents markdown table node
type TableBody ΒΆTableBody represents markdown table body node
TableCell represents markdown table cell node
type TableFooter struct { }
TableFooter represents markdown table foot node
type TableHeader struct { }
TableHeader represents markdown table head node
TableRow represents markdown table row node
type Text struct { Leaf }
Text represents markdown text node
WalkStatus allows NodeVisitor to have some control over the tree traversal. It is returned from NodeVisitor and different values allow Node.Walk to decide which node to go to next.
Walk traverses tree recursively
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4