1
0
mirror of https://github.com/erusev/parsedown.git synced 2023-08-10 21:13:06 +03:00
This commit is contained in:
Emanuil Rusev 2014-05-14 13:14:49 +03:00
parent 532b5ede35
commit 2da10d277b
3 changed files with 51 additions and 1 deletions

View File

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

View File

@ -0,0 +1,5 @@
<!-- single line -->
<p>paragraph</p>
<!--
multiline -->
<p>paragraph</p>

View File

@ -0,0 +1,8 @@
<!-- single line -->
paragraph
<!--
multiline -->
paragraph