From aa90dd481ae5f65e461078fe18e77b1d964caaf1 Mon Sep 17 00:00:00 2001 From: Aidan Woods Date: Fri, 30 Mar 2018 19:22:50 +0100 Subject: [PATCH] Match CommonMark spec on HTML comments: Start condition: line begins with the string ``. --- Parsedown.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Parsedown.php b/Parsedown.php index 5ca40d8..0313408 100644 --- a/Parsedown.php +++ b/Parsedown.php @@ -383,13 +383,13 @@ class Parsedown return; } - if (isset($Line['text'][3]) and $Line['text'][3] === '-' and $Line['text'][2] === '-' and $Line['text'][1] === '!') + if (strpos($Line['text'], '$/', $Line['text'])) + if (strpos($Line['text'], '-->') !== false) { $Block['closed'] = true; } @@ -407,7 +407,7 @@ class Parsedown $Block['element']['rawHtml'] .= "\n" . $Line['body']; - if (preg_match('/-->$/', $Line['text'])) + if (strpos($Line['text'], '-->') !== false) { $Block['closed'] = true; }