mirror of
https://github.com/erusev/parsedown.git
synced 2023-08-10 21:13:06 +03:00
Match CommonMark spec on HTML comments:
Start condition: line begins with the string `<!--`. End condition: line contains the string `-->`.
This commit is contained in:
parent
20e592359f
commit
aa90dd481a
@ -383,13 +383,13 @@ class Parsedown
|
|||||||
return;
|
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(
|
$Block = array(
|
||||||
'element' => array('rawHtml' => $Line['body']),
|
'element' => array('rawHtml' => $Line['body']),
|
||||||
);
|
);
|
||||||
|
|
||||||
if (preg_match('/-->$/', $Line['text']))
|
if (strpos($Line['text'], '-->') !== false)
|
||||||
{
|
{
|
||||||
$Block['closed'] = true;
|
$Block['closed'] = true;
|
||||||
}
|
}
|
||||||
@ -407,7 +407,7 @@ class Parsedown
|
|||||||
|
|
||||||
$Block['element']['rawHtml'] .= "\n" . $Line['body'];
|
$Block['element']['rawHtml'] .= "\n" . $Line['body'];
|
||||||
|
|
||||||
if (preg_match('/-->$/', $Line['text']))
|
if (strpos($Line['text'], '-->') !== false)
|
||||||
{
|
{
|
||||||
$Block['closed'] = true;
|
$Block['closed'] = true;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user