code span doesn't preserve space

Rob McBroom mailinglist0 at skurfer.com
Wed Feb 9 08:44:47 EST 2011


On Feb 9, 2011, at 8:29 AM, weakish wrote:


> Consider this code span: `grep ' '`. All implementations listed on

> [babelmark](http://babelmark.bobtfish.net) just simply wrap it as:

>

> <code>grep ' '</code>

>

> Viewed in browsers, the above code is equivalent to:

>

> <code>grep ' '</code>


I couldn’t reproduce this at first, but I was only doing a preview in TextMate. When I checked a couple of browsers, I saw what you mean. This is the CSS that TextMate uses.

code, pre {
word-wrap: break-word;
white-space: pre;
white-space: pre-wrap;
white-space: -moz-pre-wrap;
white-space: -o-pre-wrap;
}

That can be used to preserve the space in contexts where you have control and are defining CSS rules. Of course it doesn’t solve the problem across the board.

--
Rob McBroom
<http://www.skurfer.com/>



More information about the Markdown-Discuss mailing list