In this question the OP included a snippet of expected output (the order of some values in a hashmap).

I thought this would be best formatted as a plain single-spaced list with no numbering, bullets (like the HTML <pre> tag I guess). The closest I found is the code formatter. Is there a standard accepted way to format "expected output" sections?

  • 2
    Format as for code is best. – nb69307 Jun 4 '10 at 12:14

In most situations, you want to use code formatting. If you are expecting a certain output, you probably have a specific nature as what the lines should be outputted, so using code formatting lets you keep everything that should be on one line in one line. This is superior to block quotes, which will wrap if it is too long. Any additional formatting should match how the output should be.

The only real downside to code formatting your expected output/input is that when it isn't code, you can get some wonky coloration. This actually looks pretty good in some cases, but if you find that the resulting coloration for a particular output is very distracting or makes the text seem unreadable, then you can opt to use block quotes instead.


If you use <pre> tags, it will give you code-block like look without the highlighting, but also without the automatic escaping of special characters like < and >. You would have to escape those characters by hand where appropriate, but that's error prone and tedious.

Since you usually want the special characters escaped, code formatting is the easier and safer choice.

You must log in to answer this question.

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