Functions
Inline
method
#
func (x *Strong) Inline()
Inline
method
#
func (*Emoji) Inline()
Inline
method
#
func (x *Task) Inline()
Inline
method
#
func (*Plain) Inline()
Inline
method
#
func (x *Del) Inline()
Inline
method
#
func (*HardBreak) Inline()
Inline
method
#
func (*Emph) Inline()
Inline
method
#
func (*AutoLink) Inline()
Inline
method
#
func (*Code) Inline()
Inline
method
#
func (*SoftBreak) Inline()
Inline
method
#
func (*Image) Inline()
Inline
method
#
func (*Link) Inline()
Inline
method
#
func (*HTMLTag) Inline()
Parse
method
#
func (p *Parser) Parse(text string) *Document
Pos
method
#
func (p Position) Pos() Position
PrintHTML
method
#
func (x *Del) PrintHTML(buf *bytes.Buffer)
PrintHTML
method
#
func (x *Strong) PrintHTML(buf *bytes.Buffer)
PrintHTML
method
#
func (b *Heading) PrintHTML(buf *bytes.Buffer)
PrintHTML
method
#
func (x *AutoLink) PrintHTML(buf *bytes.Buffer)
PrintHTML
method
#
func (b *CodeBlock) PrintHTML(buf *bytes.Buffer)
PrintHTML
method
#
func (b *Quote) PrintHTML(buf *bytes.Buffer)
PrintHTML
method
#
func (x *Link) PrintHTML(buf *bytes.Buffer)
PrintHTML
method
#
func (x *SoftBreak) PrintHTML(buf *bytes.Buffer)
PrintHTML
method
#
func (x *Emph) PrintHTML(buf *bytes.Buffer)
PrintHTML
method
#
func (t *Table) PrintHTML(buf *bytes.Buffer)
PrintHTML
method
#
func (b *Text) PrintHTML(buf *bytes.Buffer)
PrintHTML
method
#
func (b *Empty) PrintHTML(buf *bytes.Buffer)
PrintHTML
method
#
func (b *List) PrintHTML(buf *bytes.Buffer)
PrintHTML
method
#
func (x *HTMLTag) PrintHTML(buf *bytes.Buffer)
PrintHTML
method
#
func (x *Image) PrintHTML(buf *bytes.Buffer)
PrintHTML
method
#
func (x *HardBreak) PrintHTML(buf *bytes.Buffer)
PrintHTML
method
#
func (b *Document) PrintHTML(buf *bytes.Buffer)
PrintHTML
method
#
func (b *ThematicBreak) PrintHTML(buf *bytes.Buffer)
PrintHTML
method
#
func (x *Plain) PrintHTML(buf *bytes.Buffer)
PrintHTML
method
#
func (b *Item) PrintHTML(buf *bytes.Buffer)
PrintHTML
method
#
func (b *Paragraph) PrintHTML(buf *bytes.Buffer)
PrintHTML
method
#
func (b *HTMLBlock) PrintHTML(buf *bytes.Buffer)
PrintHTML
method
#
func (x *Emoji) PrintHTML(buf *bytes.Buffer)
PrintHTML
method
#
func (x *Code) PrintHTML(buf *bytes.Buffer)
PrintHTML
method
#
func (x *Task) PrintHTML(buf *bytes.Buffer)
PrintText
method
#
func (x *AutoLink) PrintText(buf *bytes.Buffer)
PrintText
method
#
func (x *Link) PrintText(buf *bytes.Buffer)
PrintText
method
#
func (x *Task) PrintText(buf *bytes.Buffer)
PrintText
method
#
func (x *Emoji) PrintText(buf *bytes.Buffer)
PrintText
method
#
func (x *Plain) PrintText(buf *bytes.Buffer)
PrintText
method
#
func (x *Strong) PrintText(buf *bytes.Buffer)
PrintText
method
#
func (x *HTMLTag) PrintText(buf *bytes.Buffer)
PrintText
method
#
func (x *SoftBreak) PrintText(buf *bytes.Buffer)
PrintText
method
#
func (x *HardBreak) PrintText(buf *bytes.Buffer)
PrintText
method
#
func (x *Del) PrintText(buf *bytes.Buffer)
PrintText
method
#
func (x *Code) PrintText(buf *bytes.Buffer)
PrintText
method
#
func (x *Image) PrintText(buf *bytes.Buffer)
PrintText
method
#
func (x *Emph) PrintText(buf *bytes.Buffer)
ToHTML
function
#
func ToHTML(b Block) string
ToMarkdown
function
#
func ToMarkdown(b Block) string
addBlock
method
#
func (p *parseState) addBlock(c blockBuilder)
addLine
method
#
func (p *parseState) addLine(s line)
addRow
method
#
func (b *tableBuilder) addRow(row string)
autoLinkPlain
method
#
func (p *parseState) autoLinkPlain(s string) []Inline
autoLinkText
method
#
autoLinkMore rewrites any extended autolinks in the body
and returns the result.
body is a list of Plain, Emph, Strong, and Del nodes.
Two Plains only appear consecutively when one is a
potential emphasis marker that ended up being plain after all, like "_" or "**".
There are no Link nodes.
The GitHub “spec” declares that “autolinks can only come at the
beginning of a line, after whitespace, or any of the delimiting
characters *, _, ~, and (”. However, the GitHub web site does not
enforce this rule: text like "$abc@def.ghi is my email" links the
text following the $ as an email address. It appears the actual rule
is that autolinks cannot come after ASCII letters, although they can
come after numbers or Unicode letters.
Since the only point of implementing GitHub Flavored Markdown
is to match GitHub's behavior, we do what they do, not what they say,
at least for now.
func (p *parseState) autoLinkText(list []Inline) []Inline
blocks
method
#
func (p *parseState) blocks() []Block
build
method
#
func (b *rootBuilder) build(p buildState) Block
build
method
#
func (c *fenceBuilder) build(p buildState) Block
build
method
#
func (b *preBuilder) build(p buildState) Block
build
method
#
func (b *listBuilder) build(p buildState) Block
build
method
#
func (b *paraBuilder) build(p buildState) Block
build
method
#
func (b *tableBuilder) build(p buildState) Block
build
method
#
func (b *quoteBuilder) build(p buildState) Block
build
method
#
func (b *itemBuilder) build(p buildState) Block
build
method
#
func (c *htmlBuilder) build(p buildState) Block
closeBlock
method
#
func (p *parseState) closeBlock() Block
curB
method
#
func (p *parseState) curB() blockBuilder
defineLink
method
#
func (p *parseState) defineLink(label string, link *Link)
deleteLast
method
#
func (p *parseState) deleteLast()
doneBlock
method
#
func (p *parseState) doneBlock(b Block)
dump
function
#
func dump(b Block) string
emit
method
#
func (p *parseState) emit(i int)
emph
method
#
func (ps *parseState) emph(dst []Inline, src []Inline) []Inline
eof
method
#
func (s *line) eof() bool
extend
method
#
func (c *preBuilder) extend(p *parseState, s line) (line, bool)
extend
method
#
func (c *rootBuilder) extend(p *parseState, s line) (line, bool)
extend
method
#
func (c *fenceBuilder) extend(p *parseState, s line) (line, bool)
extend
method
#
func (b *quoteBuilder) extend(p *parseState, s line) (line, bool)
extend
method
#
func (c *htmlBuilder) extend(p *parseState, s line) (line, bool)
extend
method
#
func (c *listBuilder) extend(p *parseState, s line) (line, bool)
extend
method
#
func (c *itemBuilder) extend(p *parseState, s line) (line, bool)
extend
method
#
func (b *paraBuilder) extend(p *parseState, s line) (line, bool)
hasEndPre
function
#
func hasEndPre(s string) bool
inline
method
#
func (p *parseState) inline(s string) []Inline
ins
function
#
func ins(first Inline, x []Inline) []Inline
isBlank
method
#
func (s *line) isBlank() bool
isDigit
function
#
func isDigit(c byte) bool
isHR
function
#
func isHR(s line) bool
isHexDigit
function
#
func isHexDigit(c byte) bool
isLDH
function
#
func isLDH(c byte) bool
isLetter
function
#
func isLetter(c byte) bool
isLetterDigit
function
#
func isLetterDigit(c byte) bool
isPunct
function
#
func isPunct(c byte) bool
isScheme
function
#
func isScheme(c byte) bool
isTableSpace
function
#
func isTableSpace(c byte) bool
isTableStart
function
#
func isTableStart(hdr1 string, delim1 string) bool
isURL
function
#
func isURL(c byte) bool
isUnicodePunct
function
#
func isUnicodePunct(r rune) bool
isUnicodeSpace
function
#
func isUnicodeSpace(r rune) bool
isUser
function
#
func isUser(c byte) bool
last
method
#
func (p *parseState) last() Block
link
method
#
func (p *parseState) link(label string) *Link
linkCorner
function
#
func linkCorner(url string) bool
listCorner
function
#
func listCorner(list *List) bool
longestSequence
function
#
longestSequence returns the length of the longest sequence of consecutive bytes b in s.
func longestSequence(s string, b byte) int
mdUnescape
function
#
func mdUnescape(s string) string
mergePlain
method
#
func (p *parseState) mergePlain(list []Inline) []Inline
mergePlain1
function
#
func mergePlain1(list []Inline) *Plain
newATXHeading
function
#
func newATXHeading(p *parseState, s line) (line, bool)
newFence
function
#
func newFence(p *parseState, s line) (line, bool)
newHR
function
#
func newHR(p *parseState, s line) (line, bool)
newHTML
function
#
func newHTML(p *parseState, s line) (line, bool)
newListItem
function
#
func newListItem(p *parseState, s line) (line, bool)
newPara
function
#
func newPara(p *parseState, s line) (line, bool)
newPre
function
#
func newPre(p *parseState, s line) (line, bool)
newQuote
function
#
func newQuote(p *parseState, s line) (line, bool)
newSetextHeading
function
#
func newSetextHeading(p *parseState, s line) (line, bool)
newText
method
#
func (p *parseState) newText(pos Position, text string) *Text
nextB
method
#
func (p *parseState) nextB() blockBuilder
nop
function
#
func nop(text string) string
normalizeLabel
function
#
func normalizeLabel(s string) string
para
method
#
func (p *parseState) para() *paraBuilder
parse
method
#
func (p *Parser) parse(text string) (d *Document, corner bool)
parseAlign
method
#
func (b *tableBuilder) parseAlign(delim tableTrimmed, n int) []string
parseAttr
function
#
func parseAttr(p *parseState, s string, i int) (string, int, bool)
parseAttrName
function
#
func parseAttrName(s string, i int) (string, int, bool)
parseAttrValue
function
#
func parseAttrValue(s string, i int) (string, int, bool)
parseAttrValueSpec
function
#
func parseAttrValueSpec(p *parseState, s string, i int) (string, int, bool)
parseAutoEmail
method
#
func (p *parseState) parseAutoEmail(s string, i int) (before string, link *Link, after string, ok bool)
parseAutoHTTP
method
#
parseAutoWWW parses an extended www autolink.
https://github.github.com/gfm/#extended-www-autolink
func (p *parseState) parseAutoHTTP(scheme string, s string, textstart int, start int, min int, vd *validDomainChecker) (link *Link, after string, found bool)
parseAutoLinkEmail
function
#
func parseAutoLinkEmail(s string, i int) (Inline, int, bool)
parseAutoLinkOrHTML
function
#
func parseAutoLinkOrHTML(p *parseState, s string, i int) (Inline, int, int, bool)
parseAutoLinkURI
function
#
func parseAutoLinkURI(s string, i int) (Inline, int, bool)
parseAutoMailto
method
#
func (p *parseState) parseAutoMailto(s string, i int) (link *Link, after string, ok bool)
parseAutoProto
method
#
func (p *parseState) parseAutoProto(s string, i int, vd *validDomainChecker) (link *Link, after string, found bool)
parseAutoXmpp
method
#
func (p *parseState) parseAutoXmpp(s string, i int) (link *Link, after string, ok bool)
parseBreak
function
#
func parseBreak(_ *parseState, s string, i int) (Inline, int, int, bool)
parseCodeSpan
method
#
func (b *backtickParser) parseCodeSpan(p *parseState, s string, i int) (Inline, int, int, bool)
parseDash
function
#
func parseDash(p *parseState, s string, i int) (Inline, int, int, bool)
parseDot
function
#
func parseDot(p *parseState, s string, i int) (Inline, int, int, bool)
parseEmoji
function
#
func parseEmoji(p *parseState, s string, i int) (Inline, int, int, bool)
parseEmph
function
#
func parseEmph(p *parseState, s string, i int) (Inline, int, int, bool)
parseEscape
function
#
func parseEscape(p *parseState, s string, i int) (Inline, int, int, bool)
parseHTMLCDATA
function
#
func parseHTMLCDATA(s string, i int) (Inline, int, bool)
parseHTMLClosingTag
function
#
func parseHTMLClosingTag(p *parseState, s string, i int) (Inline, int, bool)
parseHTMLDecl
function
#
func parseHTMLDecl(p *parseState, s string, i int) (Inline, int, bool)
parseHTMLEntity
function
#
func parseHTMLEntity(_ *parseState, s string, i int) (Inline, int, int, bool)
parseHTMLMarker
function
#
func parseHTMLMarker(s string, i int, prefix string, suffix string) (Inline, int, bool)
parseHTMLOpenTag
function
#
func parseHTMLOpenTag(p *parseState, s string, i int) (Inline, int, bool)
parseHTMLProcInst
function
#
func parseHTMLProcInst(s string, i int) (Inline, int, bool)
parseHTMLTag
function
#
func parseHTMLTag(p *parseState, s string, i int) (Inline, int, bool)
parseImageOpen
function
#
func parseImageOpen(_ *parseState, s string, i int) (Inline, int, int, bool)
parseLinkClose
method
#
func (p *parseState) parseLinkClose(s string, i int, open *openPlain) (*Link, int, bool)
parseLinkDest
function
#
func parseLinkDest(s string, i int) (string, int, bool)
parseLinkLabel
function
#
func parseLinkLabel(p *parseState, s string, i int) (string, int, bool)
parseLinkOpen
function
#
func parseLinkOpen(_ *parseState, s string, i int) (Inline, int, int, bool)
parseLinkRefDef
function
#
func parseLinkRefDef(p buildState, s string) (int, bool)
parseLinkTitle
function
#
func parseLinkTitle(s string, i int) (title string, char byte, next int, found bool)
parseRow
method
#
func (b *tableBuilder) parseRow(p buildState, row tableTrimmed, line int, width int) []*Text
parseTagName
function
#
func parseTagName(s string, i int) (string, int, bool)
parseValidDomain
method
#
parseValidDomain parses a valid domain.
https://github.github.com/gfm/#valid-domain
If s starts with a valid domain, parseValidDomain returns
the length of that domain and true. If s does not start with
a valid domain, parseValidDomain returns n, false,
where n is the length of a prefix guaranteed not to be acceptable
to any future call to parseValidDomain.
“A valid domain consists of segments of alphanumeric characters,
underscores (_) and hyphens (-) separated by periods (.).
There must be at least one period, and no underscores may be
present in the last two segments of the domain.”
The spec does not spell out whether segments can be empty.
Empirically, in GitHub's implementation they can.
func (v *validDomainChecker) parseValidDomain(start int) (n int, found bool)
peek
method
#
func (s *line) peek() byte
pos
method
#
func (p *parseState) pos() Position
printLinkTitleMarkdown
function
#
func printLinkTitleMarkdown(buf *bytes.Buffer, title string, titleChar byte)
printMarkdown
method
#
func (b *Quote) printMarkdown(buf *bytes.Buffer, s mdState)
printMarkdown
method
#
func (x *Image) printMarkdown(buf *bytes.Buffer)
printMarkdown
method
#
func (b *CodeBlock) printMarkdown(buf *bytes.Buffer, s mdState)
printMarkdown
method
#
func (t *Table) printMarkdown(buf *bytes.Buffer, s mdState)
printMarkdown
method
#
func (x *AutoLink) printMarkdown(buf *bytes.Buffer)
printMarkdown
method
#
func (b *Heading) printMarkdown(buf *bytes.Buffer, s mdState)
printMarkdown
method
#
func (x *Link) printMarkdown(buf *bytes.Buffer)
printMarkdown
method
#
func (x *Task) printMarkdown(buf *bytes.Buffer)
printMarkdown
method
#
func (b *HTMLBlock) printMarkdown(buf *bytes.Buffer, s mdState)
printMarkdown
method
#
func (x *Emph) printMarkdown(buf *bytes.Buffer)
printMarkdown
method
#
func (x *Del) printMarkdown(buf *bytes.Buffer)
printMarkdown
method
#
func (b *Empty) printMarkdown(*bytes.Buffer, mdState)
printMarkdown
method
#
func (x *Strong) printMarkdown(buf *bytes.Buffer)
printMarkdown
method
#
func (b *Paragraph) printMarkdown(buf *bytes.Buffer, s mdState)
printMarkdown
method
#
func (x *Code) printMarkdown(buf *bytes.Buffer)
printMarkdown
method
#
func (x *Escaped) printMarkdown(buf *bytes.Buffer)
printMarkdown
method
#
func (x *Plain) printMarkdown(buf *bytes.Buffer)
printMarkdown
method
#
func (x *HTMLTag) printMarkdown(buf *bytes.Buffer)
printMarkdown
method
#
func (b *List) printMarkdown(buf *bytes.Buffer, s mdState)
printMarkdown
method
#
func (b *Document) printMarkdown(buf *bytes.Buffer, s mdState)
printMarkdown
method
#
func (x *SoftBreak) printMarkdown(buf *bytes.Buffer)
printMarkdown
method
#
func (b *Text) printMarkdown(buf *bytes.Buffer, s mdState)
printMarkdown
method
#
func (x *HardBreak) printMarkdown(buf *bytes.Buffer)
printMarkdown
method
#
func (b *Item) printMarkdown(buf *bytes.Buffer, s mdState)
printMarkdown
method
#
func (x *Emoji) printMarkdown(buf *bytes.Buffer)
printMarkdown
method
#
func (b *ThematicBreak) printMarkdown(buf *bytes.Buffer, s mdState)
printMarkdownBlocks
function
#
func printMarkdownBlocks(bs []Block, buf *bytes.Buffer, s mdState)
printRemainingMarkdown
method
#
func (x *Link) printRemainingMarkdown(buf *bytes.Buffer)
printb
function
#
func printb(buf *bytes.Buffer, b Block, prefix string)
printi
function
#
func printi(buf *bytes.Buffer, in Inline)
printis
function
#
func printis(buf *bytes.Buffer, ins []Inline)
printslice
function
#
func printslice(buf *bytes.Buffer, v reflect.Value, prefix string)
reset
method
#
func (b *backtickParser) reset()
skip
method
#
func (v *validDomainChecker) skip(i int)
skip
method
#
func (p *parseState) skip(i int)
skipDomainElem
function
#
func skipDomainElem(s string) (int, bool)
skipSpace
function
#
func skipSpace(s string, i int) int
skipSpace
method
#
func (s *line) skipSpace()
start
method
#
func (b *tableBuilder) start(hdr string, delim string)
startHTML
method
#
func (p *parseState) startHTML(s *line) bool
startListItem
method
#
func (p *parseState) startListItem(s *line) bool
string
method
#
func (s *line) string() string
tableAlign
function
#
func tableAlign(cell string) string
tableCount
function
#
func tableCount(row tableTrimmed) int
tableTrimOuter
function
#
func tableTrimOuter(row string) tableTrimmed
tableTrimSpace
function
#
func tableTrimSpace(s string) string
tableUnescape
function
#
func tableUnescape(text string) string
taskList
method
#
func (p *parseState) taskList(list *List)
toPlain
function
#
func toPlain(x Inline) *Plain
trim
method
#
func (s *line) trim(c byte) bool
trimFence
method
#
func (s *line) trimFence(fence *string, info *string, n *int) bool
trimHeading
method
#
func (s *line) trimHeading(width *int) bool
trimLeftSpaceTab
function
#
func trimLeftSpaceTab(s string) string
trimQuote
function
#
func trimQuote(s line) (line, bool)
trimRightSpaceTab
function
#
func trimRightSpaceTab(s string) string
trimSetext
method
#
func (s *line) trimSetext(n *int) bool
trimSpace
method
#
func (s *line) trimSpace(min int, max int, eolOK bool) bool
trimSpace
function
#
func trimSpace(s string) string
trimSpaceString
method
#
func (s *line) trimSpaceString() string
trimSpaceTab
function
#
func trimSpaceTab(s string) string
trimSpaceTabNewline
function
#
func trimSpaceTabNewline(s string) string
trimStack
method
#
func (p *parseState) trimStack(depth int)
trimString
method
#
func (s *line) trimString() string