Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
yuin committed Nov 29, 2019
1 parent 54fc7c3 commit 8549b83
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
12 changes: 12 additions & 0 deletions _test/extra.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,15 @@
B</li>
</ul>
//= = = = = = = = = = = = = = = = = = = = = = = =//
2
//- - - - - - - - -//
**test**\
test**test**\
**test**test\
test**test**
//- - - - - - - - -//
<p><strong>test</strong><br />
test<strong>test</strong><br />
<strong>test</strong>test<br />
test<strong>test</strong></p>
//= = = = = = = = = = = = = = = = = = = = = = = =//
8 changes: 4 additions & 4 deletions parser/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -1088,17 +1088,17 @@ func (p *parser) parseBlock(block text.BlockReader, parent ast.Node, pc Context)
lineLength := len(line)
hardlineBreak := false
softLinebreak := line[lineLength-1] == '\n'
if lineLength > 2 && line[lineLength-2] == '\\' && softLinebreak { // ends with \\n
if lineLength >= 2 && line[lineLength-2] == '\\' && softLinebreak { // ends with \\n
lineLength -= 2
hardlineBreak = true

} else if lineLength > 3 && line[lineLength-3] == '\\' && line[lineLength-2] == '\r' && softLinebreak { // ends with \\r\n
} else if lineLength >= 3 && line[lineLength-3] == '\\' && line[lineLength-2] == '\r' && softLinebreak { // ends with \\r\n
lineLength -= 3
hardlineBreak = true
} else if lineLength > 3 && line[lineLength-3] == ' ' && line[lineLength-2] == ' ' && softLinebreak { // ends with [space][space]\n
} else if lineLength >= 3 && line[lineLength-3] == ' ' && line[lineLength-2] == ' ' && softLinebreak { // ends with [space][space]\n
lineLength -= 3
hardlineBreak = true
} else if lineLength > 4 && line[lineLength-4] == ' ' && line[lineLength-3] == ' ' && line[lineLength-2] == '\r' && softLinebreak { // ends with [space][space]\r\n
} else if lineLength >= 4 && line[lineLength-4] == ' ' && line[lineLength-3] == ' ' && line[lineLength-2] == '\r' && softLinebreak { // ends with [space][space]\r\n
lineLength -= 4
hardlineBreak = true
}
Expand Down

0 comments on commit 8549b83

Please sign in to comment.