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 ' '</code>
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 ' '</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/
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/>
On Feb 9, 2011, at 5: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 think spaces should be preserved in code span,which maintains > consistence > with code block. For example, the following HTML code: > > <code>grep ' '</code>If you don't use css to style the spaces, may not help. In the versions of firefox I use, the stupid browser happily compresses no matter how many <code>s and <pre>s I wrap around them. -david parsons