diff --git a/Parsedown.php b/Parsedown.php index 28fab36..9aebef5 100755 --- a/Parsedown.php +++ b/Parsedown.php @@ -649,7 +649,7 @@ class Parsedown 'element' => $Line['body'], ); - if ($matches[2] or $matches[1] === 'hr' or preg_match('/<\/'.$matches[1].'>[ ]*$/', $Line['text'])) + if ($matches[2] or in_array($matches[1], $this->voidElements) or preg_match('/<\/'.$matches[1].'>[ ]*$/', $Line['text'])) { $Block['closed'] = true; } @@ -1412,6 +1412,10 @@ class Parsedown '_' => '/^_((?:[^_]|__[^_]*__)+?)_(?!_)\b/us', ); + protected $voidElements = array( + 'area', 'base', 'br', 'col', 'command', 'embed', 'hr', 'img', 'input', 'link', 'meta', 'param', 'source', + ); + protected $textLevelElements = array( 'a', 'br', 'bdo', 'abbr', 'blink', 'nextid', 'acronym', 'basefont', 'b', 'em', 'big', 'cite', 'small', 'spacer', 'listing',