Documentation ¶
Overview ¶
Package markdown provides CommonMark-compliant markdown parser and renderer.
Index ¶
- Constants
- func Breaks(b bool) option
- func HTML(b bool) option
- func LangPrefix(p string) option
- func Linkify(b bool) option
- func MaxNesting(n int) option
- func Nofollow(b bool) option
- func Quotes(s string) option
- func RegisterBlockRule(id int, rule BlockRule, terminates []int)
- func RegisterCoreRule(id int, rule CoreRule)
- func RegisterInlineRule(id int, rule InlineRule)
- func Tables(b bool) option
- func Typographer(b bool) option
- func XHTMLOutput(b bool) option
- type Align
- type BlockRule
- type BlockquoteClose
- type BlockquoteOpen
- type BulletListClose
- type BulletListOpen
- type CodeBlock
- type CodeInline
- type CoreRule
- type EmphasisClose
- type EmphasisOpen
- type Environment
- type Fence
- type HTMLBlock
- type HTMLInline
- type Hardbreak
- type HeadingClose
- type HeadingOpen
- type Hr
- type Image
- type Inline
- type InlineRule
- type LinkClose
- type LinkOpen
- type ListItemClose
- type ListItemOpen
- type Markdown
- type OrderedListClose
- type OrderedListOpen
- type ParagraphClose
- type ParagraphOpen
- type ParserBlock
- type ParserInline
- type RenderOptions
- type Renderer
- type Softbreak
- type StateBlock
- func (s *StateBlock) IsLineEmpty(n int) bool
- func (s *StateBlock) Lines(begin, end, indent int, keepLastLf bool) string
- func (s *StateBlock) PushClosingToken(tok Token)
- func (s *StateBlock) PushOpeningToken(tok Token)
- func (s *StateBlock) PushToken(tok Token)
- func (s *StateBlock) SkipBytes(pos int, b byte) int
- func (s *StateBlock) SkipBytesBack(pos int, b byte, min int) int
- func (s *StateBlock) SkipEmptyLines(from int) int
- func (s *StateBlock) SkipSpaces(pos int) int
- type StateCore
- type StateInline
- type StrikethroughClose
- type StrikethroughOpen
- type StrongClose
- type StrongOpen
- type TableClose
- type TableOpen
- type TbodyClose
- type TbodyOpen
- type TdClose
- type TdOpen
- type Text
- type ThClose
- type ThOpen
- type TheadClose
- type TheadOpen
- type Token
- type TrClose
- type TrOpen
Constants ¶
View Source
const ( AlignNone = iota AlignLeft AlignCenter AlignRight )
Variables ¶
This section is empty.
Functions ¶
func LangPrefix ¶
func LangPrefix(p string) option
func MaxNesting ¶
func MaxNesting(n int) option
func RegisterBlockRule ¶
func RegisterCoreRule ¶
func RegisterInlineRule ¶
func RegisterInlineRule(id int, rule InlineRule)
func Typographer ¶
func Typographer(b bool) option
func XHTMLOutput ¶
func XHTMLOutput(b bool) option
Types ¶
type BlockquoteClose ¶
type BlockquoteClose struct {
Lvl int
}
func (*BlockquoteClose) Block ¶
func (t *BlockquoteClose) Block() bool
func (*BlockquoteClose) Closing ¶
func (t *BlockquoteClose) Closing() bool
func (*BlockquoteClose) Level ¶
func (t *BlockquoteClose) Level() int
func (*BlockquoteClose) Opening ¶
func (t *BlockquoteClose) Opening() bool
func (*BlockquoteClose) SetLevel ¶
func (t *BlockquoteClose) SetLevel(lvl int)
func (*BlockquoteClose) Tag ¶
func (t *BlockquoteClose) Tag() string
type BlockquoteOpen ¶
func (*BlockquoteOpen) Block ¶
func (t *BlockquoteOpen) Block() bool
func (*BlockquoteOpen) Closing ¶
func (t *BlockquoteOpen) Closing() bool
func (*BlockquoteOpen) Level ¶
func (t *BlockquoteOpen) Level() int
func (*BlockquoteOpen) Opening ¶
func (t *BlockquoteOpen) Opening() bool
func (*BlockquoteOpen) SetLevel ¶
func (t *BlockquoteOpen) SetLevel(lvl int)
func (*BlockquoteOpen) Tag ¶
func (t *BlockquoteOpen) Tag() string
type BulletListClose ¶
type BulletListClose struct {
Lvl int
}
func (*BulletListClose) Block ¶
func (t *BulletListClose) Block() bool
func (*BulletListClose) Closing ¶
func (t *BulletListClose) Closing() bool
func (*BulletListClose) Level ¶
func (t *BulletListClose) Level() int
func (*BulletListClose) Opening ¶
func (t *BulletListClose) Opening() bool
func (*BulletListClose) SetLevel ¶
func (t *BulletListClose) SetLevel(lvl int)
func (*BulletListClose) Tag ¶
func (t *BulletListClose) Tag() string
type BulletListOpen ¶
func (*BulletListOpen) Block ¶
func (t *BulletListOpen) Block() bool
func (*BulletListOpen) Closing ¶
func (t *BulletListOpen) Closing() bool
func (*BulletListOpen) Level ¶
func (t *BulletListOpen) Level() int
func (*BulletListOpen) Opening ¶
func (t *BulletListOpen) Opening() bool
func (*BulletListOpen) SetLevel ¶
func (t *BulletListOpen) SetLevel(lvl int)
func (*BulletListOpen) Tag ¶
func (t *BulletListOpen) Tag() string
type CodeInline ¶
func (*CodeInline) Block ¶
func (t *CodeInline) Block() bool
func (*CodeInline) Closing ¶
func (t *CodeInline) Closing() bool
func (*CodeInline) Level ¶
func (t *CodeInline) Level() int
func (*CodeInline) Opening ¶
func (t *CodeInline) Opening() bool
func (*CodeInline) SetLevel ¶
func (t *CodeInline) SetLevel(lvl int)
func (*CodeInline) Tag ¶
func (t *CodeInline) Tag() string
type EmphasisClose ¶
type EmphasisClose struct {
Lvl int
}
func (*EmphasisClose) Block ¶
func (t *EmphasisClose) Block() bool
func (*EmphasisClose) Closing ¶
func (t *EmphasisClose) Closing() bool
func (*EmphasisClose) Level ¶
func (t *EmphasisClose) Level() int
func (*EmphasisClose) Opening ¶
func (t *EmphasisClose) Opening() bool
func (*EmphasisClose) SetLevel ¶
func (t *EmphasisClose) SetLevel(lvl int)
func (*EmphasisClose) Tag ¶
func (t *EmphasisClose) Tag() string
type EmphasisOpen ¶
type EmphasisOpen struct {
Lvl int
}
func (*EmphasisOpen) Block ¶
func (t *EmphasisOpen) Block() bool
func (*EmphasisOpen) Closing ¶
func (t *EmphasisOpen) Closing() bool
func (*EmphasisOpen) Level ¶
func (t *EmphasisOpen) Level() int
func (*EmphasisOpen) Opening ¶
func (t *EmphasisOpen) Opening() bool
func (*EmphasisOpen) SetLevel ¶
func (t *EmphasisOpen) SetLevel(lvl int)
func (*EmphasisOpen) Tag ¶
func (t *EmphasisOpen) Tag() string
type Environment ¶
type HTMLInline ¶
func (*HTMLInline) Block ¶
func (t *HTMLInline) Block() bool
func (*HTMLInline) Closing ¶
func (t *HTMLInline) Closing() bool
func (*HTMLInline) Level ¶
func (t *HTMLInline) Level() int
func (*HTMLInline) Opening ¶
func (t *HTMLInline) Opening() bool
func (*HTMLInline) SetLevel ¶
func (t *HTMLInline) SetLevel(lvl int)
func (*HTMLInline) Tag ¶
func (t *HTMLInline) Tag() string
type HeadingClose ¶
func (*HeadingClose) Block ¶
func (t *HeadingClose) Block() bool
func (*HeadingClose) Closing ¶
func (t *HeadingClose) Closing() bool
func (*HeadingClose) Level ¶
func (t *HeadingClose) Level() int
func (*HeadingClose) Opening ¶
func (t *HeadingClose) Opening() bool
func (*HeadingClose) SetLevel ¶
func (t *HeadingClose) SetLevel(lvl int)
func (*HeadingClose) Tag ¶
func (t *HeadingClose) Tag() string
type HeadingOpen ¶
func (*HeadingOpen) Block ¶
func (t *HeadingOpen) Block() bool
func (*HeadingOpen) Closing ¶
func (t *HeadingOpen) Closing() bool
func (*HeadingOpen) Level ¶
func (t *HeadingOpen) Level() int
func (*HeadingOpen) Opening ¶
func (t *HeadingOpen) Opening() bool
func (*HeadingOpen) SetLevel ¶
func (t *HeadingOpen) SetLevel(lvl int)
func (*HeadingOpen) Tag ¶
func (t *HeadingOpen) Tag() string
type InlineRule ¶
type InlineRule func(*StateInline, bool) bool
type ListItemClose ¶
type ListItemClose struct {
Lvl int
}
func (*ListItemClose) Block ¶
func (t *ListItemClose) Block() bool
func (*ListItemClose) Closing ¶
func (t *ListItemClose) Closing() bool
func (*ListItemClose) Level ¶
func (t *ListItemClose) Level() int
func (*ListItemClose) Opening ¶
func (t *ListItemClose) Opening() bool
func (*ListItemClose) SetLevel ¶
func (t *ListItemClose) SetLevel(lvl int)
func (*ListItemClose) Tag ¶
func (t *ListItemClose) Tag() string
type ListItemOpen ¶
func (*ListItemOpen) Block ¶
func (t *ListItemOpen) Block() bool
func (*ListItemOpen) Closing ¶
func (t *ListItemOpen) Closing() bool
func (*ListItemOpen) Level ¶
func (t *ListItemOpen) Level() int
func (*ListItemOpen) Opening ¶
func (t *ListItemOpen) Opening() bool
func (*ListItemOpen) SetLevel ¶
func (t *ListItemOpen) SetLevel(lvl int)
func (*ListItemOpen) Tag ¶
func (t *ListItemOpen) Tag() string
type Markdown ¶
type Markdown struct { Block ParserBlock Inline ParserInline // contains filtered or unexported fields }
func (*Markdown) RenderToString ¶
func (*Markdown) RenderTokensToString ¶
type OrderedListClose ¶
type OrderedListClose struct {
Lvl int
}
func (*OrderedListClose) Block ¶
func (t *OrderedListClose) Block() bool
func (*OrderedListClose) Closing ¶
func (t *OrderedListClose) Closing() bool
func (*OrderedListClose) Level ¶
func (t *OrderedListClose) Level() int
func (*OrderedListClose) Opening ¶
func (t *OrderedListClose) Opening() bool
func (*OrderedListClose) SetLevel ¶
func (t *OrderedListClose) SetLevel(lvl int)
func (*OrderedListClose) Tag ¶
func (t *OrderedListClose) Tag() string
type OrderedListOpen ¶
func (*OrderedListOpen) Block ¶
func (t *OrderedListOpen) Block() bool
func (*OrderedListOpen) Closing ¶
func (t *OrderedListOpen) Closing() bool
func (*OrderedListOpen) Level ¶
func (t *OrderedListOpen) Level() int
func (*OrderedListOpen) Opening ¶
func (t *OrderedListOpen) Opening() bool
func (*OrderedListOpen) SetLevel ¶
func (t *OrderedListOpen) SetLevel(lvl int)
func (*OrderedListOpen) Tag ¶
func (t *OrderedListOpen) Tag() string
type ParagraphClose ¶
func (*ParagraphClose) Block ¶
func (t *ParagraphClose) Block() bool
func (*ParagraphClose) Closing ¶
func (t *ParagraphClose) Closing() bool
func (*ParagraphClose) Level ¶
func (t *ParagraphClose) Level() int
func (*ParagraphClose) Opening ¶
func (t *ParagraphClose) Opening() bool
func (*ParagraphClose) SetLevel ¶
func (t *ParagraphClose) SetLevel(lvl int)
func (*ParagraphClose) Tag ¶
func (t *ParagraphClose) Tag() string
type ParagraphOpen ¶
func (*ParagraphOpen) Block ¶
func (t *ParagraphOpen) Block() bool
func (*ParagraphOpen) Closing ¶
func (t *ParagraphOpen) Closing() bool
func (*ParagraphOpen) Level ¶
func (t *ParagraphOpen) Level() int
func (*ParagraphOpen) Opening ¶
func (t *ParagraphOpen) Opening() bool
func (*ParagraphOpen) SetLevel ¶
func (t *ParagraphOpen) SetLevel(lvl int)
func (*ParagraphOpen) Tag ¶
func (t *ParagraphOpen) Tag() string
type ParserBlock ¶
type ParserBlock struct { }
func (ParserBlock) Parse ¶
func (b ParserBlock) Parse(src []byte, md *Markdown, env *Environment) []Token
func (ParserBlock) Tokenize ¶
func (ParserBlock) Tokenize(s *StateBlock, startLine, endLine int)
type ParserInline ¶
type ParserInline struct { }
func (ParserInline) Parse ¶
func (i ParserInline) Parse(src string, md *Markdown, env *Environment) []Token
func (ParserInline) SkipToken ¶
func (ParserInline) SkipToken(s *StateInline)
func (ParserInline) Tokenize ¶
func (ParserInline) Tokenize(s *StateInline)
type RenderOptions ¶
type Renderer ¶
type Renderer struct {
// contains filtered or unexported fields
}
func NewRenderer ¶
type StateBlock ¶
type StateBlock struct { StateCore BMarks []int // offsets of the line beginnings EMarks []int // offsets of the line endings TShift []int // indents for each line BlkIndent int // required block content indent (in a list etc.) Line int // line index in the source string LineMax int // number of lines Tight bool // loose or tight mode for lists ParentType byte // parent block type Level int }
func (*StateBlock) IsLineEmpty ¶
func (s *StateBlock) IsLineEmpty(n int) bool
func (*StateBlock) Lines ¶
func (s *StateBlock) Lines(begin, end, indent int, keepLastLf bool) string
func (*StateBlock) PushClosingToken ¶
func (s *StateBlock) PushClosingToken(tok Token)
func (*StateBlock) PushOpeningToken ¶
func (s *StateBlock) PushOpeningToken(tok Token)
func (*StateBlock) PushToken ¶
func (s *StateBlock) PushToken(tok Token)
func (*StateBlock) SkipBytesBack ¶
func (s *StateBlock) SkipBytesBack(pos int, b byte, min int) int
func (*StateBlock) SkipEmptyLines ¶
func (s *StateBlock) SkipEmptyLines(from int) int
func (*StateBlock) SkipSpaces ¶
func (s *StateBlock) SkipSpaces(pos int) int
type StateCore ¶
type StateCore struct { Src string TokArr [3]Token Tokens []Token Md *Markdown Env *Environment }
type StateInline ¶
type StateInline struct { StateCore Pos int PosMax int Level int Pending bytes.Buffer PendingLevel int Cache map[int]int }
func (*StateInline) PushClosingToken ¶
func (s *StateInline) PushClosingToken(tok Token)
func (*StateInline) PushOpeningToken ¶
func (s *StateInline) PushOpeningToken(tok Token)
func (*StateInline) PushPending ¶
func (s *StateInline) PushPending()
func (*StateInline) PushToken ¶
func (s *StateInline) PushToken(tok Token)
type StrikethroughClose ¶
type StrikethroughClose struct {
Lvl int
}
func (*StrikethroughClose) Block ¶
func (t *StrikethroughClose) Block() bool
func (*StrikethroughClose) Closing ¶
func (t *StrikethroughClose) Closing() bool
func (*StrikethroughClose) Level ¶
func (t *StrikethroughClose) Level() int
func (*StrikethroughClose) Opening ¶
func (t *StrikethroughClose) Opening() bool
func (*StrikethroughClose) SetLevel ¶
func (t *StrikethroughClose) SetLevel(lvl int)
func (*StrikethroughClose) Tag ¶
func (t *StrikethroughClose) Tag() string
type StrikethroughOpen ¶
type StrikethroughOpen struct {
Lvl int
}
func (*StrikethroughOpen) Block ¶
func (t *StrikethroughOpen) Block() bool
func (*StrikethroughOpen) Closing ¶
func (t *StrikethroughOpen) Closing() bool
func (*StrikethroughOpen) Level ¶
func (t *StrikethroughOpen) Level() int
func (*StrikethroughOpen) Opening ¶
func (t *StrikethroughOpen) Opening() bool
func (*StrikethroughOpen) SetLevel ¶
func (t *StrikethroughOpen) SetLevel(lvl int)
func (*StrikethroughOpen) Tag ¶
func (t *StrikethroughOpen) Tag() string
type StrongClose ¶
type StrongClose struct {
Lvl int
}
func (*StrongClose) Block ¶
func (t *StrongClose) Block() bool
func (*StrongClose) Closing ¶
func (t *StrongClose) Closing() bool
func (*StrongClose) Level ¶
func (t *StrongClose) Level() int
func (*StrongClose) Opening ¶
func (t *StrongClose) Opening() bool
func (*StrongClose) SetLevel ¶
func (t *StrongClose) SetLevel(lvl int)
func (*StrongClose) Tag ¶
func (t *StrongClose) Tag() string
type StrongOpen ¶
type StrongOpen struct {
Lvl int
}
func (*StrongOpen) Block ¶
func (t *StrongOpen) Block() bool
func (*StrongOpen) Closing ¶
func (t *StrongOpen) Closing() bool
func (*StrongOpen) Level ¶
func (t *StrongOpen) Level() int
func (*StrongOpen) Opening ¶
func (t *StrongOpen) Opening() bool
func (*StrongOpen) SetLevel ¶
func (t *StrongOpen) SetLevel(lvl int)
func (*StrongOpen) Tag ¶
func (t *StrongOpen) Tag() string
type TableClose ¶
type TableClose struct {
Lvl int
}
func (*TableClose) Block ¶
func (t *TableClose) Block() bool
func (*TableClose) Closing ¶
func (t *TableClose) Closing() bool
func (*TableClose) Level ¶
func (t *TableClose) Level() int
func (*TableClose) Opening ¶
func (t *TableClose) Opening() bool
func (*TableClose) SetLevel ¶
func (t *TableClose) SetLevel(lvl int)
func (*TableClose) Tag ¶
func (t *TableClose) Tag() string
type TbodyClose ¶
type TbodyClose struct {
Lvl int
}
func (*TbodyClose) Block ¶
func (t *TbodyClose) Block() bool
func (*TbodyClose) Closing ¶
func (t *TbodyClose) Closing() bool
func (*TbodyClose) Level ¶
func (t *TbodyClose) Level() int
func (*TbodyClose) Opening ¶
func (t *TbodyClose) Opening() bool
func (*TbodyClose) SetLevel ¶
func (t *TbodyClose) SetLevel(lvl int)
func (*TbodyClose) Tag ¶
func (t *TbodyClose) Tag() string
type TheadClose ¶
type TheadClose struct {
Lvl int
}
func (*TheadClose) Block ¶
func (t *TheadClose) Block() bool
func (*TheadClose) Closing ¶
func (t *TheadClose) Closing() bool
func (*TheadClose) Level ¶
func (t *TheadClose) Level() int
func (*TheadClose) Opening ¶
func (t *TheadClose) Opening() bool
func (*TheadClose) SetLevel ¶
func (t *TheadClose) SetLevel(lvl int)
func (*TheadClose) Tag ¶
func (t *TheadClose) Tag() string
Source Files ¶
- align.go
- autolink.go
- autolink_fsm.go
- backticks.go
- blockquote.go
- code.go
- emphasis.go
- entity.go
- escape.go
- fence.go
- heading.go
- helpers.go
- hr.go
- html_block.go
- html_inline.go
- html_inline_fsm.go
- image.go
- inline.go
- lheading.go
- link.go
- linkify.go
- list.go
- markdown.go
- newline.go
- normalize.go
- options.go
- paragraph.go
- parser_block.go
- parser_inline.go
- plugins.go
- reference.go
- render.go
- replacements.go
- smartquotes.go
- state_block.go
- state_core.go
- state_inline.go
- strikethrough.go
- table.go
- table_fsm.go
- text.go
- token.go
- urlschema.go
- util.go
- writer.go
Click to show internal directories.
Click to hide internal directories.