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.
pull/107/head
Dmitri Shuralyov 2014-08-26 21:00:07 -07:00
parent 52f7a2a7b0
commit 78172e5f73
1 changed files with 3 additions and 1 deletions

View File

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