Double newline as hard line break

I can’t stand the double space hard line break or the \ line break as a writer. I like being able to create two newlines while writing and have that create a visual separation between two bodies of text. Is this possible with Standard Markdown? I didn’t see any examples of it in the Hard Line Break section of the spec.

I think most writers outside of web culture would agree that it’s a more semantic way to write with line breaks than putting a \ or two spaces at the end of your paragraph. It doesn’t look like plain English–plain-text.

If it’s not in the spec, is there a way it can be added?

How would a double newline for a <br /> be distinguished from a double newline for separate paragraphs?

Maybe I’m misunderstanding something. Does a double newline for seperate paragraphs put space between the two paragraphs (with the second paragraph starting on a new line)? If so, then I’m pretty sure that’s what I mean.

Markdown transforms text into HTML - how that HTML is displayed is a separate matter. Example 119 shows how a double newline is turned into two HTML paragraphs - which most (all?) browsers would render as text separated by a line break.

All right, that pretty much solves the problem for me. Thanks.

which most (all?) browsers would render as text separated by a line break

This isn’t strictly accurate – the paragraphs are separated by a margin or padding, which by common default happens to be approximately the height of a line of text. There is no actual line break (<br> element), just two paragraph elements, one after the other. The resulting HTML code could look like this:

<p>This is a paragraph of text. It is pretty boring</p><p>This is a second paragraph, similarly devoid of interest.</p>

Moreover, this spacing is entirely under the control of the page’s CSS, so you can’t always expect it to be present – some sites, for example, use book-style paragraps (no spacing, but indenting the first line).

I think it’s important to remember this – Markdown is just for creating HTML; how that HTML is presented can vary widely depending on the CSS applied to it.

It’s trivial to add it to the reference renderer (the Parser already parses it as a softbreak).

That said, I would like to know why this exists in the spec in the first place (I guess only Gruber knows, maybe because his text editor doesn’t support soft wraps?) and possibly throw it out completely - newline = br, empty line = p.

1 Like

It’s in the spec because hard line wraps are common on some platforms. That behavior makes markdown look good both when rendered as HTML and as unprocessed plain text. Otherwise you end up with really ugly ragged paragraphs in HTML (with variable-width fonts).

That said, I’d like to know what the objection is to having it in the spec. In the HTML I write, I’ve only needed br very rarely, so it makes sense to me that you need to be explicit for it. Is there a common use case that I’m not remembering?

1 Like

Two common uses are lyrics/poetry, and postal addresses. For postal addresses, I don’t think it’s such a burden to explicitly mark linebreaks (with \ perhaps), but lyrics and poetry would get pretty tedious to write if you had to do that.

Maybe lyrics/poetry could be written as a special case of code?

April is the cruellest month, breeding
Lilacs out of the dead land, mixing
Memory and desire, stirring
Dull roots with spring rain.
Winter kept us warm, covering
Earth in forgetful snow, feeding
A little life with dried tubers.
Summer surprised us, coming over the Starnbergersee
With a shower of rain; we stopped in the colonnade,
And went on in sunlight, into the Hofgarten,
And drank coffee, and talked for an hour.
Bin gar keine Russin, stamm’ aus Litauen, echt deutsch.
And when we were children, staying at the archduke’s,
My cousin’s, he took me out on a sled,
And I was frightened. He said, Marie,
Marie, hold on tight. And down we went.
In the mountains, there you feel free.
I read, much of the night, and go south in the winter.

That could just produce something like

<pre class="poetry">April is the cruellest month
I read, much of the night, and go south in the winter.</pre>

In this case I think the <pre> tag is appropriate because a lot of poetry uses odd indentation etc. (The Waste Land in particular has a lot of it); there’s nothing to say <pre> content can’t be displayed in a non-monospace font though. (triple negative, woo!)

For poetry, I definitely agree that <pre> is more appropriate. I also agree that explicitly marking line breaks for addresses doesn’t seem like such a burden. That leaves song lyrics as the argument for newlines being <br/>. So which is bigger: the class of people who frequently write song lyrics in markdown or the class of people who frequently write markdown with hard line wraps?

It seems this dicussion (at least where it evolved to) is a duplicate of Default line break handling is inconvenient