mirror of
https://github.com/erusev/parsedown.git
synced 2025-09-05 20:33:03 +02:00
Merge pull request #592 from aidantwoods/fix/html-comment
Fix HTML comment endings
This commit is contained in:
@@ -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;
|
||||||
}
|
}
|
||||||
|
@@ -2,4 +2,10 @@
|
|||||||
<p>paragraph</p>
|
<p>paragraph</p>
|
||||||
<!--
|
<!--
|
||||||
multiline -->
|
multiline -->
|
||||||
<p>paragraph</p>
|
<p>paragraph</p>
|
||||||
|
<!-- sss -->abc
|
||||||
|
<ul>
|
||||||
|
<li>abcd</li>
|
||||||
|
<li>bbbb</li>
|
||||||
|
<li>cccc</li>
|
||||||
|
</ul>
|
@@ -5,4 +5,10 @@ paragraph
|
|||||||
<!--
|
<!--
|
||||||
multiline -->
|
multiline -->
|
||||||
|
|
||||||
paragraph
|
paragraph
|
||||||
|
|
||||||
|
<!-- sss -->abc
|
||||||
|
|
||||||
|
* abcd
|
||||||
|
* bbbb
|
||||||
|
* cccc
|
Reference in New Issue
Block a user