Browse Source

Allow numbered lists starting from zero

Fixes: https://github.com/markdown-it/markdown-it/issues/129
pull/135/head
Alex Kocharin 9 years ago
parent
commit
954e156848
  1. 2
      lib/rules_block/list.js
  2. 13
      test/fixtures/markdown-it/commonmark_extras.txt

2
lib/rules_block/list.js

@ -128,7 +128,7 @@ module.exports = function list(state, startLine, endLine, silent) {
markerValue = Number(state.src.substr(start, posAfterMarker - start - 1));
token = state.push('ordered_list_open', 'ol', 1);
if (markerValue > 1) {
if (markerValue !== 1) {
token.attrs = [ [ 'start', markerValue ] ];
}

13
test/fixtures/markdown-it/commonmark_extras.txt

@ -108,6 +108,19 @@ test
</code></pre>
.
List starting with zero:
.
0. foo
1. bar
2. baz
.
<ol start="0">
<li>foo</li>
<li>bar</li>
<li>baz</li>
</ol>
.
Coverage. Directive can terminate paragraph.
.

Loading…
Cancel
Save