Closed kevinbackhouse closed 1 year ago
@kevinbackhouse, for what it's worth this passes our internal test suite. I am not a huge fan of how list numbers are calculated in the main render loop, and not at parse time, but I think that can be improved in future PRs.
Fixes: #321
This adds some code to
cmark_render()
to calculate the correct list item index and store it on the node, so that output formats like commonmark don't have to calculate it themselves.Nodes of type
CMARK_NODE_ITEM
store the same kind of data asCMARK_NODE_LIST
, as can be seen here:https://github.com/github/cmark-gfm/blob/c4de25253b4621bef631fef3092c7d2ebd601830/src/blocks.c#L1371-L1376
So I decided to use the
start
field to store the index.