2 ms·
? Specifically, what people actually complain about are the <pre> blocks, not the <code> tags. Markdown code sections use both: https://daringfireball.net/proj
by sbierwagen 8y ago
?
Specifically, what people actually complain about are the <pre> blocks, not the <code> tags. Markdown code sections use both: https://daringfireball.net/projects/markdown/syntax#precode https://daringfireball.net/projects/markdown/syntax#precode
>Pre-formatted code blocks are used for writing about programming or markup source code. Rather than forming normal paragraphs, the lines of a code block are interpreted literally. Markdown wraps a code block in both <pre> and <code> tags.
Presumably, <code> to indicate that it's code, and <pre> to preserve source formatting, since HTML renderers will eat tabs, spaces and newlines. This has been the behavior of <pre> since at least 1997: https://www.w3.org/MarkUp/html3/literal.html https://www.w3.org/MarkUp/html3/literal.html
>Preformatted text between the start and end PRE tag is rendered using a fixed with font, in addition whitespace characters are treated literally. The spacing and line breaks are rendered directly, unlike other elements, for which repeated whitespace chararacters are collapsed to a single space character and line breaks introduced automatically.
This works less well with the modern diversity of viewport sizes and pixel densities. (Not as much of a problem 20 years ago.)
Blockquotes don't do this, and act like regular HTML blocks, (<p>, <section>, etc) with normal line wrapping. HN-markdown doesn't implement blockquotes. Would be great if it did!