Meta Stack Exchange is where users like you discuss bugs, features, and support issues that affect the software powering all 153 Stack Exchange communities.

What is meta?
Here's how it works:
  1. Any Stack Exchange user can ask a question
  2. The community provides support, votes on ideas, and reports bugs
  3. Your voice helps shape the way Stack Exchange operates

This question is regarding this suggested edit.
This is another example.

I am pretty sure I have been advised by more experienced users who have edited my posts in the past that we are supposed to format console outputs/print outs as blockquotes (quote blocks) not code samples. At least that was the explanation for the edit. I was going to reject the proposed edit, however someone else has already approved it and that's when I started having some doubts.

Can you please clarify how to wrap parts of questions when there is no code but a console printout/log? Is it OK to wrap it in code blocks?

This similar question does not have a clear answer about when to use blockquotes and when to use code.

share|improve this question
up vote 10 down vote accepted

The critical difference between code blocks and blockquotes (quote blocks?) is that the former uses monospaced text and preserves spacing (like the HTML <pre> tag), while the latter uses block-indented normal text.

Thus, to preserve spacing and line breaks, it often makes sense to format console output/logs as a block of code. Blockquotes work too, but they lose all the spacing and sometimes that is important or enhances readability.

The only risk of doing this is that it becomes subject to automatic syntax highlighting. If that looks ugly in the preview and you want to disable that for a specific code block, you can use this magic incantation:

<!-- language: lang-none -->

non-code stuff here,
  that should still be formatted
  exactly as it appears in the post,
  with monospace text
     . . . and spaces preserved
share|improve this answer
Thanks Cody. I know what the difference between the two is, but thanks for explaining again. Are you suggesting there is no requirement relating to the formatting? You can pretty much choose whatever suits you better? – user221081 Jul 24 '13 at 7:20
@mehow Uh, yes. The goal here is to maximize readability. Whatever suits that the best is the best. – Cody Gray Jul 24 '13 at 7:20
OK, thanks for clarifying. – user221081 Jul 24 '13 at 7:21
Blockquotes also treat any HTML as actual HTML, stripping it if it doesn't satisfy the whitelist of acceptable tags. This can be problematic if your log coincidentally has tags in it. – Asad Saeeduddin Jul 24 '13 at 7:22
@Asad True enough, code blocks don't require escaping. But are there really any logging tools that generate HTML formatted logs? Talk about overkill. I'm envisioning this being used for the stuff streaming across an output or command line window. – Cody Gray Jul 24 '13 at 7:25
No, but I'm sure some programs choose to output things between < and > symbols, which may or may not be interpreted as HTML tags. – BoltClock's a Unicorn Jul 24 '13 at 8:28
As for preserving formatting: beware that on mobile even monospace text is wrapped (line breaks are preserved but, just like a blockquote: no inner scrollbars) and might be hard to read. So, if possible, don't just go for how things look on the regular site, @mehow. (But, for example, limit to what is really relevant.) – Arjan Jul 24 '13 at 9:00
@Arjan Really? Monospace text is wrapped on mobile instead of inner scrolbars? That sounds like a bug to me. (I use the full site when browsing on my iPhone and it scrolls--mobile is still too limited for me.) – Cody Gray Jul 24 '13 at 9:07
Nope, not a bug. It used to scroll, but people didn't know scrolling was possible (usually no scrollbars are shown until one starts to scroll), nor how to operate that. Since ages the CSS now defines wrapping. (No vertical scrollbars either...!) – Arjan Jul 24 '13 at 9:15
Ah, Kevin wrote "Two-finger scrolling doesn't work reliably (or at all) on some of the Android devices I've tested with. Makes wrapping the only real option." See also the screenshots I once added to one of Pekka's posts. – Arjan Jul 24 '13 at 9:22

You must log in to answer this question.