From 8c3eacd7a58325ce0952cd78cb6e83339dbeee97 Mon Sep 17 00:00:00 2001 From: autopp Date: Mon, 21 Jan 2019 03:38:36 +0900 Subject: [PATCH] Fix checking of backslash in link text (#510) (#512) --- inline.go | 2 +- testdata/Links, inline style.html | 2 ++ testdata/Links, inline style.text | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/inline.go b/inline.go index 4483b8f..27056eb 100644 --- a/inline.go +++ b/inline.go @@ -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] == '[': diff --git a/testdata/Links, inline style.html b/testdata/Links, inline style.html index 5802f2d..d0ea472 100644 --- a/testdata/Links, inline style.html +++ b/testdata/Links, inline style.html @@ -8,4 +8,6 @@

URL and title.

+

URL with backslashes\.

+

[Empty]().

diff --git a/testdata/Links, inline style.text b/testdata/Links, inline style.text index 09017a9..dfa328d 100644 --- a/testdata/Links, inline style.text +++ b/testdata/Links, inline style.text @@ -8,5 +8,6 @@ Just a [URL](/url/). [URL and title](/url/ "title has spaces afterward" ). +[URL with backslashes\\](/url/). [Empty]().