Skip to content

Commit

Permalink
#248 - 11
Browse files Browse the repository at this point in the history
  • Loading branch information
yuin committed Oct 17, 2021
1 parent 324b2d6 commit 4b793a1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
10 changes: 10 additions & 0 deletions _test/extra.txt
Original file line number Diff line number Diff line change
Expand Up @@ -591,3 +591,13 @@ a
//- - - - - - - - -//
<p>\v</p>
//= = = = = = = = = = = = = = = = = = = = = = = =//


47: Escape back slashes should not be treated as hard line breaks
//- - - - - - - - -//
\\\\
a
//- - - - - - - - -//
<p>\
a</p>
//= = = = = = = = = = = = = = = = = = = = = = = =//
4 changes: 2 additions & 2 deletions parser/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -1132,11 +1132,11 @@ func (p *parser) parseBlock(block text.BlockReader, parent ast.Node, pc Context)
softLinebreak := false
hardlineBreak := false
hasNewLine := line[lineLength-1] == '\n'
if lineLength >= 2 && line[lineLength-2] == '\\' && hasNewLine { // ends with \\n
if ((lineLength >= 3 && line[lineLength-2] == '\\' && line[lineLength-3] != '\\') || (lineLength == 2 && line[lineLength-2] == '\\')) && hasNewLine { // ends with \\n
lineLength -= 2
hardlineBreak = true

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

0 comments on commit 4b793a1

Please sign in to comment.