all repos — grayfriday @ 04673c9f2899eac2c8c1a44df63682963ad4e121

blackfriday fork with a few changes

Improve documentation for Node struct
Vytautas Ĺ altenis vytas@rtfb.lt
Fri, 01 Apr 2016 12:33:05 +0300
commit

04673c9f2899eac2c8c1a44df63682963ad4e121

parent

8a4d4fa0cdedd8c2584f6fc48bb40ac4c15ebc47

1 files changed, 17 insertions(+), 14 deletions(-)

jump to
M node.gonode.go

@@ -98,24 +98,27 @@ HeaderID string // This might hold header ID, if present

IsTitleblock bool // Specifies whether it's a title block } +// Node is a single element in the abstract syntax tree of the parsed document. +// It holds connections to the structurally neighboring nodes and, for certain +// types of nodes, additional information that might be needed when rendering. type Node struct { - Type NodeType - Parent *Node - FirstChild *Node - LastChild *Node - Prev *Node // prev sibling - Next *Node // next sibling + Type NodeType // Determines the type of the node + Parent *Node // Points to the parent + FirstChild *Node // Points to the first child, if any + LastChild *Node // Points to the last child, if any + Prev *Node // Previous sibling; nil if it's the first child + Next *Node // Next sibling; nil if it's the last child - content []byte - open bool + Literal []byte // Text contents of the leaf nodes - Literal []byte + HeaderData // Populated if Type == Header + ListData // Populated if Type == List + CodeBlockData // Populated if Type == CodeBlock + LinkData // Populated if Type == Link + TableCellData // Populated if Type == TableCell - HeaderData // If Type == Header, this holds its properties - ListData // If Type == List, this holds list info - CodeBlockData // If Type == CodeBlock, this holds its properties - LinkData // If Type == Link, this holds link info - TableCellData // If Type == TableCell, this holds its properties + content []byte // Markdown content of the block nodes + open bool // Specifies an open block node that has not been finished to process yet } func NewNode(typ NodeType) *Node {