From 2772b034c622e469684da29c7f36c51b8b6be7b0 Mon Sep 17 00:00:00 2001 From: Aidan Woods Date: Tue, 27 Sep 2016 00:53:51 +0100 Subject: [PATCH] Update Parsedown.php (I think this should work) Allow parsedown to specify list start attribute (see: https://github.com/erusev/parsedown/issues/100#issuecomment-249729602) --- Parsedown.php | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/Parsedown.php b/Parsedown.php index 646af86..f0efdc5 100644 --- a/Parsedown.php +++ b/Parsedown.php @@ -502,10 +502,10 @@ 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]+)[.]'); if (preg_match('/^('.$pattern.'[ ]+)(.*)/', $Line['text'], $matches)) { + if($name === 'ol' && $matches[2] !== '1') $name. = ' start="' . $matches[2] . '"'; $Block = array( 'indent' => $Line['indent'], 'pattern' => $pattern, @@ -514,17 +514,14 @@ class Parsedown 'handler' => 'elements', ), ); - $Block['li'] = array( 'name' => 'li', 'handler' => 'li', 'text' => array( - $matches[2], + $matches[3], ), ); - $Block['element']['text'] []= & $Block['li']; - return $Block; } } @@ -1419,7 +1416,7 @@ class Parsedown $markup .= $Element['text']; } - $markup .= ''; + $markup .= ''; } else {