@@ -99,13 +99,14 @@ 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 = DocumentValueFromSummaryCodeFix
109+ . ReplaceExteriorTrivia ( contentsOnly , leadingTrivia )
109110 . WithLeadingTrivia ( SyntaxFactory . DocumentationCommentExterior ( "///" ) )
110111 . WithTrailingTrivia ( SyntaxFactory . EndOfLine ( Environment . NewLine ) ) ;
111112
@@ -116,10 +117,6 @@ private async Task<Document> CreateChangedDocument(CodeFixContext context, Docum
116117 if ( contentsOnly == null )
117118 return context . Document ;
118119
119- contentsOnly = DocumentValueFromSummaryCodeFix
120- . ReplaceExteriorTrivia ( contentsOnly , leadingTrivia )
121- . WithLeadingTrivia ( SyntaxFactory . DocumentationCommentExterior ( "///" ) ) ;
122-
123120 // Remove unnecessary nested paragraph elements
124121 contentsOnly = contentsOnly . ReplaceNodes ( contentsOnly . DescendantNodes ( ) . OfType < XmlElementSyntax > ( ) , RemoveNestedParagraphs ) ;
125122
@@ -192,8 +189,9 @@ private SyntaxNode RenderBlockElementAsMarkdown(SyntaxNode originalNode, SyntaxN
192189 return elementSyntax . WithContent (
193190 XmlSyntaxFactory . List (
194191 XmlSyntaxFactory . NewLine ( ) . WithoutTrailingTrivia ( ) ,
195- XmlSyntaxFactory . Text ( rendered , true ) ,
196- XmlSyntaxFactory . NewLine ( ) . WithoutTrailingTrivia ( ) ) ) ;
192+ XmlSyntaxFactory . Text ( " " + rendered . Replace ( "\n " , "\n " ) , true ) ,
193+ XmlSyntaxFactory . NewLine ( ) . WithoutTrailingTrivia ( ) ,
194+ XmlSyntaxFactory . Text ( " " ) ) ) ;
197195 }
198196
199197 private string RenderAsMarkdown ( string text )
0 commit comments