all repos — grayfriday @ 8df342acd510645e8bbc608a209e788edd2667d6

blackfriday fork with a few changes

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.
Dmitri Shuralyov shurcooL@gmail.com
Fri, 11 Apr 2014 21:27:28 -0700
commit

8df342acd510645e8bbc608a209e788edd2667d6

parent

ef2a2b02dc226565748b2546054149c1349a4dc2

1 files changed, 4 insertions(+), 2 deletions(-)

jump to
M markdown.gomarkdown.go

@@ -330,9 +330,11 @@ }

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 } }