Closed leo-petrucci closed 1 year ago
My temporary fix is to create a variable outside of the function:
let olNumber = 0
Then, right before returning the list item:
olNumber += 1;
return `${spacer}${isOL ? `${olNumber}.` : "-"} ${children}${
treatAsLeaf ? "\n" : ""
}`;
And the number gets reset every time there's a new ol_list
:
case nodeTypes.ul_list:
return `${children}${BREAK_TAG}`;
case nodeTypes.ol_list:
olNumber = 0;
return `${children}${BREAK_TAG}`;
Let me know if this is a good solution and I can create a PR 👍
Technically an ordered list in Markdown doesn't need to have an incremented OL number:
https://spec.commonmark.org/dingus/?text=1.%20foo%0A1.%20bar%0A
I had absolutely no idea that was the case, sorry for the dumb issue!
I've happened upon this part of the serialiser:
If the list is ordered it will always start any items with .1:
This seems intentional but I can't figure out why. Any idea on how I could count the actual number?