From 78172e5f73ac979512446c56305609bd210cbd64 Mon Sep 17 00:00:00 2001 From: Dmitri Shuralyov Date: Tue, 26 Aug 2014 21:00:07 -0700 Subject: [PATCH] Improve parser to detect LineBreak independently of renderer. When checking if it's a newline preceeded by two spaces, look at the input data rather than the output, since the output depends on the renderer implementation. --- inline.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/inline.go b/inline.go index 8197110..651e4e8 100644 --- a/inline.go +++ b/inline.go @@ -166,8 +166,10 @@ func lineBreak(p *parser, out *bytes.Buffer, data []byte, offset int) int { } out.Truncate(eol) + precededByTwoSpaces := offset >= 2 && data[offset-2] == ' ' && data[offset-1] == ' ' + // should there be a hard line break here? - if p.flags&EXTENSION_HARD_LINE_BREAK == 0 && end-eol < 2 { + if p.flags&EXTENSION_HARD_LINE_BREAK == 0 && !precededByTwoSpaces { return 0 }