3434// Parse block-level data.
3535// Note: this function and many that it calls assume that
3636// the input buffer ends with a newline.
37- func (p * Processor ) block (data []byte ) {
37+ func (p * Markdown ) block (data []byte ) {
3838 // this is called recursively: enforce a maximum depth
3939 if p .nesting >= p .maxNesting {
4040 return
@@ -197,14 +197,14 @@ func (p *Processor) block(data []byte) {
197197 p .nesting --
198198}
199199
200- func (p * Processor ) addBlock (typ NodeType , content []byte ) * Node {
200+ func (p * Markdown ) addBlock (typ NodeType , content []byte ) * Node {
201201 p .closeUnmatchedBlocks ()
202202 container := p .addChild (typ , 0 )
203203 container .content = content
204204 return container
205205}
206206
207- func (p * Processor ) isPrefixHeading (data []byte ) bool {
207+ func (p * Markdown ) isPrefixHeading (data []byte ) bool {
208208 if data [0 ] != '#' {
209209 return false
210210 }
@@ -221,7 +221,7 @@ func (p *Processor) isPrefixHeading(data []byte) bool {
221221 return true
222222}
223223
224- func (p * Processor ) prefixHeading (data []byte ) int {
224+ func (p * Markdown ) prefixHeading (data []byte ) int {
225225 level := 0
226226 for level < 6 && level < len (data ) && data [level ] == '#' {
227227 level ++
@@ -267,7 +267,7 @@ func (p *Processor) prefixHeading(data []byte) int {
267267 return skip
268268}
269269
270- func (p * Processor ) isUnderlinedHeading (data []byte ) int {
270+ func (p * Markdown ) isUnderlinedHeading (data []byte ) int {
271271 // test of level 1 heading
272272 if data [0 ] == '=' {
273273 i := skipChar (data , 1 , '=' )
@@ -291,7 +291,7 @@ func (p *Processor) isUnderlinedHeading(data []byte) int {
291291 return 0
292292}
293293
294- func (p * Processor ) titleBlock (data []byte , doRender bool ) int {
294+ func (p * Markdown ) titleBlock (data []byte , doRender bool ) int {
295295 if data [0 ] != '%' {
296296 return 0
297297 }
@@ -315,7 +315,7 @@ func (p *Processor) titleBlock(data []byte, doRender bool) int {
315315 return consumed
316316}
317317
318- func (p * Processor ) html (data []byte , doRender bool ) int {
318+ func (p * Markdown ) html (data []byte , doRender bool ) int {
319319 var i , j int
320320
321321 // identify the opening tag
@@ -419,7 +419,7 @@ func finalizeHTMLBlock(block *Node) {
419419}
420420
421421// HTML comment, lax form
422- func (p * Processor ) htmlComment (data []byte , doRender bool ) int {
422+ func (p * Markdown ) htmlComment (data []byte , doRender bool ) int {
423423 i := p .inlineHTMLComment (data )
424424 // needs to end with a blank line
425425 if j := p .isEmpty (data [i :]); j > 0 {
@@ -439,7 +439,7 @@ func (p *Processor) htmlComment(data []byte, doRender bool) int {
439439}
440440
441441// HR, which is the only self-closing block tag considered
442- func (p * Processor ) htmlHr (data []byte , doRender bool ) int {
442+ func (p * Markdown ) htmlHr (data []byte , doRender bool ) int {
443443 if len (data ) < 4 {
444444 return 0
445445 }
@@ -472,7 +472,7 @@ func (p *Processor) htmlHr(data []byte, doRender bool) int {
472472 return 0
473473}
474474
475- func (p * Processor ) htmlFindTag (data []byte ) (string , bool ) {
475+ func (p * Markdown ) htmlFindTag (data []byte ) (string , bool ) {
476476 i := 0
477477 for i < len (data ) && isalnum (data [i ]) {
478478 i ++
@@ -484,7 +484,7 @@ func (p *Processor) htmlFindTag(data []byte) (string, bool) {
484484 return "" , false
485485}
486486
487- func (p * Processor ) htmlFindEnd (tag string , data []byte ) int {
487+ func (p * Markdown ) htmlFindEnd (tag string , data []byte ) int {
488488 // assume data[0] == '<' && data[1] == '/' already tested
489489 if tag == "hr" {
490490 return 2
@@ -519,7 +519,7 @@ func (p *Processor) htmlFindEnd(tag string, data []byte) int {
519519 return i + skip
520520}
521521
522- func (* Processor ) isEmpty (data []byte ) int {
522+ func (* Markdown ) isEmpty (data []byte ) int {
523523 // it is okay to call isEmpty on an empty buffer
524524 if len (data ) == 0 {
525525 return 0
@@ -537,7 +537,7 @@ func (*Processor) isEmpty(data []byte) int {
537537 return i
538538}
539539
540- func (* Processor ) isHRule (data []byte ) bool {
540+ func (* Markdown ) isHRule (data []byte ) bool {
541541 i := 0
542542
543543 // skip up to three spaces
@@ -667,7 +667,7 @@ func isFenceLine(data []byte, syntax *string, oldmarker string) (end int, marker
667667// fencedCodeBlock returns the end index if data contains a fenced code block at the beginning,
668668// or 0 otherwise. It writes to out if doRender is true, otherwise it has no side effects.
669669// If doRender is true, a final newline is mandatory to recognize the fenced code block.
670- func (p * Processor ) fencedCodeBlock (data []byte , doRender bool ) int {
670+ func (p * Markdown ) fencedCodeBlock (data []byte , doRender bool ) int {
671671 var syntax string
672672 beg , marker := isFenceLine (data , & syntax , "" )
673673 if beg == 0 || beg >= len (data ) {
@@ -739,7 +739,7 @@ func finalizeCodeBlock(block *Node) {
739739 block .content = nil
740740}
741741
742- func (p * Processor ) table (data []byte ) int {
742+ func (p * Markdown ) table (data []byte ) int {
743743 table := p .addBlock (Table , nil )
744744 i , columns := p .tableHeader (data )
745745 if i == 0 {
@@ -782,7 +782,7 @@ func isBackslashEscaped(data []byte, i int) bool {
782782 return backslashes & 1 == 1
783783}
784784
785- func (p * Processor ) tableHeader (data []byte ) (size int , columns []CellAlignFlags ) {
785+ func (p * Markdown ) tableHeader (data []byte ) (size int , columns []CellAlignFlags ) {
786786 i := 0
787787 colCount := 1
788788 for i = 0 ; i < len (data ) && data [i ] != '\n' ; i ++ {
@@ -895,7 +895,7 @@ func (p *Processor) tableHeader(data []byte) (size int, columns []CellAlignFlags
895895 return
896896}
897897
898- func (p * Processor ) tableRow (data []byte , columns []CellAlignFlags , header bool ) {
898+ func (p * Markdown ) tableRow (data []byte , columns []CellAlignFlags , header bool ) {
899899 p .addBlock (TableRow , nil )
900900 i , col := 0 , 0
901901
@@ -939,7 +939,7 @@ func (p *Processor) tableRow(data []byte, columns []CellAlignFlags, header bool)
939939}
940940
941941// returns blockquote prefix length
942- func (p * Processor ) quotePrefix (data []byte ) int {
942+ func (p * Markdown ) quotePrefix (data []byte ) int {
943943 i := 0
944944 for i < 3 && i < len (data ) && data [i ] == ' ' {
945945 i ++
@@ -955,7 +955,7 @@ func (p *Processor) quotePrefix(data []byte) int {
955955
956956// blockquote ends with at least one blank line
957957// followed by something without a blockquote prefix
958- func (p * Processor ) terminateBlockquote (data []byte , beg , end int ) bool {
958+ func (p * Markdown ) terminateBlockquote (data []byte , beg , end int ) bool {
959959 if p .isEmpty (data [beg :]) <= 0 {
960960 return false
961961 }
@@ -966,7 +966,7 @@ func (p *Processor) terminateBlockquote(data []byte, beg, end int) bool {
966966}
967967
968968// parse a blockquote fragment
969- func (p * Processor ) quote (data []byte ) int {
969+ func (p * Markdown ) quote (data []byte ) int {
970970 block := p .addBlock (BlockQuote , nil )
971971 var raw bytes.Buffer
972972 beg , end := 0 , 0
@@ -1004,7 +1004,7 @@ func (p *Processor) quote(data []byte) int {
10041004}
10051005
10061006// returns prefix length for block code
1007- func (p * Processor ) codePrefix (data []byte ) int {
1007+ func (p * Markdown ) codePrefix (data []byte ) int {
10081008 if len (data ) >= 1 && data [0 ] == '\t' {
10091009 return 1
10101010 }
@@ -1014,7 +1014,7 @@ func (p *Processor) codePrefix(data []byte) int {
10141014 return 0
10151015}
10161016
1017- func (p * Processor ) code (data []byte ) int {
1017+ func (p * Markdown ) code (data []byte ) int {
10181018 var work bytes.Buffer
10191019
10201020 i := 0
@@ -1064,7 +1064,7 @@ func (p *Processor) code(data []byte) int {
10641064}
10651065
10661066// returns unordered list item prefix
1067- func (p * Processor ) uliPrefix (data []byte ) int {
1067+ func (p * Markdown ) uliPrefix (data []byte ) int {
10681068 i := 0
10691069 // start with up to 3 spaces
10701070 for i < len (data ) && i < 3 && data [i ] == ' ' {
@@ -1082,7 +1082,7 @@ func (p *Processor) uliPrefix(data []byte) int {
10821082}
10831083
10841084// returns ordered list item prefix
1085- func (p * Processor ) oliPrefix (data []byte ) int {
1085+ func (p * Markdown ) oliPrefix (data []byte ) int {
10861086 i := 0
10871087
10881088 // start with up to 3 spaces
@@ -1107,7 +1107,7 @@ func (p *Processor) oliPrefix(data []byte) int {
11071107}
11081108
11091109// returns definition list item prefix
1110- func (p * Processor ) dliPrefix (data []byte ) int {
1110+ func (p * Markdown ) dliPrefix (data []byte ) int {
11111111 if len (data ) < 2 {
11121112 return 0
11131113 }
@@ -1123,7 +1123,7 @@ func (p *Processor) dliPrefix(data []byte) int {
11231123}
11241124
11251125// parse ordered or unordered list block
1126- func (p * Processor ) list (data []byte , flags ListType ) int {
1126+ func (p * Markdown ) list (data []byte , flags ListType ) int {
11271127 i := 0
11281128 flags |= ListItemBeginningOfList
11291129 block := p .addBlock (List , nil )
@@ -1191,7 +1191,7 @@ func finalizeList(block *Node) {
11911191
11921192// Parse a single list item.
11931193// Assumes initial prefix is already removed if this is a sublist.
1194- func (p * Processor ) listItem (data []byte , flags * ListType ) int {
1194+ func (p * Markdown ) listItem (data []byte , flags * ListType ) int {
11951195 // keep track of the indentation of the first line
11961196 itemIndent := 0
11971197 if data [0 ] == '\t' {
@@ -1383,7 +1383,7 @@ gatherlines:
13831383}
13841384
13851385// render a single paragraph that has already been parsed out
1386- func (p * Processor ) renderParagraph (data []byte ) {
1386+ func (p * Markdown ) renderParagraph (data []byte ) {
13871387 if len (data ) == 0 {
13881388 return
13891389 }
@@ -1408,7 +1408,7 @@ func (p *Processor) renderParagraph(data []byte) {
14081408 p .addBlock (Paragraph , data [beg :end ])
14091409}
14101410
1411- func (p * Processor ) paragraph (data []byte ) int {
1411+ func (p * Markdown ) paragraph (data []byte ) int {
14121412 // prev: index of 1st char of previous line
14131413 // line: index of 1st char of current line
14141414 // i: index of cursor/end of current line
0 commit comments