Usually when I need to post an error output or any code I use blockquotes and place the entire thing there. On two occasions my code has been edited and formatted in a way that it can be seen in a box with a horizontal scroll bar.

How can this be achieved?

| |
  • 1
    Just a tip - either: 1) Hit edit on your post and view the "source" to see how the editor did it. or 2) View the diff, then click "side-by-side markdown" as view to see what the editor changed and what magic did the trick. – gertvdijk Jun 26 '13 at 8:47

If you select/highlight the content and click the <$> code icon it'll do one of two things for you:

  1. If it's part of a line but not a full line, it'll wrap it in ` marks. This gives that section a grey background and changes the text to a monospace font, ideal for code samples.
  2. If it's a full line, or multiple lines, it'll prepend each line with four spaces. This does all the scrollymagic as well as a fixed-width font.

You can do either of these manually but the code button makes it much easier. Don't use quotes for code or terminal samples.

| |

You leave an empty line before the code block and the you indent every line by (at least) 4 blanks. See the tab Preformatted in the editing help. enter image description here

| |

You must log in to answer this question.

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