fix: correct ordered list start number rendering (#457)

This commit is contained in:
dribble-njr 2024-12-08 08:56:17 +08:00 committed by GitHub
parent c52593ba50
commit 1e887fe87e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -193,11 +193,11 @@ export function initRenderer(opts: IOpts) {
return styledContent(`listitem`, `${prefix}${content}`, `li`) return styledContent(`listitem`, `${prefix}${content}`, `li`)
}, },
list({ ordered, items }: Tokens.List): string { list({ ordered, items, start = 1 }: Tokens.List): string {
const listItems = [] const listItems = []
for (let i = 0; i < items.length; i++) { for (let i = 0; i < items.length; i++) {
isOrdered = ordered isOrdered = ordered
listIndex = i listIndex = Number(start) + i - 1
const item = items[i] const item = items[i]
listItems.push(this.listitem(item)) listItems.push(this.listitem(item))
} }