diff --git a/src/Markdig/Parsers/ListBlockParser.cs b/src/Markdig/Parsers/ListBlockParser.cs index 566f3b3d..30435d82 100644 --- a/src/Markdig/Parsers/ListBlockParser.cs +++ b/src/Markdig/Parsers/ListBlockParser.cs @@ -131,7 +131,9 @@ namespace Markdig.Parsers if (!(state.NextContinue is ListBlock)) { list.CountAllBlankLines++; - listItem.Add(new BlankLineBlock()); + //listItem.Add(new BlankLineBlock()); + //state.BeforeLines ??= new List(); + //state.BeforeLines.Add(state.Line); } list.CountBlankLinesReset++; } @@ -312,48 +314,49 @@ namespace Markdig.Parsers public override bool Close(BlockProcessor processor, Block blockToClose) { - // Process only if we have blank lines - if (blockToClose is ListBlock listBlock && listBlock.CountAllBlankLines > 0) - { - if (listBlock.Parent is ListItemBlock parentListItemBlock && - listBlock.LastChild is ListItemBlock lastListItem && - lastListItem.LastChild is BlankLineBlock) - { - // Inform the outer list that we have a blank line - var parentList = (ListBlock)parentListItemBlock.Parent; - - parentList.CountAllBlankLines++; - parentListItemBlock.Add(new BlankLineBlock()); - } - - for (int listIndex = listBlock.Count - 1; listIndex >= 0; listIndex--) - { - var listItem = (ListItemBlock)listBlock[listIndex]; - - for (int i = listItem.Count - 1; i >= 0; i--) - { - if (listItem[i] is BlankLineBlock) - { - if (i == listItem.Count - 1 ? listIndex < listBlock.Count - 1 : i > 0) - { - listBlock.IsLoose = true; - } - - listItem.RemoveAt(i); - - // If we have removed all blank lines, we can exit - listBlock.CountAllBlankLines--; - if (listBlock.CountAllBlankLines == 0) - { - goto done; - } - } - } - } - } - - done: return true; + // // Process only if we have blank lines + // if (blockToClose is ListBlock listBlock && listBlock.CountAllBlankLines > 0) + // { + // if (listBlock.Parent is ListItemBlock parentListItemBlock && + // listBlock.LastChild is ListItemBlock lastListItem && + // lastListItem.LastChild is BlankLineBlock) + // { + // // Inform the outer list that we have a blank line + // var parentList = (ListBlock)parentListItemBlock.Parent; + + // parentList.CountAllBlankLines++; + // parentListItemBlock.Add(new BlankLineBlock()); + // } + + // for (int listIndex = listBlock.Count - 1; listIndex >= 0; listIndex--) + // { + // var listItem = (ListItemBlock)listBlock[listIndex]; + + // for (int i = listItem.Count - 1; i >= 0; i--) + // { + // if (listItem[i] is BlankLineBlock) + // { + // if (i == listItem.Count - 1 ? listIndex < listBlock.Count - 1 : i > 0) + // { + // listBlock.IsLoose = true; + // } + + // //listItem.RemoveAt(i); + + // // If we have removed all blank lines, we can exit + // //listBlock.CountAllBlankLines--; + // //if (listBlock.CountAllBlankLines == 0) + // //{ + // // goto done; + // //} + // } + // } + // } + // } + + //done: + // return true; } } } \ No newline at end of file diff --git a/src/Markdig/Renderers/Normalize/ListRenderer.cs b/src/Markdig/Renderers/Normalize/ListRenderer.cs index 45b6d0c4..a2ac2974 100644 --- a/src/Markdig/Renderers/Normalize/ListRenderer.cs +++ b/src/Markdig/Renderers/Normalize/ListRenderer.cs @@ -91,11 +91,11 @@ namespace Markdig.Renderers.Normalize } renderer.CompactParagraph = compact; - // TODO: make reusable method? - if (listBlock.Parent is MarkdownDocument md && md.LastChild != listBlock) - { - renderer.WriteLine(); - } + //// TODO: make reusable method? + //if (listBlock.Parent is MarkdownDocument md && md.LastChild != listBlock) + //{ + // renderer.WriteLine(); + //} renderer.RenderLinesAfter(listBlock); } diff --git a/src/Markdig/Renderers/Normalize/NormalizeRenderer.cs b/src/Markdig/Renderers/Normalize/NormalizeRenderer.cs index b83a4fa9..d5e40d07 100644 --- a/src/Markdig/Renderers/Normalize/NormalizeRenderer.cs +++ b/src/Markdig/Renderers/Normalize/NormalizeRenderer.cs @@ -54,7 +54,7 @@ namespace Markdig.Renderers.Normalize { if (!IsLastInContainer) { - WriteLine(); + WriteLine(); // TODO: remove this method? } }