fix: use autolinks for URLs that contain an ampersand
The link text goes through TextConverter, which escapes `&` to `&`, while the href is the decoded attribute value, so `$href === $text` never held for a URL with a query string like `?a=1&b=2`. Undo that escaping before comparing. Only `&` is undone: `<` and `>` cannot appear in an autolink, so those links keep the inline form. Fixes #248
This commit is contained in:
1 parent
a82cc3b9b6
commit
94062cea69
2 files changed
+3
-1
No files matched your search
@@ -163,6 +163,8 @@ class HtmlConverterTest extends TestCase
|
||||
$this->assertHtmlGivesMarkdown('<a href="google.com">google.com</a>', '[google.com](google.com)');
|
||||
$this->assertHtmlGivesMarkdown('<a href="https://www.google.com">https://www.google.com</a>', '<https://www.google.com>');
|
||||
$this->assertHtmlGivesMarkdown('<a href="ftp://files.example.com">ftp://files.example.com</a>', '<ftp://files.example.com>');
|
||||
$this->assertHtmlGivesMarkdown('<a href="https://example.com/?a=1&b=2">https://example.com/?a=1&b=2</a>', '<https://example.com/?a=1&b=2>');
|
||||
$this->assertHtmlGivesMarkdown('<a href="https://example.com/<b>">https://example.com/<b></a>', '[https://example.com/<b>](https://example.com/<b>)');
|
||||
$this->assertHtmlGivesMarkdown('<a href="mailto:test@example.com">test@example.com</a>', '<test@example.com>');
|
||||
$this->assertHtmlGivesMarkdown('<a href="mailto:test+foo@example.bar-baz.com">test+foo@example.bar-baz.com</a>', '<test+foo@example.bar-baz.com>');
|
||||
|
||||
|
||||
Reference in new issue
Block a user