mirror of
https://github.com/erusev/parsedown.git
synced 2023-08-10 21:13:06 +03:00
resolve #105
This commit is contained in:
parent
532b5ede35
commit
2da10d277b
@ -87,7 +87,7 @@ class Parsedown
|
||||
'8' => array('List'),
|
||||
'9' => array('List'),
|
||||
':' => array('Table'),
|
||||
'<' => array('Markup'),
|
||||
'<' => array('Comment', 'Markup'),
|
||||
'=' => array('Setext'),
|
||||
'>' => array('Quote'),
|
||||
'_' => array('Rule'),
|
||||
@ -346,6 +346,43 @@ class Parsedown
|
||||
return $Block;
|
||||
}
|
||||
|
||||
#
|
||||
# Comment
|
||||
|
||||
protected function identifyComment($Line)
|
||||
{
|
||||
if (isset($Line['text'][3]) and $Line['text'][3] === '-' and $Line['text'][2] === '-' and $Line['text'][1] === '!')
|
||||
{
|
||||
$Block = array(
|
||||
'element' => $Line['body'],
|
||||
);
|
||||
|
||||
if (preg_match('/-->$/', $Line['text']))
|
||||
{
|
||||
$Block['closed'] = true;
|
||||
}
|
||||
|
||||
return $Block;
|
||||
}
|
||||
}
|
||||
|
||||
protected function addToComment($Line, array $Block)
|
||||
{
|
||||
if (isset($Block['closed']))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
$Block['element'] .= "\n" . $Line['body'];
|
||||
|
||||
if (preg_match('/-->$/', $Line['text']))
|
||||
{
|
||||
$Block['closed'] = true;
|
||||
}
|
||||
|
||||
return $Block;
|
||||
}
|
||||
|
||||
#
|
||||
# Fenced Code
|
||||
|
||||
|
5
test/data/HTML_Comment.html
Normal file
5
test/data/HTML_Comment.html
Normal file
@ -0,0 +1,5 @@
|
||||
<!-- single line -->
|
||||
<p>paragraph</p>
|
||||
<!--
|
||||
multiline -->
|
||||
<p>paragraph</p>
|
8
test/data/HTML_Comment.md
Normal file
8
test/data/HTML_Comment.md
Normal file
@ -0,0 +1,8 @@
|
||||
<!-- single line -->
|
||||
|
||||
paragraph
|
||||
|
||||
<!--
|
||||
multiline -->
|
||||
|
||||
paragraph
|
Loading…
Reference in New Issue
Block a user