Escaping inside code blocks?

Michel Fortin michel.fortin at
Sun Dec 31 09:12:17 EST 2006

Le 2006-12-31 à 4:24, Andrea Censi a écrit :

> So the spaces around the single "`" disappear?

They do. The spaces around anything in a code span disappear;
unfortunately the only reference for this is John's implementation

And it still makes sense even if you ignore the issue of putting a
backtick inside the code span since code spans are not preserving
whitespace in the browser anyway. Try this for instance:

<p>Here is <code> some code </code> with spaces.</p>

<p>Here is <code>some code</code> with spaces.</p>

Once the browser has collapsed the spaces, the result for the first
paragraph becomes completly identical to the second paragraph in
Mozilla, and almost equivalent to the second one in Safari. The only
difference in Safari is that the space after "some code" is treated
as if it was inside the code element, just as if I had written this:

<p>Here is <code>some code </code>with spaces.</p>

Other browsers may do other things, but it's unlikely they'll do
something useful either. Better disallow leading and tailing
whitespace in code span and stop wondering about the browsers.

Michel Fortin
michel.fortin at

More information about the Markdown-Discuss mailing list