1
0
mirror of https://github.com/erusev/parsedown.git synced 2023-08-10 21:13:06 +03:00

Handle subsequent list items which aren't indented sufficiently

Subsequent list items which aren't indented sufficiently are treated as part of the original list, see CommonMark spec example [#256](http://spec.commonmark.org/0.26/#example-256).
This commit is contained in:
Daniel Rudolf 2016-10-13 20:44:02 +02:00
parent a9e1163c85
commit a3836b1853
No known key found for this signature in database
GPG Key ID: A061F02CD8DE4538

View File

@ -562,8 +562,10 @@ class Parsedown
return null;
}
$requiredIndent = ($Block['indent'] + strlen($Block['data']['marker']));
if (
$Block['indent'] === $Line['indent']
$Line['indent'] < $requiredIndent
and
(
(
@ -589,6 +591,8 @@ class Parsedown
$text = isset($matches[1]) ? $matches[1] : '';
$Block['indent'] = $Line['indent'];
$Block['li'] = array(
'name' => 'li',
'handler' => 'li',
@ -601,7 +605,7 @@ class Parsedown
return $Block;
}
elseif ($Block['indent'] === $Line['indent'] and $this->blockList($Line))
elseif ($Line['indent'] < $requiredIndent and $this->blockList($Line))
{
return null;
}
@ -611,8 +615,6 @@ class Parsedown
return $Block;
}
$requiredIndent = ($Block['indent'] + strlen($Block['data']['marker']));
if ($Line['indent'] >= $requiredIndent)
{
if (isset($Block['interrupted']))
@ -631,7 +633,6 @@ class Parsedown
if ( ! isset($Block['interrupted']))
{
// TODO: force multi-line paragraph, this must not parse any new block
$text = preg_replace('/^[ ]{0,'.$requiredIndent.'}/', '', $Line['body']);
$Block['li']['text'] []= $text;