func (p *parser) block(out *bytes.Buffer, data []byte) {
	if len(data) == 0 || data[len(data)-1] != '\n' {
		panic("block input is missing terminating newline")
	}
	if p.nesting >= p.maxNesting {
		return
	}
	p.nesting++
	for len(data) > 0 {
		if p.isPrefixHeader(data) {
			data = data[p.prefixHeader(out, data):]
			continue
		}
		if data[0] == '<' {
			if i := p.html(out, data, true); i > 0 {
				data = data[i:]
				continue
			}
		}
		if p.flags&EXTENSION_TITLEBLOCK != 0 {
			if data[0] == '%' {
				if i := p.titleBlock(out, data, true); i > 0 {
					data = data[i:]
					continue
				}
			}
		}
		if i := p.isEmpty(data); i > 0 {
			data = data[i:]
			continue
		}
		if p.codePrefix(data) > 0 {
			data = data[p.code(out, data):]
			continue
		}
		if p.flags&EXTENSION_FENCED_CODE != 0 {
			if i := p.fencedCodeBlock(out, data, true); i > 0 {
				data = data[i:]
				continue
			}
		}
		if p.isHRule(data) {
			p.r.HRule(out)
			var i int
			for i = 0; data[i] != '\n'; i++ {
			}
			data = data[i:]
			continue
		}
		if p.quotePrefix(data) > 0 {
			data = data[p.quote(out, data):]
			continue
		}
		if p.flags&EXTENSION_TABLES != 0 {
			if i := p.table(out, data); i > 0 {
				data = data[i:]
				continue
			}
		}
		if p.uliPrefix(data) > 0 {
			data = data[p.list(out, data, 0):]
			continue
		}
		if p.oliPrefix(data) > 0 {
			data = data[p.list(out, data, LIST_TYPE_ORDERED):]
			continue
		}
		if p.flags&EXTENSION_DEFINITION_LISTS != 0 {
			if p.dliPrefix(data) > 0 {
				data = data[p.list(out, data, LIST_TYPE_DEFINITION):]
				continue
			}
		}
		data = data[p.paragraph(out, data):]
	}
	p.nesting--
}
Parse block-level data.
Note: this function and many that it calls assume that
the input buffer ends with a newline.
package blackfriday
import (
	"bytes"
	"strings"
	"unicode"
)