func (n *Node) AppendChild(child *Node) {
	child.Unlink()
	child.Parent = n
	if n.LastChild != nil {
		n.LastChild.Next = child
		child.Prev = n.LastChild
		n.LastChild = child
	} else {
		n.FirstChild = child
		n.LastChild = child
	}
}
AppendChild adds a node 'child' as a child of 'n'.
It panics if either node is nil.
package blackfriday
import (
	"bytes"
	"fmt"
)
type NodeType int
const (
	Document NodeType = iota
	BlockQuote
	List
	Item
	Paragraph
	Heading
	HorizontalRule
	Emph
	Strong
	Del
	Link
	Image
	Text
	HTMLBlock
	CodeBlock
	Softbreak
	Hardbreak
	Code
	HTMLSpan
	Table
	TableCell
	TableHead
	TableBody
	TableRow
)
var nodeTypeNames = []string{
	Document:       "Document",
	BlockQuote:     "BlockQuote",
	List:           "List",
	Item:           "Item",
	Paragraph:      "Paragraph",
	Heading:        "Heading",
	HorizontalRule: "HorizontalRule",
	Emph:           "Emph",
	Strong:         "Strong",
	Del:            "Del",
	Link:           "Link",
	Image:          "Image",
	Text:           "Text",
	HTMLBlock:      "HTMLBlock",
	CodeBlock:      "CodeBlock",
	Softbreak:      "Softbreak",
	Hardbreak:      "Hardbreak",
	Code:           "Code",
	HTMLSpan:       "HTMLSpan",
	Table:          "Table",
	TableCell:      "TableCell",
	TableHead:      "TableHead",
	TableBody:      "TableBody",
	TableRow:       "TableRow",
}
func (t NodeType) String() string {
	return nodeTypeNames[t]
}
type ListData struct {
	ListFlags       ListType
	Tight           bool    
	BulletChar      byte    
	Delimiter       byte    
	RefLink         []byte  
	IsFootnotesList bool    
}
type LinkData struct {
	Destination []byte  
	Title       []byte  
	NoteID      int     
	Footnote    *Node   
}
type CodeBlockData struct {
	IsFenced    bool    
	Info        []byte  
	FenceChar   byte
	FenceLength int
	FenceOffset int
}
type TableCellData struct {
	IsHeader bool            
	Align    CellAlignFlags  
}
type HeadingData struct {
	Level        int     
	HeadingID    string  
	IsTitleblock bool    
}
type Node struct {
	Type       NodeType  
	Parent     *Node     
	FirstChild *Node     
	LastChild  *Node     
	Prev       *Node     
	Next       *Node     
	Literal []byte  
	HeadingData    
	ListData       
	CodeBlockData  
	LinkData       
	TableCellData  
	content []byte  
	open    bool    
}
func NewNode(typ NodeType) *Node {
	return &Node{
		Type: typ,
		open: true,
	}
}
func (n *Node) String() string {
	ellipsis := ""
	snippet := n.Literal
	if len(snippet) > 16 {
		snippet = snippet[:16]
		ellipsis = "..."
	}
	return fmt.Sprintf("%s: '%s%s'", n.Type, snippet, ellipsis)
}
func (n *Node) Unlink() {
	if n.Prev != nil {
		n.Prev.Next = n.Next
	} else if n.Parent != nil {
		n.Parent.FirstChild = n.Next
	}
	if n.Next != nil {
		n.Next.Prev = n.Prev
	} else if n.Parent != nil {
		n.Parent.LastChild = n.Prev
	}
	n.Parent = nil
	n.Next = nil
	n.Prev = nil
}