From 535ad76f6125eae56cef547b85c060974188a964 Mon Sep 17 00:00:00 2001 From: autopp Date: Mon, 21 Jan 2019 03:36:43 +0900 Subject: [PATCH] Fix checking of backslash in link text (#510) (#511) --- 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 4ed2907..d45bd94 100644 --- a/inline.go +++ b/inline.go @@ -278,7 +278,7 @@ func link(p *Markdown, data []byte, offset int) (int, *Node) { 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..a611260 100644 --- a/testdata/Links, inline style.html +++ b/testdata/Links, inline style.html @@ -8,4 +8,6 @@

URL and title.

+

URL with backslash\.

+

[Empty]().

diff --git a/testdata/Links, inline style.text b/testdata/Links, inline style.text index 09017a9..6de7ab4 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 backslash\\](/url/). [Empty]().