Newline before </code></pre>

Milian Wolff mail at milianw.de
Sun Jul 2 18:45:42 EDT 2006


Am Montag, 03. Juli 2006 00:32 schrieb Jon Noring:

> Some background:

>

> In XHTML, the <pre> tag means all the text characters in the content,

> including the white space characters, is significant (that is, the

> XML attribute 'xml:space' is designated the value of 'preserve'.) The

> white space characters are:

>

> space (U+0020)

> tab (U+0009)

> carriage return (U+000D)

> line feed (U+000A)

>

> (To note: For ordinary XHTML elements, where xml:space is set the

> value of 'default', the default browser/user agent behavior is to

> collapse a sequence of one or more white space characters in content

> to a single space character. Also, leading and trailing white space

> is ignored.)

>

> Thus,

>

> <pre><code>This is Code

> </code></pre>

>

> is different than:

>

> <pre><code>This is Code</code></pre>

>

> For comparison, for ordinary XHTML markup where xml:space has the

> value of 'default':

>

> <p>This is a paragraph.</p>

>

> Is the same to browsers as:

>

> <p>

> This is a paragraph.

> </p>


Thanks for the detailed background.
But I have to say that I was aware of that. If there wouldn't be that
difference, I wouldn't have to complain, would I?


> Now, I don't know the reason in Perl or PHP markdown for preserving

> CR/LF characters using <pre>, but there must be some reason. I'm

> only trying to give some background information.


Again - what reason would that be, to add an additional newline? Either they
thought it would look better (which it does not imho) or they just did it
without thinking of what it would do.

If it would be somewhere deep inside a function / regular expression or
whatever I would understand to leave it. But no - it stands just in front of
the closing tags:

\n</code></pre>


--
Milian Wolff
http://milianw.de


More information about the Markdown-Discuss mailing list