What is meta? ×
Meta Stack Exchange is where users like you discuss bugs, features, and support issues that affect the software powering all 133 Stack Exchange communities.

There are times when using a fixed-width font adds significantly to the readability of the text. It would be nice if we could mark a block of text as using a fixed-width font. I know this can be done with the Code Sample markdown, but that syntax colors it and prevents other markdowns, like bold and italic, from working. Sometimes I just want a fixed-width font.

Okay, this works:

bold italic strike

Just have to use HTML instead of markdown.

share|improve this question

5 Answers 5

up vote 6 down vote accepted

Or you can use pre

Some fixed width text with formatting 

was created with:

<pre>
Some fixed width text <em>with formatting</em> 
</pre>

See the help file for all the editor details.

share|improve this answer
    
Cool. That takes care of italics, but the <b> tag doesn't seem to work. However, the <strike> tag does. –  raven Jul 16 '09 at 0:14
    
Try <strong> instead of <b>. –  Joel Potter Jul 16 '09 at 0:21

Isn't <code>code</code> fixed-width?

asdfoao2 23r0 qBWEFwja
ao293f8S w345 AESFQ2er

share|improve this answer
2  
You can't bold/italicize items in a code block. Also it may try to apply syntax highlighting on certain words. –  TheTXI Jul 15 '09 at 23:45
<pre> tags seem to do the trick

following text does not have to be fixed width

The Markdown looks like:

<pre>&lt;pre&gt; tags seem to <b>do</b> the <i>trick</i></pre>

following text does not have to be fixed width
share|improve this answer
    
But then all the code following it is fixed width as well. Put a closing tag on it and that italic won't be italic anymore. –  raven Jul 16 '09 at 0:07
    
See my edit: this is not the case. –  Nick Jul 16 '09 at 0:10
4  
It shows up okay for me; my fixed-width font is Consolas but I know some other fonts don't distinguish bold very well. Maybe thats the problem? –  Nick Jul 16 '09 at 0:29

As others note, <pre> works. But i wouldn't mind seeing <tt> supported, for those occasions where you want to publish console output in an appropriate fixed-width font.

share|improve this answer

It seems to work fine for me:

<code><b> Bold    multiple spaces with &nbsp; </b></code>

<code>&lt;code&gt;<b>&lt;b&gt; Bold&nbsp;&nbsp;&nbsp;&nbsp;multiple spaces with &amp;nbsp; &lt;/b&gt;</b>&lt;/code&gt;</code>
share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .