@@ -99,13 +99,15 @@ private async Task<Document> CreateChangedDocument(CodeFixContext context, Docum
9999 }
100100
101101 if ( newContent . Count > 0 )
102- newContent = newContent . Add ( XmlSyntaxFactory . NewLine ( ) ) ;
102+ newContent = newContent . Add ( XmlSyntaxFactory . NewLine ( ) . WithTrailingTrivia ( SyntaxFactory . DocumentationCommentExterior ( "///" ) ) ) ;
103103
104104 newContent = newContent . Add ( XmlSyntaxFactory . Text ( line . TrimEnd ( ) , true ) ) ;
105105 }
106106
107- contentsOnly = contentsOnly
108- . WithContent ( newContent )
107+ contentsOnly = contentsOnly . WithContent ( newContent ) ;
108+ contentsOnly =
109+ contentsOnly
110+ . ReplaceExteriorTrivia ( leadingTrivia )
109111 . WithLeadingTrivia ( SyntaxFactory . DocumentationCommentExterior ( "///" ) )
110112 . WithTrailingTrivia ( SyntaxFactory . EndOfLine ( Environment . NewLine ) ) ;
111113
@@ -116,11 +118,6 @@ private async Task<Document> CreateChangedDocument(CodeFixContext context, Docum
116118 if ( contentsOnly == null )
117119 return context . Document ;
118120
119- contentsOnly =
120- contentsOnly
121- . ReplaceExteriorTrivia ( leadingTrivia )
122- . WithLeadingTrivia ( SyntaxFactory . DocumentationCommentExterior ( "///" ) ) ;
123-
124121 // Remove unnecessary nested paragraph elements
125122 contentsOnly = contentsOnly . ReplaceNodes ( contentsOnly . DescendantNodes ( ) . OfType < XmlElementSyntax > ( ) , RemoveNestedParagraphs ) ;
126123
@@ -193,8 +190,9 @@ private SyntaxNode RenderBlockElementAsMarkdown(SyntaxNode originalNode, SyntaxN
193190 return elementSyntax . WithContent (
194191 XmlSyntaxFactory . List (
195192 XmlSyntaxFactory . NewLine ( ) . WithoutTrailingTrivia ( ) ,
196- XmlSyntaxFactory . Text ( rendered , true ) ,
197- XmlSyntaxFactory . NewLine ( ) . WithoutTrailingTrivia ( ) ) ) ;
193+ XmlSyntaxFactory . Text ( " " + rendered . Replace ( "\n " , "\n " ) , true ) ,
194+ XmlSyntaxFactory . NewLine ( ) . WithoutTrailingTrivia ( ) ,
195+ XmlSyntaxFactory . Text ( " " ) ) ) ;
198196 }
199197
200198 private string RenderAsMarkdown ( string text )
0 commit comments