Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Should markdown preserve newlines in blockquotes?

Tags:

markdown

I'm currently working on a user complaint, and I can't figure out whether the complaint is an actual bug or not. Basically, the user says there is a problem with the website because blockquotes do not preserve his new lines. This sounds reasonable, but on every markdown tester I've tried online, blockquotes are rendered the same as mine. For example:

hi what's up? this is my multiline blockquote.

Even though I type this as a multiline quote, the newlines are still lost in rendering (even on StackOverflow). So I guess my real question is two-fold:

  1. I'm 99% sure by this point that blockquotes should not preserve newlines, but I'd still like to see if there are differing opinions just in case. Do any of you think they should preserve them?

  2. If they shouldn't preserve them, is the proper way to have your new lines preserved in markdown simply by using pre and code?

like image 986
Eli Avatar asked Aug 23 '11 21:08

Eli


People also ask

How do you create a line break in markdown?

To create a line break or new line ( <br> ), end a line with two or more spaces, and then type return. This is the first line.

How do you insert a line space in markdown?

For an empty line in Markdown, escape a space ( \ ), and then add a new line. Remember: escape a space and escape a new line. That way is Markdown compliant and should compile properly in any compiler.


2 Answers

The original markdown 'specs' are highly ambiguous and not maintained. There is of course the perl script markdown.pl, the 'reference implementation', though it has many familiar oddities.

You might join the list http://six.pairlist.net/pipermail/markdown-discuss/ which is forever complaining about the contradictory situation the matter is in due to Gruber's corruption. Perhaps the list users will have the sense to take the matter into their own hands, though the subtle differences between the different implementation and the not-so-subtle differences between the different extensions make this unlikely, or anyway difficult. -Especially so long as Gruber does not renounce all rights in the matter but at the same time advances no specification. If a committee formed, it would not be able to speak of any specification as a specification of Markdown.

In principle it is clear that block quotes are governed by the same principles as non-block quotes - for example you can have block quotes in block quotes -- so you friend is certainly wrong. You can prove this to your user by running markdown.pl on his or her text. Any other principle would be total confusion. Note this,

the rule for making a line-break
with extra spaces at the end of the line

is totally clear
whether inside

or outside
block quotes, so you might explain it to him or her.

Note that the stackoverflow markdown parser is good here (I noticed something wrong with the way you exit a nested block quote to return to the main block quote, though.) But the author of the css quite wrongly made the space between a block quote and the surrounding text greater than that between paragraphs. This is nonsense where paragraph breaks are communicated by extra space. A block quote is part of the paragraph, indeed typically of a sentence. It is akin to a very long single word, like any other quotation you use in writing.)

Note that what is in the cute, cloying jargon calling itself "GitHub™ flavored markdown" treats all newlines - outside code blocks etc. - as paragraph breaks, a decision which basically makes the idea of markdown non-existent. It may be your user is familiar with some such thing - though at least it doesn't break the rule that what holds in the block quote is what holds outside it. GitHub Inc. has ... uh ... 'convinced' Gruber that this is a legitimate markdown 'for their use case'. The ground for this was that untutored people might naturally think that a newline makes a paragraph break. Gruber was presumably aware that GitHub™'s user-base is constituted by programmers so this shows how much worth the idea of a specification or standard has for him. Of course it has produced total chaos for complex documentation on GitHub. (Why shouldn't there be "legitimate html for Internet Explorer's use case"; a lot of people just test stuff in IE, so they have certain legitimate expectations? Of course, GitHub's decision is much worse than anything like that would be.)

I haven't thought about this for a while so these remarks might not be up to date, but I doubt things have changed since I decided not to think about it. That there is and will be no specification shows that each minute you devote to thinking about the matter is wasted human energy. Markdown has engendered quite a bit of that by now, thanks to Gruber's meretriciousness.

like image 148
applicative Avatar answered Oct 07 '22 02:10

applicative


add <br> to where you want to have a line break in your quote block.

normally, appending 2 spaces should do the same thing, but most ide will trim the trailing spaces, which is actually a good behavior!

> hi what's up?<br>this is my multiline blockquote.

hi what's up?
this is my multiline blockquote.

like image 38
Izana Avatar answered Oct 07 '22 02:10

Izana