diff --git a/Parsedown.php b/Parsedown.php index 87f9337..986b86e 100644 --- a/Parsedown.php +++ b/Parsedown.php @@ -264,7 +264,7 @@ class Parsedown { if (isset($CurrentBlock)) { - $Elements[] = $CurrentBlock['element']; + $Elements[] = $this->extractElement($CurrentBlock); } $Block['identified'] = true; @@ -296,7 +296,7 @@ class Parsedown { if (isset($CurrentBlock)) { - $Elements[] = $CurrentBlock['element']; + $Elements[] = $this->extractElement($CurrentBlock); } $CurrentBlock = $this->paragraph($Line); @@ -316,7 +316,7 @@ class Parsedown if (isset($CurrentBlock)) { - $Elements[] = $CurrentBlock['element']; + $Elements[] = $this->extractElement($CurrentBlock); } # ~ @@ -324,6 +324,16 @@ class Parsedown return $Elements; } + protected function extractElement(array $Component) + { + if ( ! isset($Component['element']) and isset($Component['markup'])) + { + $Component['element'] = array('rawHtml' => $Component['markup']); + } + + return $Component['element']; + } + protected function isBlockContinuable($Type) { return method_exists($this, 'block'.$Type.'Continue'); @@ -1169,7 +1179,7 @@ class Parsedown $Elements[] = $InlineText['element']; # compile the inline - $Elements[] = $Inline['element']; + $Elements[] = $this->extractElement($Inline); # remove the examined text $text = substr($text, $Inline['position'] + $Inline['extent']);