Markdown: hardwraps on [return] or not?
From a user perspective I think it is better to have hard wraps enabled, i.e. a new line in
WikiTextwill be translated to a
Line one Line two Par two
output (hard wraps enabled)
<p>Line one <br>Line two</p> <p>Par two</p>
output (hard wraps disabled)
<p>Line one Line two</p> <p>Par two</p>
This is how it’s done using pegdown in revision r5693 and onwards.
Before r5693, new lines did not get transformed to
<br>-tags, except when the preceding line was appended with 2 white spaces. 2 adjacent new lines were translated to a new paragraph.
I’m not yet convinced that “ignoring single new lines” makes things better. With hardwraps disabled (before r5693) I often had to edit and re-edit wiki texts to get the new lines where I wanted them. Also, when inserting code/stacktrace not wrapped in a code block, markdown with hardwraps enabled will just display it nicely.
Github about newlines:
The biggest difference that Github Flavored Markdown introduces is in the handling of linebreaks. With Standard Markdown you can hard wrap paragraphs of text and they will be combined into a single paragraph. We find this to be the cause of a huge number of unintentional formatting errors. GFM treats newlines in paragraph-like content as real line breaks, which is probably what you intended.
Hardwraps or not, what do you prefer and why?Asked by Elmer van Chastelet on 13 June 2013 at 11:12
Enabled. Reason - WYSIWYG. Not enabling means having to keep a mental picture of how the text is going to display. I’ll frequently want to put in a break because it needs to be there in the output. I’m far less likely to put in one because it’s convenient in the input - but not required in the output.Answered by Scott Finnie on 13 June 2013 at 12:37
Both John Gruber (designer of Markdown) and Jeff Atwood (Stackoverflow founder) seem to agree that hard wraps are a better default for general usage.
“For use in situations like user-submitted comments, GitHub Flavored Markdown is a superior variant. It changes just three rules from regular Markdown, all of which make for a better set of formatting rules for people who don’t even know the rules.”
“Make the three most common real world usage “gotchas” in Markdown choices with saner defaults: intra-word emphasis (off), auto-hyperlinking (on), automatic return-based linebreaks (on).”
While enabled hard wraps is also my personal preference, there are cases when disabling the hard wraps is more desirable (e.g. copying a paper abstract with unwanted line breaks into researchr). We will be adding the possibility to configure these options in WebDSL.Answered by Danny Groenewegen on 5 December 2013 at 16:00