From 6973302ca8f6f8613cd76488ad3f87067458e215 Mon Sep 17 00:00:00 2001 From: Aidan Woods Date: Thu, 13 Oct 2016 15:55:13 +0100 Subject: [PATCH] Prevent breaking remaining previously compliant CommonMarkWeak tests --- Parsedown.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Parsedown.php b/Parsedown.php index f774b886a..e6a479917 100644 --- a/Parsedown.php +++ b/Parsedown.php @@ -165,7 +165,7 @@ protected function lines(array $lines, $parentType = null) if (isset($CurrentBlock['continuable'])) { - $Block = $this->{'block'.$CurrentBlock['type'].'Continue'}($Line, $CurrentBlock); + $Block = $this->{'block'.$CurrentBlock['type'].'Continue'}($Line, $CurrentBlock, $parentType); if (isset($Block)) { @@ -449,7 +449,7 @@ protected function blockFencedCode($Line) } } - protected function blockFencedCodeContinue($Line, $Block) + protected function blockFencedCodeContinue($Line, $Block, $parentType) { if (isset($Block['complete'])) { @@ -472,6 +472,11 @@ protected function blockFencedCodeContinue($Line, $Block) return $Block; } + if ($parentType === 'List') + { + $Line['body'] = preg_replace('/^[ ]{0,'.min(4, $Line['indent']).'}/', '', $Line['body']); + } + $Block['element']['text']['text'] .= "\n".$Line['body'];; return $Block;