question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

  • Markwon version: 4.1.0

While setting text that has newline(s) via Markwon to EditText, I have found some issues atm.

  • A single newline doesn’t show up.
Markwon markwon = Markwon.builder(context)
                    .usePlugin(CorePlugin.create())
                    .usePlugin(LinkifyPlugin.create())
                    .build();
markwon.setMarkdown(myEditText, "Test\ntest");

image

  • newlines work and more than 2 newlines is ignored)
markwon.setMarkdown(myEditText, "Test\n\n\n\n\ntest");

image

If setText the strings without markwon, no issues.

It would be great to resolve the issue asap.

Thank you.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

4reactions
gbhaumikkumar14commented, May 2, 2020

@hello @gbhaumikkumar14,

this works as expected according to the commonmark spec. There are 2 kinds of line breaks - soft and hard. A soft break is a single new line character. By default it is rendered as a space. If you wish to render a new line instead of the space - use SoftBreakAddsNewLinePlugin:

final Markwon markwon = Markwon.builder(this)
        .usePlugin(SoftBreakAddsNewLinePlugin.create())
        .build();

Works like a charm @noties thanks Your library is making life easier.

4reactions
notiescommented, May 2, 2020

@Hello @gbhaumikkumar14,

this works as expected according to the commonmark spec. There are 2 kinds of line breaks - soft and hard. A soft break is a single new line character. By default it is rendered as a space. If you wish to render a new line instead of the space - use SoftBreakAddsNewLinePlugin:

final Markwon markwon = Markwon.builder(this)
        .usePlugin(SoftBreakAddsNewLinePlugin.create())
        .build();
Read more comments on GitHub >

github_iconTop Results From Across the Web

The Dos and Don'ts of Adding an HTML Line Break
In HTML, the <br> element creates a line break. You can add it wherever you want text to end on the current line...
Read more >
Newline - Wikipedia
Newline (frequently called line ending, end of line (EOL), next line (NEL) or line break) is a control character or sequence of control...
Read more >
Line break in HTML with '\n' - Stack Overflow
The <br> HTML element produces a line break in text (carriage-return). It is useful for writing a poem or an address, where the...
Read more >
<br>: The Line Break element - HTML - MDN Web Docs - Mozilla
The HTML element produces a line break in text (carriage-return). It is useful for writing a poem or an address, where the division...
Read more >
EOL or End of Line or newline ascii character
It is a character in a string which represents a line break, which means that after this character, a new line will start....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found