RoundtripRenderer looses list content
hi,
i've an issue when using the RoundtripRenderer. When this document gets parsed and rendered back to md (doing this for cleanup), the first list element is missing:
here is some sample code:
var md = @"1. 1.
2. 2.
3. 3.
- 1.
- 2.
";
var parsed = Markdown.Parse(md, true);
var w = new StringWriter();
var r = new RoundtripRenderer(w);
r.Render(parsed);
w.Flush();
var md2 = w.ToString();
Console.WriteLine(md2);
md and md2 should be equal, but md2 is missing the 1. after the first dash -.
so this:
1. 1.
2. 2.
3. 3.
- 1.
- 2.
is after the rpundtrip this:
1. 1.
2. 2.
3. 3.
-
- 2.
according to commonmark reference implementation this should work: https://spec.commonmark.org/dingus/
is this a bug or is there a way to workaround this? i'm a little stuck here.
any help would be much appreciated! thank you! greetings
Probably a bug in the roundtrip renderer for ordered lists. Compare the ordered part https://github.com/xoofx/markdig/blob/682c727288defba5dfab05ccb4ef847c760d412c/src/Markdig/Renderers/Roundtrip/ListRenderer.cs#L30-L32 vs unordered https://github.com/xoofx/markdig/blob/682c727288defba5dfab05ccb4ef847c760d412c/src/Markdig/Renderers/Roundtrip/ListRenderer.cs#L47-L58
The former is probably missing the handling for 0 blocks & the pop indent.
great - thanks for pointing that out - i'll have a look next week and try to create a PR