After doing much editing of code pastes from users at StackOverflow, I'd like to suggest a possible simple interface for the pasting of code:

Interface Mockup

As this was meant to show the basic layout, I certainly don't expect a final version to look like this. This interface can either be a popup window, or an inner page dialog. This would either replace the existing code button functionality, or be a link/image/button in another location that users can access. The points are as follows:

  1. A way to explicitly select what language to highlight in. This will avoid confusion as far as highlighting, and make it easier for editors to fix incorrect highlight issues without having to reference to the advanced formatting guide.
  2. An indent feature to allow for users who often paste code that is deeply nested, causing everything to be off to the side and very difficult to read. Another option I thought of was to auto indent based off language selection. If auto-indent was supported, the code is indented automatically. Otherwise it's shown as is and the editors can handle the more off edge cases. To be honest though, most of the indentation weirdness I see are from C style brace code (PHP, C, C++, Java, .NET).
  3. The fairly self-explanatory save button. This will insert the code with possible indentation and the specific language in effect.
  4. The text area to paste the code.

Let me know about this idea, or if you have potential alternatives to making this process easier.



You're supposed to tag questions correctly, which (bonus!) gives you the correct code formatting in 98% of cases.

When the formatting is wrong, most of the time that means the tagging is wrong and that needs to be fixed first and foremost.

Beyond that, you're just putting more stuff on the screen, which is pointless in the face of these oblivious users who won't read anything.

  • 2
    That's fine. I would still like to suggest auto-indent if possible. I'm fixing indentation manually for the time being, but it would be nice if automation of the process for C style braces would be taken care of. Though the last comment seems a bit harsh. – onteria_ May 25 '11 at 3:08

You must log in to answer this question.

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