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

Allow setting target for URLs

This commit is contained in:
Jukka Rautanen 2018-06-11 15:54:42 +03:00 committed by GitHub
parent ba3b60d6e4
commit 4c77cc7aa7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -83,6 +83,15 @@ class Parsedown
protected $urlsLinked = true; protected $urlsLinked = true;
function setUrlsTarget($urlsTarget)
{
$this->urlsTarget = $urlsTarget;
return $this;
}
protected $urlsTarget = false;
function setSafeMode($safeMode) function setSafeMode($safeMode)
{ {
$this->safeMode = (bool) $safeMode; $this->safeMode = (bool) $safeMode;
@ -1535,6 +1544,10 @@ class Parsedown
), ),
); );
if ($this->urlsTarget === true) {
$Inline['element']['attributes']['target'] = '_blank';
}
return $Inline; return $Inline;
} }
} }