Browse Source

Bring ordered list markers up to spec

pull/135/head
Alex Kocharin 10 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. // or -1 on fail.
function skipOrderedListMarker(state, startLine) { function skipOrderedListMarker(state, startLine) {
var ch, var ch,
pos = state.bMarks[startLine] + state.tShift[startLine], start = state.bMarks[startLine] + state.tShift[startLine],
pos = start,
max = state.eMarks[startLine]; max = state.eMarks[startLine];
// List marker should have at least 2 chars (digit + dot) // List marker should have at least 2 chars (digit + dot)
@ -48,6 +49,11 @@ function skipOrderedListMarker(state, startLine) {
ch = state.src.charCodeAt(pos++); ch = state.src.charCodeAt(pos++);
if (ch >= 0x30/* 0 */ && ch <= 0x39/* 9 */) { 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; continue;
} }

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

@ -108,19 +108,6 @@ test
</code></pre> </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. Coverage. Directive can terminate paragraph.
. .

Loading…
Cancel
Save