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:
parent
de1e0b9361
commit
99525fdd76
@ -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]));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user