Start a new topic

stop the markdown parser from throwing away single newlines (maybe?)

by default, markdown parsers remove single newlines; this is because it was made to format plaintext emails which are hard-wrapped

in the modern era though, people are used to twitter and discord and pretty much everything (except reddit) keeping their newlines intact, and having them ignored is unexpected and not clearly workaroundable (though admittedly the unclear workaround is listed in the guie)

how doable this is might depend on the parser, i know ruby's kramdown supports it natively in gfm mode and python-markdown has an extension

potential issues:

- i read up a bit on screen readers but i'm still not sure how accessible <br> is, plus it can make two separate lines without punctuation look like one line broken by the browser; fixing that probably belongs to a separate request, but maybe it shouldn't be encouraged?

- should it apply inside html tags? if yes then prettyprinting breaks things, if no then wrapping a div around otherwise-<br>'d markdown breaks things, so maybe only when the lines being broken don't have block-level tags?? this might actually be a lot of code after all

5 people like this idea
1 Comment

This would be great. The number of times I have clicked edit to fix the line breaks in my post is every time.

Login or Signup to post a comment