Improve markdown paragraph handling

According to the commonmark’s spec

Paragraph
A line ending is a newline (U+000A), a carriage return (U+000D) not followed by a newline, or a carriage return and a following newline.

Or Github Flavored Markdown spec

Paragraph
A sequence of non-blank lines that cannot be interpreted as other kinds of blocks forms a paragraph. The contents of the paragraph are the result of parsing the paragraph’s raw content as inlines. The paragraph’s raw content is formed by concatenating the lines and removing initial and final whitespace.

So,

Foo
bar

Should render as

Foo bar

But instead it renders as

Foo
bar

See the commonmark example or the Gihub’s one.

Is this a bug or intended diversion from the spec?

Use-case

This way of paragraph handling becomes particularly annoying when the some users reply by email, where many email clients (like thunderbird) create line breaks every so characters. Though from the design perspective, email users shouldn’t have to think about this nor change their email settings.

Here’s an example:

The only other situation I can think of where this would also happen is when new users start using discourse, sometimes they make make manual paragraphs this way.

3 Likes

This is intentional, and follows the same behaviour as GitHub:

Admins can enable the “traditional markdown linebreaks” setting in the site settings to change the behaviour.

You may be interested in this topic which describes some of the rationale behind the implementation.

5 Likes

Thanks a lot. I’ll read up on that

4 Likes