mirror of
https://github.com/erusev/parsedown.git
synced 2023-08-10 21:13:06 +03:00
Permit empty links
This commit is contained in:
parent
5ada761532
commit
0f55cd5b26
@ -61,8 +61,8 @@ final class Link implements Inline
|
|||||||
|
|
||||||
$remainder = \substr($remainder, $width);
|
$remainder = \substr($remainder, $width);
|
||||||
|
|
||||||
if (\preg_match('/^[(]\s*+((?:[^ ()]++|[(][^ )]+[)])++)(?:[ ]+("[^"]*+"|\'[^\']*+\'))?\s*+[)]/', $remainder, $matches)) {
|
if (\preg_match('/^[(]\s*+(?:((?:[^ ()]++|[(][^ )]+[)])++)(?:[ ]+("[^"]*+"|\'[^\']*+\'))?\s*+)?[)]/', $remainder, $matches)) {
|
||||||
$url = $matches[1];
|
$url = isset($matches[1]) ? $matches[1] : '';
|
||||||
$title = isset($matches[2]) ? \substr($matches[2], 1, - 1) : null;
|
$title = isset($matches[2]) ? \substr($matches[2], 1, - 1) : null;
|
||||||
|
|
||||||
$width += \strlen($matches[0]);
|
$width += \strlen($matches[0]);
|
||||||
|
@ -1,3 +1 @@
|
|||||||
<p><a href="#fragment">link</a></p>
|
<p><a href="">link</a></p>
|
||||||
<p><a href="http://example.com#fragment">link</a></p>
|
|
||||||
<p><a href="http://example.com?foo=3#frag">link</a></p>
|
|
@ -1,5 +1 @@
|
|||||||
[link](#fragment)
|
[link]()
|
||||||
|
|
||||||
[link](http://example.com#fragment)
|
|
||||||
|
|
||||||
[link](http://example.com?foo=3#frag)
|
|
1
tests/commonmark/547-Links.html
Normal file
1
tests/commonmark/547-Links.html
Normal file
@ -0,0 +1 @@
|
|||||||
|
<p><a href="">foo</a></p>
|
3
tests/commonmark/547-Links.md
Normal file
3
tests/commonmark/547-Links.md
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
[foo]()
|
||||||
|
|
||||||
|
[foo]: /url1
|
Loading…
Reference in New Issue
Block a user