Could we improve the way the pasting and indenting of code works for the first time user?

I see questions where the user really tried to paste and indent the code, but failed anyway. And I assume this is because they first press the code sample button and then paste the code:

enter image description here

The best solution would obviously be to make the code indent properly when pasting it. But if that's not possible, is there another way to do it?

One idea could be that if no text has been selected when pressing the code sample button, it shows this:

enter image description here

Any other ideas?

  • 3
    +1. This will also help when inserting code into a list item.
    – Matt
    Commented Feb 7, 2012 at 15:07
  • 1
    Completely agree, or at least some explanation about how to do it in the formatting help. I didn't know that it is better to paste and then mark it as code and I came here to find out how to do it properly
    – llrs
    Commented Jan 8, 2014 at 14:45


You must log in to answer this question.

Browse other questions tagged .