Tight lists
Closed this issue · 4 comments
Hi,
I seem to be getting paragraphs in list items regardless of blank lines in the input. Is that a known issue, or am I missing something?
The tests for tight lists were passing - can you given an example of what input is causing the problems and verify that on http://spec.commonmark.org/dingus/?
I believe I found the root cause. Since I'm using just the parser, I'm getting paragraphs inside list items regardless of the latter belonging to a tight list.
In order to correctly render tight lists one needs to suppress the creation of a paragraph whenever its parent is a list item and the parent's parent's IsTight
value is true
. I'm not sure if that's the expected behavior.
That is the expected behavior that comes from the original C reference implementation. I think that the main reason is that IsTight
can be set to false
after a large list has already been parsed (when the empty line is between the last few items) - in this case it would require the parser to revisit the whole list and add additional paragraph elements.
Indeed, that makes sense if you are looking at it from the implementor's perspective.
Although I personally ended up keeping the paragraphs, other users might not be as receptive.
Thanks