Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Internal space line is trimmed in converted plaintext #334

Closed
Goooler opened this issue Aug 6, 2024 · 5 comments
Closed

Internal space line is trimmed in converted plaintext #334

Goooler opened this issue Aug 6, 2024 · 5 comments

Comments

@Goooler
Copy link

Goooler commented Aug 6, 2024

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 plaintext:

this
is

note

Actual plaintext:

this
is
note

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

@Goooler Goooler added the bug label Aug 6, 2024
@boyshell
Copy link

boyshell commented Aug 6, 2024 via email

@robinst
Copy link
Collaborator

robinst commented Sep 12, 2024

The plain text renderer is not really well-defined. But this is something we might change (CC @JinneeJ). Out of interest, what are you using it for?

@Goooler
Copy link
Author

Goooler commented Sep 13, 2024

I use this to convert markdown from a rich text editor on Android.

@robinst
Copy link
Collaborator

robinst commented Sep 18, 2024

Ah this came up in #264 as well. Happy to accept a patch for this as an option on TextContentRenderer.Builder.

@robinst
Copy link
Collaborator

robinst commented Sep 24, 2024

Closing as a duplicate of #264

@robinst robinst closed this as not planned Won't fix, can't repro, duplicate, stale Sep 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants