From 49ae7f992595197e2fd68a3b51bd1f873e13d2ed Mon Sep 17 00:00:00 2001 From: Aidan Woods Date: Tue, 24 Jan 2017 00:37:45 +0000 Subject: [PATCH] line indent from line whitespace after marker; more leneant on condition for indent match on list start (prevents test 243 breaking) --- Parsedown.php | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/Parsedown.php b/Parsedown.php index 1dd60f0..373b060 100644 --- a/Parsedown.php +++ b/Parsedown.php @@ -599,14 +599,11 @@ class Parsedown protected function blockListContinue($Line, array $Block) { - if (preg_match('/^('.$Block['pattern'].')(?:[ ]+(.*)|$)/', $Line['text'], $matches)) + if (preg_match('/^('.$Block['pattern'].')([ ]+)(?:(.*)|$)/', $Line['text'], $matches)) { - if (isset($Block['markerWhitespace'])) - { - $Line['indent'] += strlen($matches[1]) + $Block['markerWhitespace']; - } + $Line['indent'] += strlen($matches[1]) + strlen($matches[2]); - if ($Block['indent'] === $Line['indent']) + if ($Block['indent'] - $Block['markerWhitespace'] <= $Line['indent']) { if (isset($Block['interrupted'])) { @@ -617,7 +614,7 @@ class Parsedown unset($Block['li']); - $text = isset($matches[2]) ? $matches[2] : ''; + $text = isset($matches[3]) ? $matches[3] : ''; $Block['li'] = array( 'name' => 'li',