Skip to content

Commit

Permalink
Fix checking of backslash in link text (russross#510) (russross#512)
Browse files Browse the repository at this point in the history
  • Loading branch information
autopp authored and willdollman committed Feb 27, 2021
1 parent 375a6e5 commit cf8f0b0
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion inline.go
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ func link(p *parser, out *bytes.Buffer, data []byte, offset int) int {
case data[i] == '\n':
textHasNl = true

case data[i-1] == '\\':
case isBackslashEscaped(data, i):
continue

case data[i] == '[':
Expand Down
2 changes: 2 additions & 0 deletions testdata/Links, inline style.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,6 @@

<p><a href="/url/" title="title has spaces afterward">URL and title</a>.</p>

<p><a href="/url/">URL with backslashes\</a>.</p>

<p>[Empty]().</p>
1 change: 1 addition & 0 deletions testdata/Links, inline style.text
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@ Just a [URL](/url/).

[URL and title](/url/ "title has spaces afterward" ).

[URL with backslashes\\](/url/).

[Empty]().

0 comments on commit cf8f0b0

Please sign in to comment.