pkg/md/fmt.go: Stop incrementing ordered list item's number at 9 9's.

This commit is contained in:
Qi Xiao 2022-11-05 00:39:24 +00:00
parent 8c0e2e17da
commit a0d308d23c
2 changed files with 8 additions and 1 deletions

View File

@ -212,7 +212,12 @@ func (c *FmtCodec) Do(op Op) {
}
ct := c.containers.peek()
ct.marker = ""
ct.number++
// If the current number is 9 9's, incrementing it will make the number
// 10 digits; CommonMark requires the number in the ordered list to be
// at most 9 digits. So just stop incrementing at this number.
if ct.number < 999999999 {
ct.number++
}
case OpBulletListStart:
c.containers.push(&fmtContainer{
typ: fmtBulletItem,

View File

@ -0,0 +1,2 @@
go test fuzz v1
string("999999990)\n0)\n0)\n0)\n0)\n0)\n0)\n0)\n0)\n0)\n0)")