I find the 4 space indentation to include code snippets unnecessarily difficult to use. Typically, when you copy and paste some code it requires manually reformatting each line (unless there's some hidden mechanism I'm missing). It's also weird that there's no way to specify what language you're actually showing in your code snippet (meaning the syntax highlighting is kind of a best-guess).

Github and CodePlex both use a system where triple backquotes (```) denote a block of code. IMO, this is much easier to use and requires zero reformatting after copying and pasting. They also allow you to specify the language immediately after the triple backquotes, to give the syntax highlighting a hint of what language you're showing.


``` JavaScript

function(foo) { alert(foo); }


Does anyone else feel this would be preferable to the current system?

P.S. I also think something similar would be better for block quotes, >>> perhaps?

Edit: Sorry if this already has been suggested, searching "triple backquote" yielded nothing.


Another thing you can do is select the code (once pasted) and do CTRL + K.

This add 4 spaces of indentation at the beginning of every selected line. Note: It's works as a toggle so if you do it twice it will add then remove the 4 spaces.

| improve this answer | |

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