From bdf537e9d57035a12160ab4344e9a7361e327bbf Mon Sep 17 00:00:00 2001 From: Daniel Rudolf Date: Thu, 13 Oct 2016 19:30:50 +0200 Subject: [PATCH] Fix ordered list start argument See CommonMark spec examples [#226](http://spec.commonmark.org/0.26/#example-226) to #229 --- Parsedown.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Parsedown.php b/Parsedown.php index bb2bd11..ac83e50 100644 --- a/Parsedown.php +++ b/Parsedown.php @@ -502,7 +502,7 @@ class Parsedown protected function blockList($Line) { - list($name, $pattern) = $Line['text'][0] <= '-' ? array('ul', '[*+-]') : array('ol', '[0-9]+[.\)]'); + list($name, $pattern) = $Line['text'][0] <= '-' ? array('ul', '[*+-]') : array('ol', '[0-9]{1,9}[.\)]'); if (preg_match('/^('.$pattern.'[ ]+)(.*)/', $Line['text'], $matches)) { @@ -521,7 +521,7 @@ class Parsedown if($name === 'ol') { - $listStart = stristr($matches[1], $Block['data']['marker'], true); + $listStart = ltrim(strstr($matches[1], $Block['data']['marker'], true), '0') ?: '0'; if($listStart !== '1') {