mirror of
https://github.com/russross/blackfriday.git
synced 2024-03-22 13:40:34 +08:00
Fix bug where newlines were inserted inside fenced code blocks.
Change firstPass() code that checks for fenced code blocks to check all of them and properly keep track of lastFencedCodeBlockEnd. This way, it won't misinterpret the end of a fenced code block as a beginning of a new one.
This commit is contained in:
parent
ef2a2b02dc
commit
8df342acd5
|
@ -330,9 +330,11 @@ func firstPass(p *parser, input []byte) []byte {
|
|||
|
||||
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 beg >= lastFencedCodeBlockEnd {
|
||||
if i := p.fencedCode(&out, append(input[beg:], '\n'), false); i > 0 {
|
||||
out.WriteByte('\n') // need to inject additional linebreak
|
||||
if !lastLineWasBlank {
|
||||
out.WriteByte('\n') // need to inject additional linebreak
|
||||
}
|
||||
lastFencedCodeBlockEnd = beg + i
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user