1
0
mirror of https://github.com/erusev/parsedown.git synced 2023-08-10 21:13:06 +03:00

Match GFM spec for extended autolinks

There is a small list of characters which may precede an autolink
This commit is contained in:
Aidan Woods 2019-03-26 21:38:21 +00:00
parent de1e0b9361
commit 99525fdd76
No known key found for this signature in database
GPG Key ID: 9A6A8EFAA512BBB9

View File

@ -38,7 +38,12 @@ final class Url implements BacktrackingInline
*/ */
public static function build(Excerpt $Excerpt, State $State) public static function build(Excerpt $Excerpt, State $State)
{ {
if (\preg_match('/\bhttps?+:[\/]{2}[^\s<]+\b\/*+/ui', $Excerpt->context(), $matches, \PREG_OFFSET_CAPTURE)) { if (\preg_match(
'/(?<=^|\s|[*_~(])https?+:[\/]{2}[^\s<]+\b\/*+/ui',
$Excerpt->context(),
$matches,
\PREG_OFFSET_CAPTURE
)) {
return new self($matches[0][0], \intval($matches[0][1])); return new self($matches[0][0], \intval($matches[0][1]));
} }