Meta Stack Exchange is where users like you discuss bugs, features, and support issues that affect the software powering all 158 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

I want to insert a long console dump in my answer. It would be best if the text is scrollable. How do I get around the "feature" that lines in SE posts need to end in 2 spaces?

share|improve this question
Have you tried formatting it as code or quote? – Mysticial Apr 16 '13 at 16:52
@Mysticial: If it doesn't work in plain text it probably won't work in a quote. – BoltClock's a Unicorn Apr 16 '13 at 16:53
@BoltClock'saUnicorn SHHHH... Obviously I've never tried it with quotes... :P:P:P – Mysticial Apr 16 '13 at 16:54
Is there any chance the entire console dump isn't really necessary? Maybe you could just include relevant excerpts. – Rob Kennedy Apr 16 '13 at 22:19
up vote 6 down vote accepted

Paste the text into your question/answer and select it with the mouse.

enter image description here

Then click the code button from the toolbar. All your text will be given code formatting and the line breaks preserved.

enter image description here

This will also make the text scrollable if you insert a really long dump.

enter image description here

share|improve this answer
Ehm, which website are you on? My code button doesn't look like your code button. – Robert Harvey Apr 16 '13 at 17:43
@RobertHarvey that's AskUbuntu. – Pops Apr 16 '13 at 17:47
@RobertHarvey: Looks like Ask Ubuntu. For some reason the code button looks like <$> there instead of {} like on SO. – hammar Apr 16 '13 at 17:47
Hmm. Sorry guys. I was using Ask Ubuntu. I'll update the screenshots. Also, the magic comment is [] (confusing I know). (cc @RobertHarvey) – ɥʇǝS Apr 16 '13 at 17:49
Even better, use the <pre> element so that you don't get weird syntax highlighting. – Richard J. Ross III Apr 16 '13 at 23:01
<!-- language: lang-none --> @RichardJ.RossIII. – TRiG is Timothy Richard Green Apr 17 '13 at 1:53
@TRiG I am aware of that, but sometimes pre is easier, – Richard J. Ross III Apr 17 '13 at 2:00

Please don't use regular HTML <pre> tags to format code. Use the code formatting. That will make long messages scrollable. If you're worried about weird syntax highlighting being applied incorrectly, you can disable syntax highlighting by inserting <!-- language: lang-none --> on a line by itself before the code block.

share|improve this answer
<Pre> blocks are scrollable just like code blocks. – Rob Kennedy Apr 17 '13 at 3:12
Are they, @RobKennedy? I hadn't noticed that. Right. – TRiG is Timothy Richard Green Apr 17 '13 at 3:32

If you're pasting long code, then select it all and format it as code, as demonstrated in Seth's answer. The keyboard shortcut for that is Ctrl+K.

If what you're pasting isn't code (such as compiler output, log messages, or a custom data format), then use regular HTML to format it instead of running it through the code highlighter. Put <pre> at the start of your text and </pre> at the end. There's no need to indent text formatted that way.

share|improve this answer
+1 for the keyboard shortcut, though personally, I like using the formatting for anything code-ish, whether it's terminal output or something like JS. It's just easier on the eyes (IMO anyway). – ɥʇǝS Apr 17 '13 at 0:37

You must log in to answer this question.

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