Browse Source

Bring ordered list markers up to spec

pull/135/head
Alex Kocharin 9 years ago
parent
commit
909f79e62e
  1. 8
      lib/rules_block/list.js
  2. 13
      test/fixtures/markdown-it/commonmark_extras.txt

8
lib/rules_block/list.js

@ -31,7 +31,8 @@ function skipBulletListMarker(state, startLine) {
// or -1 on fail.
function skipOrderedListMarker(state, startLine) {
var ch,
pos = state.bMarks[startLine] + state.tShift[startLine],
start = state.bMarks[startLine] + state.tShift[startLine],
pos = start,
max = state.eMarks[startLine];
// List marker should have at least 2 chars (digit + dot)
@ -48,6 +49,11 @@ function skipOrderedListMarker(state, startLine) {
ch = state.src.charCodeAt(pos++);
if (ch >= 0x30/* 0 */ && ch <= 0x39/* 9 */) {
// List marker should have no more than 9 digits
// (prevents integer overflow in browsers)
if (pos - start >= 10) { return -1; }
continue;
}

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

@ -108,19 +108,6 @@ 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