diff --git a/Parsedown.php b/Parsedown.php index fd05e80..19dd2cb 100755 --- a/Parsedown.php +++ b/Parsedown.php @@ -1199,7 +1199,7 @@ class Parsedown return; } - if (preg_match('/^[(]((?:[^ (]|[(][^ )]+[)])+)(?:[ ]+("[^"]+"|\'[^\']+\'))?[)]/', $remainder, $matches)) + if (preg_match('/^[(]((?:[^ ()]|[(][^ )]+[)])+)(?:[ ]+("[^"]+"|\'[^\']+\'))?[)]/', $remainder, $matches)) { $Element['attributes']['href'] = $matches[1]; diff --git a/test/data/inline_link.html b/test/data/inline_link.html index 0a0e0a7..5ad564a 100644 --- a/test/data/inline_link.html +++ b/test/data/inline_link.html @@ -1,4 +1,6 @@ -

link and another link

+

link

+

link with parentheses in URL

+

(link) in parentheses

link

MD Logo

MD Logo and text

\ No newline at end of file diff --git a/test/data/inline_link.md b/test/data/inline_link.md index bef9031..6bac0b3 100644 --- a/test/data/inline_link.md +++ b/test/data/inline_link.md @@ -1,4 +1,8 @@ -[link](http://example.com) and [another link](/url-with-(parentheses)) +[link](http://example.com) + +[link](/url-(parentheses)) with parentheses in URL + +([link](/index.php)) in parentheses [`link`](http://example.com)