From a9c21447cee7393bd20a4b26609ddbcb2ebf1332 Mon Sep 17 00:00:00 2001 From: Aidan Woods Date: Wed, 28 Mar 2018 15:38:11 +0100 Subject: [PATCH] Only interrupt paragraph if starting with 1 --- Parsedown.php | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/Parsedown.php b/Parsedown.php index 11e50d5..5ca40d8 100644 --- a/Parsedown.php +++ b/Parsedown.php @@ -523,7 +523,7 @@ class Parsedown # # List - protected function blockList($Line) + protected function blockList($Line, array $CurrentBlock = null) { list($name, $pattern) = $Line['text'][0] <= '-' ? array('ul', '[*+-]') : array('ol', '[0-9]{1,9}[.\)]'); @@ -556,12 +556,20 @@ class Parsedown ), ); - if($name === 'ol') + if ($name === 'ol') { $listStart = ltrim(strstr($matches[1], $Block['data']['markerType'], true), '0') ?: '0'; - if($listStart !== '1') + if ($listStart !== '1') { + if ( + isset($CurrentBlock) + and ! isset($CurrentBlock['type']) + and ! isset($CurrentBlock['interrupted']) + ) { + return; + } + $Block['element']['attributes'] = array('start' => $listStart); } }