I have faced difficulties many times editing people's posts on Stack Overflow where I was trying to reformat improperly formatted code and other stuff. Is there a way of clearing previously done formatting and do it from scratch?

It seems easy sometimes if the formatting done by the user is messy.

  • Do you mean reverting your own changes or stripping all Markdown formatting? – Peter Mortensen Mar 25 '14 at 5:12

The original formatting, as posted by the original poster, is available by clicking the link "edited Mon X 'YY at HH:MM" link above the most recent editor's avatar & name. This brings up all of the revisions made. From there the original source question - including code - can be copied.

Here is an example history for a question, showing revisions/edits: https://stackoverflow.com/posts/3202567/revisions

For each revision there, there's a source button for copying original text (without the strike-through for deleted text).


The code formatting facility in the Markdown editor is pretty basic... all it does is indent the code four spaces, or de-indent it if the smallest indent is four spaces. It doesn't have any knowledge or awareness of code structure, so I doubt that it is going to be any help to you in that regard.

Your best bet is to selectively de-indent specific parts of the code code until it is at the correct indentation level, and work from there.

You must log in to answer this question.

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