First of all, having to go through your code and add four spaces to every line is a pain, (even though I can just do gg>G in vim, I shouldn't need to launch a separate program). The code button doesn't even do anything but tell you to indent your code by hand (fail). But on top of that, the blocks hardly ever show up right. I posted a comment on StackOverflow with about four lines of code indented with precisely four spaces per line, padded above and below with a blank line, and not only did it not show up as <pre><code>, but all new lines were removed. That's just ridiculous. Are code blocks not allowed in comments? If so, that's even more ridiculous.

There has to be a better way. Github's triple-backtick option is still annoying, but it's certainly a step in the right direction. Why doesn't Stack have something like that?

  • 5
    Hmmm. Your question has promise, but in the end, it's just a rant. You might redeem yourself with some examples. – Michael Petrotta Sep 15 '11 at 4:55
  • Clearly you didn't read the whole post; its core is an example. – Daniel Jun 6 '12 at 0:18
  • Wow, quite the necromancer you are! Yep, I missed the fact that you're posting a comment and not a question or answer. Mea culpa. It's still a rant, and if you really cared about this feature request, you'd fix that. – Michael Petrotta Jun 6 '12 at 0:59

Select all the code. Press Ctrl+K. Alternatively, click the bracket sign (the 5th in the toolbar).

Comments only support mini-Markdown, i.e. asterisked or underscored bold/italic, links, and inline code (surround with backticks). They're not intended to be used for anything heavy, just brief notes. Click help next to the comment box for more info, or see the faq.

You must log in to answer this question.

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