summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEmanuil Rusev <hello@erusev.com>2016-10-05 22:55:34 +0300
committerGitHub <noreply@github.com>2016-10-05 22:55:34 +0300
commitf4e0234af02152f6b3624849e425d41b595eb490 (patch)
tree4f6e73eb5642a26d68d65c04094f281559aded43
parenta2ed1592bd064cf90661c266f7e89ea88c06b1db (diff)
parent5c22531e4dc535077e6dce163fbfc5389feddeab (diff)
downloadparsedown-f4e0234af02152f6b3624849e425d41b595eb490.zip
parsedown-f4e0234af02152f6b3624849e425d41b595eb490.tar.gz
parsedown-f4e0234af02152f6b3624849e425d41b595eb490.tar.bz2
Merge pull request #431 from aidantwoods/patch-2
Allow parsedown to specify list start attribute
-rw-r--r--Parsedown.php10
-rw-r--r--test/data/ordered_list.html2
2 files changed, 11 insertions, 1 deletions
diff --git a/Parsedown.php b/Parsedown.php
index 646af86..4737eee 100644
--- a/Parsedown.php
+++ b/Parsedown.php
@@ -515,6 +515,16 @@ class Parsedown
),
);
+ if($name === 'ol')
+ {
+ $listStart = stristr($matches[0], '.', true);
+
+ if($listStart !== '1')
+ {
+ $Block['element']['attributes'] = array('start' => $listStart);
+ }
+ }
+
$Block['li'] = array(
'name' => 'li',
'handler' => 'li',
diff --git a/test/data/ordered_list.html b/test/data/ordered_list.html
index b6c5216..c4a69db 100644
--- a/test/data/ordered_list.html
+++ b/test/data/ordered_list.html
@@ -8,6 +8,6 @@
<li>two</li>
</ol>
<p>large numbers:</p>
-<ol>
+<ol start="123">
<li>one</li>
</ol> \ No newline at end of file