From da5d75e97e1ed19e57bd54fa6cb595a6a0879a67 Mon Sep 17 00:00:00 2001 From: Emanuil Rusev Date: Wed, 29 Oct 2014 22:29:23 +0200 Subject: [PATCH] resolve #209 --- Parsedown.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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',