Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions block.go
Original file line number Diff line number Diff line change
Expand Up @@ -1051,8 +1051,8 @@ func (p *parser) oliPrefix(data []byte) int {
i++
}

// we need >= 1 digits followed by a dot and a space
if start == i || data[i] != '.' || data[i+1] != ' ' {
// we need 1,2 or 3 digits followed by a dot and a space
if start == i || start < i-3 || data[i] != '.' || data[i+1] != ' ' {
return 0
}
return i + 2
Expand Down
9 changes: 9 additions & 0 deletions block_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -836,6 +836,15 @@ func TestOrderedList(t *testing.T) {
"* Start with unordered\n 1. Ordered\n",
"<ul>\n<li>Start with unordered\n\n<ol>\n<li>Ordered</li>\n</ol></li>\n</ul>\n",

"random numbers:\n\n 3. Bird\n 1. McHale\n 8. Parish",
"<p>random numbers:</p>\n\n<ol>\n<li>Bird</li>\n<li>McHale</li>\n<li>Parish</li>\n</ol>\n",

"big numbers should be skipped:\n\n 3. Bird\n 1. McHale\n 8. Parish\n\n 999. last element",
"<p>big numbers should be skipped:</p>\n\n<ol>\n<li>Bird</li>\n<li>McHale</li>\n\n<li><p>Parish</p></li>\n\n<li><p>last element</p></li>\n</ol>\n",

"big numbers should be skipped:\n\n 3. Bird\n 1. McHale\n 8. Parish\n\n 2019. is the actual year",
"<p>big numbers should be skipped:</p>\n\n<ol>\n<li>Bird</li>\n<li>McHale</li>\n<li>Parish</li>\n</ol>\n\n<p>2019. is the actual year</p>\n",

"1. numbers\n1. are ignored\n",
"<ol>\n<li>numbers</li>\n<li>are ignored</li>\n</ol>\n",

Expand Down