This commit is contained in:
Emanuil Rusev 2015-01-24 14:02:45 +02:00
parent 70e7a17380
commit 4d3079b908
3 changed files with 9 additions and 3 deletions

View File

@ -1199,7 +1199,7 @@ class Parsedown
return;
}
if (preg_match('/^[(]((?:[^ (]|[(][^ )]+[)])+)(?:[ ]+("[^"]+"|\'[^\']+\'))?[)]/', $remainder, $matches))
if (preg_match('/^[(]((?:[^ ()]|[(][^ )]+[)])+)(?:[ ]+("[^"]+"|\'[^\']+\'))?[)]/', $remainder, $matches))
{
$Element['attributes']['href'] = $matches[1];

View File

@ -1,4 +1,6 @@
<p><a href="http://example.com">link</a> and <a href="/url-with-(parentheses)">another link</a></p>
<p><a href="http://example.com">link</a></p>
<p><a href="/url-(parentheses)">link</a> with parentheses in URL </p>
<p>(<a href="/index.php">link</a>) in parentheses</p>
<p><a href="http://example.com"><code>link</code></a></p>
<p><a href="http://example.com"><img src="http://parsedown.org/md.png" alt="MD Logo" /></a></p>
<p><a href="http://example.com"><img src="http://parsedown.org/md.png" alt="MD Logo" /> and text</a></p>

View File

@ -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)