IonicaBizau/medium-editor-markdown

Problem with line breaks

Opened this issue · 0 comments

Hello

There is a problem with line breaks (<br>), "classic" markdown handle those in a strange way, it ignores single line breaks in the source unless they are preceded by (at least) two spaces.
See https://daringfireball.net/projects/markdown/syntax#p (and also commonmark http://spec.commonmark.org/0.28/#hard-line-breaks)

Medium-editor supports <br> (with Shift-Return), and turndown properly convert them to two spaces followed by one \n, but the plugin trim the whitespaces at the end of lines before giving the result to the callback, so if we convert back the markdown to HTML the line break is lost.

I think the trimming (the split/join) should be completely removed, or at least made smarter and keep at least two spaces if they are followed by a single line break. (or maybe optional, as suggested in a previous issue?)