diff --git a/system/src/Grav/Common/Markdown/ParsedownGravTrait.php b/system/src/Grav/Common/Markdown/ParsedownGravTrait.php index e972e471c..c507606bd 100644 --- a/system/src/Grav/Common/Markdown/ParsedownGravTrait.php +++ b/system/src/Grav/Common/Markdown/ParsedownGravTrait.php @@ -19,7 +19,7 @@ trait ParsedownGravTrait protected $pages_dir; protected $special_chars; - protected $twig_link_regex = '/\!*\[(?:.*)\]\(([{{|{%|{#].*[#}|%}|}}])\)/'; + protected $twig_link_regex = '/\!*\[(?:.*)\]\((\{([\{%#])\s*(.*?)\s*(?:\2|\})\})\)/'; /** * Initialiazation function to setup key variables needed by the MarkdownGravLinkTrait @@ -227,7 +227,7 @@ trait ParsedownGravTrait $url = parse_url(htmlspecialchars_decode($excerpt['element']['attributes']['href'])); // if there is no scheme, the file is local - if (!isset($url['scheme'])) { + if (!isset($url['scheme']) and (count($url) > 0)) { // convert the URl is required $excerpt['element']['attributes']['href'] = $this->convertUrl(Uri::buildUrl($url)); }