From 79d924040aca7c6f00817b213f086acbcd575597 Mon Sep 17 00:00:00 2001 From: Emanuil Rusev Date: Fri, 16 Jan 2015 01:24:02 +0200 Subject: [PATCH] improve CommonMark compliance --- Parsedown.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/Parsedown.php b/Parsedown.php index c5c988a..4292712 100755 --- a/Parsedown.php +++ b/Parsedown.php @@ -1212,12 +1212,20 @@ class Parsedown protected function inlineTag($excerpt) { - if ($this->markupEscaped) + if ($this->markupEscaped or strpos($excerpt, '>') === false) { return; } - if (strpos($excerpt, '>') !== false and preg_match('/^<\/?\w.*?>/s', $excerpt, $matches)) + if (preg_match('/^<\w*(?:[ ]*'.$this->regexHtmlAttribute.')*[ ]*\/?>/s', $excerpt, $matches)) + { + return array( + 'markup' => $matches[0], + 'extent' => strlen($matches[0]), + ); + } + + if ($excerpt[1] === '/' and preg_match('/^<\/\w*[ ]*>/s', $excerpt, $matches)) { return array( 'markup' => $matches[0],