MCPcopy
hub / github.com/russross/blackfriday / quote

Method quote

block.go:970–1005  ·  view source on GitHub ↗

parse a blockquote fragment

(data []byte)

Source from the content-addressed store, hash-verified

968
969// parse a blockquote fragment
970func (p *Markdown) quote(data []byte) int {
971 block := p.addBlock(BlockQuote, nil)
972 var raw bytes.Buffer
973 beg, end := 0, 0
974 for beg < len(data) {
975 end = beg
976 // Step over whole lines, collecting them. While doing that, check for
977 // fenced code and if one's found, incorporate it altogether,
978 // irregardless of any contents inside it
979 for end < len(data) && data[end] != '\n' {
980 if p.extensions&FencedCode != 0 {
981 if i := p.fencedCodeBlock(data[end:], false); i > 0 {
982 // -1 to compensate for the extra end++ after the loop:
983 end += i - 1
984 break
985 }
986 }
987 end++
988 }
989 if end < len(data) && data[end] == '\n' {
990 end++
991 }
992 if pre := p.quotePrefix(data[beg:]); pre > 0 {
993 // skip the prefix
994 beg += pre
995 } else if p.terminateBlockquote(data, beg, end) {
996 break
997 }
998 // this line is part of the blockquote
999 raw.Write(data[beg:end])
1000 beg = end
1001 }
1002 p.block(raw.Bytes())
1003 p.finalize(block)
1004 return end
1005}
1006
1007// returns prefix length for block code
1008func (p *Markdown) codePrefix(data []byte) int {

Callers 1

blockMethod · 0.95

Calls 6

addBlockMethod · 0.95
fencedCodeBlockMethod · 0.95
quotePrefixMethod · 0.95
terminateBlockquoteMethod · 0.95
blockMethod · 0.95
finalizeMethod · 0.95

Tested by

no test coverage detected