all repos — grayfriday @ 17ca261449c01b960911b516b72f04cb6f6a4fd8

blackfriday fork with a few changes

optimisation: only fix fenced code blocks if the extensions parser flag is set... ;-)
Mathias Leppich mleppich@muhqu.de
Tue, 01 Apr 2014 23:14:31 +0200
commit

17ca261449c01b960911b516b72f04cb6f6a4fd8

parent

093273323af9011bf873707b22b7659703557904

1 files changed, 8 insertions(+), 7 deletions(-)

jump to
M markdown.gomarkdown.go

@@ -324,15 +324,16 @@ for end < len(input) && input[end] != '\n' && input[end] != '\r' {

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 {