[spam HIGH * code span doesn't preserve space

Michel Fortin michel.fortin at michelf.com
Wed Feb 9 08:42:31 EST 2011


Le 2011-02-09 à 8:29, weakish a écrit :


> 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 think spaces should be preserved in code span,which maintains consistence

> with code block. For example, the following HTML code:

>

> <code>grep '&nbsp;&nbsp;&nbsp; '</code>


But no-break spaces are not spaces. Changing the content to no-break space will help preserve the appearances, but it'll cause problem if you try to copy-paste the code.

You should try this CSS rule instead:

code {
white-space: pre-wrap;
}

--
Michel Fortin
michel.fortin at michelf.com
http://michelf.com/





More information about the Markdown-Discuss mailing list