mirror of
https://github.com/russross/blackfriday.git
synced 2024-03-22 13:40:34 +08:00
optimisation: only fix fenced code blocks if the extensions parser flag is set... ;-)
This commit is contained in:
parent
093273323a
commit
17ca261449
15
markdown.go
15
markdown.go
|
@ -324,15 +324,16 @@ func firstPass(p *parser, input []byte) []byte {
|
|||
end++
|
||||
}
|
||||
|
||||
// when last line was none blank and a fenced code block comes after
|
||||
if !lastLineWasBlank && beg >= lastFencedCodeBlockEnd {
|
||||
i := p.fencedCode(&out, append(input[beg:], '\n'), false)
|
||||
if i > 0 {
|
||||
out.WriteByte('\n') // need to inject additional linebreak
|
||||
lastFencedCodeBlockEnd = beg + i
|
||||
if p.flags&EXTENSION_FENCED_CODE != 0 {
|
||||
// when last line was none blank and a fenced code block comes after
|
||||
if !lastLineWasBlank && beg >= lastFencedCodeBlockEnd {
|
||||
if i := p.fencedCode(&out, append(input[beg:], '\n'), false); i > 0 {
|
||||
out.WriteByte('\n') // need to inject additional linebreak
|
||||
lastFencedCodeBlockEnd = beg + i
|
||||
}
|
||||
}
|
||||
lastLineWasBlank = end == beg
|
||||
}
|
||||
lastLineWasBlank = end == beg
|
||||
|
||||
// add the line body if present
|
||||
if end > beg {
|
||||
|
|
Loading…
Reference in New Issue
Block a user