From 4d3079b908335b1dcd63bfaab3f1825bbc5d2974 Mon Sep 17 00:00:00 2001 From: Emanuil Rusev Date: Sat, 24 Jan 2015 14:02:45 +0200 Subject: [PATCH] resolve #274 --- Parsedown.php | 2 +- test/data/inline_link.html | 4 +++- test/data/inline_link.md | 6 +++++- 3 files changed, 9 insertions(+), 3 deletions(-) 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)