1
0
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:
Aidan Woods
2019-01-27 20:53:11 +00:00
parent 5ada761532
commit 0f55cd5b26
5 changed files with 8 additions and 10 deletions

View File

@@ -61,8 +61,8 @@ final class Link implements Inline
$remainder = \substr($remainder, $width);
if (\preg_match('/^[(]\s*+((?:[^ ()]++|[(][^ )]+[)])++)(?:[ ]+("[^"]*+"|\'[^\']*+\'))?\s*+[)]/', $remainder, $matches)) {
$url = $matches[1];
if (\preg_match('/^[(]\s*+(?:((?:[^ ()]++|[(][^ )]+[)])++)(?:[ ]+("[^"]*+"|\'[^\']*+\'))?\s*+)?[)]/', $remainder, $matches)) {
$url = isset($matches[1]) ? $matches[1] : '';
$title = isset($matches[2]) ? \substr($matches[2], 1, - 1) : null;
$width += \strlen($matches[0]);