Support list items starting with indented code

This commit is contained in:
Daniel Rudolf 2016-10-13 19:47:06 +02:00
parent 4b3b7df710
commit 1d61f90bf9
No known key found for this signature in database
GPG Key ID: A061F02CD8DE4538
1 changed files with 6 additions and 1 deletions

View File

@ -506,7 +506,12 @@ class Parsedown
if (preg_match('/^('.$pattern.'([ ]+|$))(.*)/', $Line['text'], $matches))
{
if ($matches[2] === '') {
$contentIndent = strlen($matches[2]);
if ($contentIndent >= 5) {
$contentIndent -= 1;
$matches[1] = substr($matches[1], 0, -$contentIndent);
$matches[3] = str_repeat(' ', $contentIndent) . $matches[3];
} elseif ($contentIndent === 0) {
$matches[1] .= ' ';
}