abstract class markdown::Node
sys::Obj markdown::Node
@Js
Base class for all CommonMark AST nodes.
The CommonMark AST is a tree of nodes where each node can have any number of children and one parent - except the root node which has no parent.
- addSourceSpan
-
Void addSourceSpan(SourceSpan? sourceSpan)
Add a source span to the end of the list. If it is null, this is a no-op
- appendChild
-
Insert the child node as the last child node of this node.
- children
-
static Node[] children(Node parent)
Get all the children of the given parent node
- eachBetween
-
static Void eachBetween(Node start, Node end, |Node| f)
Get nodes between start (exclusive) and end (exclusive)
- find
-
static Node find(Node parent, Type nodeType)
Recursively try to find a node with the given type within the children of the specified node. Throw if node could not be found
- firstChild
-
Node? firstChild { private set }
- insertAfter
-
Void insertAfter(Node sibling)
Inserts the sibling node after this node
- insertBefore
-
Void insertBefore(Node sibling)
Inserts the sibiling node before this node
- lastChild
-
Node? lastChild { private set }
- make
-
new make()
- next
-
Node? next { private set }
- parent
-
virtual Node? parent()
The parent node or null if this is the root of the AST
- prev
-
Node? prev { private set }
- setParent
-
protected virtual Void setParent(Node? p)
Used by sub-classes to set or clear this node's parent
- setSourceSpans
-
Void setSourceSpans(SourceSpan[] sourceSpans)
Replace the current source spans with the provided list
- sourceSpans
-
SourceSpan[]? sourceSpans := null { private set }
- toStr
-
virtual override Str toStr()
- toStrAttributes
-
protected virtual Str toStrAttributes()
- tryFind
-
static Node? tryFind(Node parent, Type nodeType)
Recursively try to find a node with the given type within the children of the specified node.
- unlink
-
Void unlink()
Completely detach this node from the AST
- walk
-
virtual Void walk(Visitor visitor)
Walk the AST using the given visitor. By default, we use reflection to call
visitor.visit${this.typeof.name}