Markdown 是否应该在块引用中保留换行符?
我目前正在处理用户投诉,但我无法确定该投诉是否是真正的错误。基本上,用户说网站有问题,因为块引用不保留他的新行。这听起来很合理,但是在我在线尝试过的每个 Markdown 测试器上,块引用的呈现方式与我的相同。例如:
> hi
> what's up?
> this is my multiline blockquote.
嗨 这是怎么回事? 这是我的多行块引用。
即使我将其输入为多行引号,换行符仍然会在渲染中丢失(即使在 StackOverflow 上)。所以我想我真正的问题有两个:
到目前为止,我 99% 确定块引用不应该保留换行符,但我仍然想看看是否有不同的意见,以防万一。你们中有人认为他们应该保留它们吗?
如果他们不应该保留它们,那么简单地使用 pre 和代码将新行保留在 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.
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:
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?
If they shouldn't preserve them, is the proper way to have your new lines preserved in markdown simply by using pre and code?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
原始的降价“规范”非常模糊并且没有得到维护。当然还有 Perl 脚本
markdown.pl
,即“参考实现”,尽管它有许多熟悉的奇怪之处。您可以加入列表 http://six.pairlist.net/pipermail/markdown-discuss/ 这是永远抱怨格鲁伯的腐败导致事情陷入矛盾的境地。也许列表用户会有意识将问题掌握在自己手中,尽管不同实现之间的细微差异以及不同扩展之间不那么细微的差异使得这不太可能,或者无论如何都是困难的。 -特别是只要格鲁伯不放弃此事的所有权利,但同时不提出任何规范。如果成立了一个委员会,它将无法将任何规范视为 Markdown 规范。
原则上,很明显,块引用与非块引用遵循相同的原则 - 例如,您可以在块引用中包含块引用 - 所以你的朋友肯定是错的。您可以通过在用户的文本上运行
markdown.pl
向用户证明这一点。任何其他原则都会完全混乱。请注意这一点,请注意,stackoverflow markdown 解析器在这里很好(不过,我注意到退出嵌套块引用返回主块引用的方式有问题。)但是 css 的作者非常错误地在块引用和周围的文字大于段落之间的文字。这是无意义的,段落分隔符是通过额外的空格来传达的。块引用是段落的一部分,实际上通常是句子。它类似于一个非常长的单个单词,就像您在写作中使用的任何其他引用一样。)
请注意,自称“GitHub™ 风格的 markdown”的可爱而令人厌烦的行话中的内容会处理所有换行符 - 外部代码块等 - 作为段落中断,这一决定基本上使降价的想法不存在。您的用户可能熟悉这样的事情 - 尽管至少它没有违反块引用中包含的内容就是其外部包含的内容的规则。 GitHub Inc. 已经……呃……“说服”格鲁伯,这是“针对他们的用例”的合法降价。这样做的理由是,未经训练的人可能会自然地认为换行符会导致段落中断。 Gruber 大概意识到 GitHub™ 的用户群是由程序员构成的,因此这表明规范或标准的想法对他来说有多么有价值。当然,这给 GitHub 上的复杂文档带来了彻底的混乱。 (为什么不应该有“Internet Explorer 用例的合法 html”;很多人只是在 IE 中测试东西,所以他们有一定的合法期望?当然,GitHub 的决定比类似的事情要糟糕得多。)
我已经有一段时间没有考虑这个问题了,所以这些言论可能不是最新的,但我怀疑自从我决定不考虑它以来事情已经发生了变化。没有、也不会有规范表明,你花在思考这个问题上的每一分钟都是在浪费人类的精力。多亏了格鲁伯的夸夸其谈,Markdown 已经产生了相当多的这样的东西。
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,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.
将
添加到引用块中想要换行的位置。通常,附加 2 个空格应该做同样的事情,但大多数 ide 会修剪尾随空格,这实际上是一个很好的行为!
<代码>>嗨,怎么了?
这是我的多行块引用。
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.