diff --git a/documentation/NEXT_RELEASENOTES.txt b/documentation/NEXT_RELEASENOTES.txt index 9ef454e2..01a7d9e5 100644 --- a/documentation/NEXT_RELEASENOTES.txt +++ b/documentation/NEXT_RELEASENOTES.txt @@ -15,4 +15,5 @@ - fixed StackOverflowException when using cyclic inheritdoc (fixes #142) - fixed property getter/setter access modifier not taken into account (fixes #151) - fixed markdown special characters not escaped (fixes #117) -- fixed unhandled xml elements not rendering as is in markdown (fixes #126) \ No newline at end of file +- fixed unhandled xml elements not rendering as is in markdown (fixes #126) +- fixed issue with list rendering \ No newline at end of file diff --git a/source/DefaultDocumentation.Markdown/Elements/ListElement.cs b/source/DefaultDocumentation.Markdown/Elements/ListElement.cs index 35f6f89a..fc55e1f9 100644 --- a/source/DefaultDocumentation.Markdown/Elements/ListElement.cs +++ b/source/DefaultDocumentation.Markdown/Elements/ListElement.cs @@ -107,8 +107,6 @@ private static void WriteTable(IWriter writer, XElement element) .Append("|"); } } - - writer.EnsureLineStartAndAppendLine(); } } @@ -142,6 +140,8 @@ public void Write(IWriter writer, XElement element) WriteTable(writer, element); break; } + + writer.EnsureLineStart(); } } } diff --git a/source/DefaultDocumentation.Test/Markdown/Elements/ListElementTests/WriteShould.cs b/source/DefaultDocumentation.Test/Markdown/Elements/ListElementTests/WriteShould.cs index 584dc748..456221db 100644 --- a/source/DefaultDocumentation.Test/Markdown/Elements/ListElementTests/WriteShould.cs +++ b/source/DefaultDocumentation.Test/Markdown/Elements/ListElementTests/WriteShould.cs @@ -40,7 +40,8 @@ public void NotWriteWhenTypeIsTableAndDisplayAsSingleLine() => Test( public void WriteWhenTypeIsBullet() => Test( new XElement("list", new XAttribute("type", "bullet"), new XElement("item", "item1"), new XElement("item", "item2")), @"- item1 -- item2"); +- item2 +"); [Fact] public void WriteWhenNested() => Test( @@ -56,13 +57,14 @@ public void WriteWhenNested() => Test( - item2 1. item3 2. item4 -- item5"); +- item5 +"); [Fact] public void SeparateTermAndDescription() => Test( new XElement("list", new XAttribute("type", "bullet"), new XElement("item", new XElement("term", "Term"), new XElement("description", "Description"))), - "- Term — Description" - ); +@"- Term — Description +"); [Fact] public void NotSeparateLonelyDescriptionAndTerm() => Test( @@ -71,15 +73,16 @@ public void NotSeparateLonelyDescriptionAndTerm() => Test( new XElement("item", new XElement("description", "Description")) ), @"- Term -- Description" - ); +- Description +"); [Fact] public void WritePrefixWhenTypeIsBulletAndItemIsMultiline() => Test( new XElement("list", new XAttribute("type", "bullet"), new XElement("item", "item1\nect..."), new XElement("item", "item2")), @"- item1 ect... -- item2"); +- item2 +"); [Fact] public void WriteNewlineWhenNeededAndTypeIsBullet() => Test( @@ -87,20 +90,23 @@ public void WriteNewlineWhenNeededAndTypeIsBullet() => Test( new XElement("list", new XAttribute("type", "bullet"), new XElement("item", "item1"), new XElement("item", "item2")), @"pouet - item1 -- item2"); +- item2 +"); [Fact] public void WriteWhenTypeIsNumber() => Test( new XElement("list", new XAttribute("type", "number"), new XElement("item", "item1"), new XElement("item", "item2")), @"1. item1 -2. item2"); +2. item2 +"); [Fact] public void WritePrefixWhenTypeIsNumberAndItemIsMultiline() => Test( new XElement("list", new XAttribute("type", "number"), new XElement("item", "item1\nect..."), new XElement("item", "item2")), @"1. item1 ect... -2. item2"); +2. item2 +"); [Fact] public void WriteNewlineWhenNeededAndTypeIsNumber() => Test( @@ -108,7 +114,8 @@ public void WriteNewlineWhenNeededAndTypeIsNumber() => Test( new XElement("list", new XAttribute("type", "number"), new XElement("item", "item1"), new XElement("item", "item2")), @"pouet 1. item1 -2. item2"); +2. item2 +"); [Fact] public void WriteWhenTypeIsTable() => Test( @@ -120,7 +127,6 @@ public void WriteWhenTypeIsTable() => Test( |-|-| |item11|item12| |item21|item22| - "); [Fact] @@ -134,7 +140,6 @@ public void WritePrefixWhenTypeIsTableAndItemIsMultiline() => Test( |-|-| |item11
ect...|item12| |item21|item22| - "); [Fact] @@ -150,6 +155,5 @@ public void WriteNewlineWhenNeededAndTypeIsTable() => Test( |-|-| |item11|item12| |item21|item22| - "); }