Skip to content

Commit

Permalink
Keep trailing empty lines at the end of the Markdown code block (#672)
Browse files Browse the repository at this point in the history
Fixes #671
  • Loading branch information
AlexVanGogen authored Nov 2, 2024
1 parent e0e6f1b commit c3416e6
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ public class MarkdownProcessor(

private fun FencedCodeBlock.toMarkdownCodeBlockOrNull(): CodeBlock.FencedCodeBlock =
CodeBlock.FencedCodeBlock(
content = literal.trimEnd('\n'),
content = literal.removeSuffix("\n"),
mimeType = MimeType.Known.fromMarkdownLanguageName(info),
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7310,7 +7310,7 @@ class MarkdownProcessorDocumentParsingTest {
* </ul>
*/
parsed.assertEquals(
unorderedList(listItem(paragraph("a")), listItem(fencedCodeBlock("b")), listItem(paragraph("c")))
unorderedList(listItem(paragraph("a")), listItem(fencedCodeBlock("b\n\n")), listItem(paragraph("c")))
)
}

Expand Down

0 comments on commit c3416e6

Please sign in to comment.