blackfriday icon indicating copy to clipboard operation
blackfriday copied to clipboard

Problem with an image link with a title containing parentheses

Open nobu-k opened this issue 4 years ago • 0 comments

Image links containing parentheses like ![foo with a title](/bar/ "title with ()") aren't parsed correctly. FYI, I've added the following test case in TestInlineLink in inline_test.go to see how it fails:

"![foo with a title](/bar/ \"title with ()\"  )\n",
"<p><img src=\"/bar/\" alt=\"foo with a title\" title=\"title with ()\" /></p>\n",

The result of go test was

--- FAIL: TestInlineLink (0.41s)
    helpers_test.go:81: 
        Input   ["![foo with a title](/bar/ \"title with ()\"  )\n"]
        Expected["<p><img src=\"/bar/\" alt=\"foo with a title\" title=\"title with ()\" /></p>\n"]
        Actual  ["<p><img src=\"/bar/ &quot;title with (\" alt=\"foo with a title\" />&quot;  )</p>\n"]
    helpers_test.go:81: 
        Input   ["![foo with a title](/bar/ \"title with ()\"  )\n"]
        Expected["<p><img src=\"http://localhost/bar/\" alt=\"foo with a title\" title=\"title with ()\" /></p>\n"]
        Actual  ["<p><img src=\"http://localhost/bar/ &quot;title with (\" alt=\"foo with a title\" />&quot;  )</p>\n"]
    helpers_test.go:81: 
        Input   ["![foo with a title](/bar/ \"title with ()\"  )\n"]
        Expected["<p><img src=\"http://localhost/bar/\" alt=\"foo with a title\" title=\"title with ()\" /></p>\n"]
        Actual  ["<p><img src=\"http://localhost/bar/ &quot;title with (\" alt=\"foo with a title\" />&quot;  )</p>\n"]
FAIL
exit status 1
FAIL    github.com/russross/blackfriday/v2      8.699s

GitHub parses this as expected: foo with a title

nobu-k avatar May 11 '20 05:05 nobu-k