From 4c77cc7aa7fff01a6a6a53f2331636023921a467 Mon Sep 17 00:00:00 2001 From: Jukka Rautanen Date: Mon, 11 Jun 2018 15:54:42 +0300 Subject: [PATCH] Allow setting target for URLs --- Parsedown.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/Parsedown.php b/Parsedown.php index de8679e..6c5a646 100644 --- a/Parsedown.php +++ b/Parsedown.php @@ -82,6 +82,15 @@ class Parsedown } protected $urlsLinked = true; + + function setUrlsTarget($urlsTarget) + { + $this->urlsTarget = $urlsTarget; + + return $this; + } + + protected $urlsTarget = false; function setSafeMode($safeMode) { @@ -1534,6 +1543,10 @@ class Parsedown ), ), ); + + if ($this->urlsTarget === true) { + $Inline['element']['attributes']['target'] = '_blank'; + } return $Inline; }