Merge pull request #236 from naNuke/escapeComment

Ignore html comments as well with markupEscape option.
This commit is contained in:
Emanuil Rusev 2014-10-10 21:11:23 +03:00
commit 2adb87ef41
2 changed files with 11 additions and 0 deletions

View File

@ -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(

View File

@ -109,6 +109,10 @@ paragraph
color: red;
}
</style>
comment
<!-- html comment -->
MARKDOWN_WITH_MARKUP;
$expectedHtml = <<<EXPECTED_HTML
@ -125,6 +129,8 @@ MARKDOWN_WITH_MARKUP;
color: red;
}</code></pre>
<p>&lt;/style></p>
<p>comment</p>
<p>&lt;!-- html comment --></p>
EXPECTED_HTML;
$parsedownWithNoMarkup = new Parsedown();
$parsedownWithNoMarkup->setMarkupEscaped(true);