Match CommonMark spec on HTML comments:

Start condition: line begins with the string `<!--`.
End condition: line contains the string `-->`.
This commit is contained in:
Aidan Woods 2018-03-30 19:22:50 +01:00
parent 20e592359f
commit aa90dd481a
No known key found for this signature in database
GPG Key ID: 9A6A8EFAA512BBB9
1 changed files with 3 additions and 3 deletions

View File

@ -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'], '<!--') === 0)
{
$Block = array(
'element' => array('rawHtml' => $Line['body']),
);
if (preg_match('/-->$/', $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;
}