commonmark-java icon indicating copy to clipboard operation
commonmark-java copied to clipboard

Internal space line is trimmed in converted plaintext

Open Goooler opened this issue 6 months ago • 1 comments

Convert markdown to plaintext using:

private fun convertMarkdownToPlaintext(markdown: String): String {
    val parser = Parser.builder().build()
    val document = parser.parse(markdown)
    val renderer = TextContentRenderer.builder().build()
    return renderer.render(document)
}

Example:

this
is 

**note**

Expected behavior:

Expected plaintext:

this
is

note

Actual plaintext:

this
is
note

(Also see what the reference implementation does: https://spec.commonmark.org/dingus/)

Goooler avatar Aug 06 '24 10:08 Goooler