fix paragraph with more then 2 newlines after

This commit is contained in:
Ruud Poutsma
2020-11-07 18:58:37 +01:00
parent b576b08332
commit 7ab34d5cef
2 changed files with 7 additions and 1 deletions

View File

@@ -198,6 +198,11 @@ namespace Markdig.Tests.RoundtripSpecs
[TestCase("\r\np\np\r\n")]
[TestCase("\r\np\rp\r\n")]
[TestCase("\r\np\r\np\r\n")]
[TestCase("p\n")]
[TestCase("p\n\n")]
[TestCase("p\n\n\n")]
[TestCase("p\n\n\n\n")]
public void TestNewline(string value)
{
RoundTrip(value);

View File

@@ -125,7 +125,8 @@ namespace Markdig.Parsers
// of the document.
if (lastBlock != null && blockProcessor.BeforeLines != null)
{
lastBlock.LinesAfter = blockProcessor.BeforeLines ?? new List<StringSlice>();
lastBlock.LinesAfter ??= new List<StringSlice>();
lastBlock.LinesAfter.AddRange(blockProcessor.BeforeLines);
}
}
break;