From 68f3aea0367c409a338eee7fc02d75d2af064bc8 Mon Sep 17 00:00:00 2001 From: naNuke Date: Fri, 10 Oct 2014 19:07:25 +0200 Subject: [PATCH 1/2] Ignore html comments as well with markupEscape option. --- Parsedown.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Parsedown.php b/Parsedown.php index 4a85820..28fab36 100755 --- a/Parsedown.php +++ b/Parsedown.php @@ -359,6 +359,11 @@ class Parsedown protected function identifyComment($Line) { + if ($this->markupEscaped) + { + return; + } + if (isset($Line['text'][3]) and $Line['text'][3] === '-' and $Line['text'][2] === '-' and $Line['text'][1] === '!') { $Block = array( From 74926c98310be9b3c5eedc61af28ec0b4bb4af65 Mon Sep 17 00:00:00 2001 From: naNuke Date: Fri, 10 Oct 2014 20:07:41 +0200 Subject: [PATCH 2/2] Add test of escaped html comment. --- test/ParsedownTest.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/test/ParsedownTest.php b/test/ParsedownTest.php index 3763372..d094f2d 100644 --- a/test/ParsedownTest.php +++ b/test/ParsedownTest.php @@ -109,6 +109,10 @@ paragraph color: red; } + +comment + + MARKDOWN_WITH_MARKUP; $expectedHtml = <<

</style>

+

comment

+

<!-- html comment -->

EXPECTED_HTML; $parsedownWithNoMarkup = new Parsedown(); $parsedownWithNoMarkup->setMarkupEscaped(true);