Documentation
¶
Index ¶
- Constants
- func DumpFile(fn string)
- func DumpNode(node Node, level int) string
- func NewParse(input string, opts *Options) *parse
- func ParseFile(fn string) *parse
- func Render(input string) string
- func RenderFile(fn string) string
- type AlignType
- type BlockQuoteNode
- type BrNode
- type CellNode
- type CheckboxNode
- type CodeNode
- type DefLinkNode
- type EmphasisNode
- type HTMLNode
- type HeadingNode
- type HrNode
- type ImageNode
- type Lexer
- type LinkNode
- type ListItemNode
- type ListNode
- type Mark
- type Node
- type NodeType
- type Options
- type ParagraphNode
- type Pos
- type RefNode
- type RenderFn
- type RowNode
- type TableNode
- type TextNode
Constants ¶
const ( Header = iota Data )
Cell types
Variables ¶
This section is empty.
Functions ¶
func RenderFile ¶
Types ¶
type BlockQuoteNode ¶
BlockQuote represents block-quote tag.
func (*BlockQuoteNode) NodeName ¶
func (n *BlockQuoteNode) NodeName() (s string)
func (*BlockQuoteNode) Render ¶
func (n *BlockQuoteNode) Render() string
Render returns the html representation of BlockQuote
type CellNode ¶
CellNode represents table-data/cell that holds simple text(may be emphasis) Note: the text in <th> elements are bold and centered by default.
type CheckboxNode ¶
CheckboxNode represents checked and unchecked checkbox tag. Used in task lists.
func (*CheckboxNode) NodeName ¶
func (n *CheckboxNode) NodeName() (s string)
func (*CheckboxNode) Render ¶
func (n *CheckboxNode) Render() string
Render returns the html representation of checked and unchecked CheckBox.
type DefLinkNode ¶
DefLinkNode refresent single reference to link-definition
func (*DefLinkNode) NodeName ¶
func (n *DefLinkNode) NodeName() (s string)
func (*DefLinkNode) Render ¶
func (n *DefLinkNode) Render() string
Deflink have no representation(Transparent node)
type EmphasisNode ¶
EmphasisNode holds plain-text wrapped with style. (strong, em, del, code)
func (*EmphasisNode) NodeName ¶
func (n *EmphasisNode) NodeName() (s string)
func (*EmphasisNode) Render ¶
func (n *EmphasisNode) Render() string
Return the html representation of emphasis text.
func (*EmphasisNode) Tag ¶
func (n *EmphasisNode) Tag() (s string)
Tag return the tagName based on the Style field.
type HeadingNode ¶
HeadingNode holds heaing element with specific level(1-6).
func (*HeadingNode) NodeName ¶
func (n *HeadingNode) NodeName() (s string)
func (*HeadingNode) Render ¶
func (n *HeadingNode) Render() (s string)
Render returns the html representation based on heading level.
type Lexer ¶
type Lexer interface {
// contains filtered or unexported methods
}
Lexer interface, used to composed it inside the parser
type ListItemNode ¶
ListItem represents single item in ListNode that may contains nested nodes.
func (*ListItemNode) Children ¶
func (n *ListItemNode) Children() []Node
func (*ListItemNode) NodeName ¶
func (n *ListItemNode) NodeName() string
func (*ListItemNode) Render ¶
func (l *ListItemNode) Render() (s string)
Render returns the html representation of list-item
type ListNode ¶
type ListNode struct { NodeType Pos Ordered bool Items []*ListItemNode }
ListNode holds list items nodes in ordered or unordered states.
type Mark ¶
type Mark struct { Input string // contains filtered or unexported fields }
Mark
func (*Mark) AddRenderFn ¶
AddRenderFn let you pass NodeType, and RenderFn function and override the default Node rendering
type Node ¶
type Node interface { Type() NodeType Render() string NodeName() string Dump(int) string Children() []Node }
A Node is an element in the parse tree.
type NodeType ¶
type NodeType int
NodeType identifies the type of a parse tree node.
const ( NodeText NodeType = iota // A plain text NodeParagraph // A Paragraph NodeEmphasis // An emphasis(strong, em, ...) NodeHeading // A heading (h1, h2, ...) NodeBr // A link break NodeHr // A horizontal rule NodeImage // An image NodeRefImage // A image reference NodeList // A list of ListItems NodeListItem // A list item node NodeLink // A link(href) NodeRefLink // A link reference NodeDefLink // A link definition NodeTable // A table of NodeRows NodeRow // A row of NodeCells NodeCell // A table-cell(td) NodeCode // A code block(wrapped with pre) NodeBlockQuote // A blockquote NodeHTML // An inline HTML NodeCheckbox // A checkbox )
func (NodeType) CollectLinks ¶
type Options ¶
Mark options used to configure your Mark object set `Smartypants` and `Fractions` to true to enable smartypants and smartfractions rendering.
func DefaultOptions ¶
func DefaultOptions() *Options
DefaultOptions return an options struct with default configuration it's means that only Gfm, and Tables set to true.
type ParagraphNode ¶
ParagraphNode hold simple paragraph node contains text that may be emphasis.
func (*ParagraphNode) Children ¶
func (n *ParagraphNode) Children() []Node
func (*ParagraphNode) NodeName ¶
func (n *ParagraphNode) NodeName() (s string)
func (*ParagraphNode) Render ¶
func (n *ParagraphNode) Render() (s string)
Render returns the html representation of ParagraphNode
type RefNode ¶
type RefNode struct { NodeType Pos Text, Ref, Raw string Nodes []Node // contains filtered or unexported fields }
RefLink holds link with refrence to link definition