[spam HIGH * code span doesn't preserve space

weakish weakish at gmail.com
Fri Feb 11 07:40:03 EST 2011

Michel Fortin <michel.fortin <at> michelf.com> writes:


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


> > I think spaces should be preserved in code span,which maintains consistence

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

> >

> > <code>grep '    '</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.

I've not seen any problem when copy-pasting the code. When I paste, I get
plain white space instead of literal ' '. I'm using Firefox 3.6.13.

> You should try this CSS rule instead:


> code {

> white-space: pre-wrap;

> }


I've considered using css. The advantage is making generated HTML code cleaner.
(A lot of   looks ugly to me.) The disadvantage is that browsers like w3m/lynx
don't support CSS. And I think `white-space: pre` is better than `pre-wrap`,
since `pre-wrap` is CSS3, and old browsers such as IE 6/7 don't support it.

More information about the Markdown-Discuss mailing list