From 03ff22c7df8e4aac3a5a309df5f6edb0685b6e0b Mon Sep 17 00:00:00 2001 From: Andy Miller Date: Sat, 10 Jan 2015 19:40:39 -0700 Subject: [PATCH] Attempted fix for stripped classes on images with ParsedownExtra - re: https://github.com/erusev/parsedown-extra/issues/32 --- Parsedown.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Parsedown.php b/Parsedown.php index 8f15d9e..be42850 100755 --- a/Parsedown.php +++ b/Parsedown.php @@ -1298,6 +1298,8 @@ class Parsedown $Inline = $this->inlineLink($excerpt); + $backup = $Inline; + if ($Inline === null) { return; @@ -1305,14 +1307,12 @@ class Parsedown $Inline['extent'] ++; - $Inline['element'] = array( - 'name' => 'img', - 'attributes' => array( - 'src' => $Inline['element']['attributes']['href'], - 'alt' => $Inline['element']['text'], - 'title' => $Inline['element']['attributes']['title'], - ), - ); + $Inline['element']['name'] = 'img'; + $Inline['element']['attributes']['src'] = $Inline['element']['attributes']['href']; + unset($Inline['element']['attributes']['href']); + + $Inline['element']['attributes']['alt'] = $Inline['element']['text']; + unset($Inline['element']['text']); return $Inline; }