Skip to main content
3 of 3
replaced http://meta.superuser.com/ with https://meta.superuser.com/

Formatting code and comments

I use a trick similar to the one presented by slhck, but mine allows not only HTML markup in a gray block, but also variable-width characters.  I use the > (which is markdown for <blockquote>) at the beginning of the line, and then <code> and </code> and other markup/markdown as appropriate.  For example,

(prompt)> cd /              // cd is short for “change directory”.

WWWWWWWWiiiiiiii       //  Compare the widths of the characters.
WWWWWWWWiiiiiiii

is produced by

>_(prompt)_><code> **cd /**</code>              _//_ `cd `_is short
for “change directory”._
>
`WWWWWWWWiiiiiiii`&nbsp; &nbsp; &nbsp; &nbsp;_//  Compare the widths
of the characters._☆☆
 WWWWWWWWiiiiiiii

where ‘☆’ represents a space (two spaces at the end of a line inside a blockquote acts like a <br>).

It’s sometimes tricky figuring out when you can use markup and when you can use markdown.  For example, anything you type between back-ticks (`…`) is displayed literally, where as text between <code> and </code> can contain markup (<b>bold</b>, <i>italic</i>, &amp; = ‘&’, &times; = ‘×’, etc.) and markdown (*bold*, _italic_, etc.)  Thus, since I wanted to put the cd / into bold, I needed to use <code> and </code> for that, but I could use back-ticks the other two places.

<edit>D’oh! I just realized that I could have said **`cd /`.</edit>**

Beware: The markdown processors in SU and MSU might not be identical.