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
@@ -26,7 +26,7 @@ class LinkConverter implements ConverterInterface, ConfigurationAwareInterface
|
||||
|
||||
if ($title !== '') {
|
||||
$markdown = '[' . $text . '](' . $href . ' "' . $title . '")';
|
||||
} elseif ($href === $text && $this->isValidAutolink($href)) {
|
||||
} elseif ($href === \str_replace('&', '&', $text) && $this->isValidAutolink($href)) {
|
||||
$markdown = '<' . $href . '>';
|
||||
} elseif ($href === 'mailto:' . $text && $this->isValidEmail($text)) {
|
||||
$markdown = '<' . $text . '>';
|
||||
|
||||
Reference in new issue
Block a user