5

tl;dr:

enter image description here

Stack Snippets are pretty sweet. I find myself using them more and more, where I used to use JSFiddle or Codepen. Kudos to StackOverflow for implementing.

And yet, I still find myself coding JSFiddle, then pasting my code into the snippet. Why? Because JSFiddle has an awesome Tidy button, that turns my horrid code into an amazing piece of art.

So, my request is, Why can't we have code beautify in Stack Snippets?

Here is my reasoning:

Snippets are used to display the source code and provide a demo at the same time. Since the purpose of an answer is to provide a solution, and help the OP understand their problem, the logical decision is to make the questions as easy to read and understand as possible. The code doesn't need to look like it was made in notepad. AHHHHHH

Compare that atrocity to this:

pretty

See My point?

Not as important, but you find it all the time where people edit a question/answer to provide the correct formatting. While this might be considered a trivial edit to some, it defiantly shows that users prefer pretty code to ugly code, I especially do.

I am sure there are plenty of others reasons that could be found, but I think the above is enough to justify adding a button and a beautify script (Alright, it might be a bit harder).

Can we please add code beautify to stack snippets?

6
  • 3
    Similar cross-site question: meta.stackexchange.com/q/82671 , meta.stackexchange.com/q/84718
    – Rizier123
    Commented Feb 26, 2016 at 23:52
  • 2
    @Rizier123 similar, but not about stack snippets. Thanks for sharing :)
    – Jacob G
    Commented Feb 26, 2016 at 23:53
  • What's the difference between stack snippets and whatever the thing that stacks currently uses? (skip line then indent 4 spaces). Is this a tool that would autoformat code in code-blocks? (if so sounds amazing)
    – star2wars3
    Commented Feb 27, 2016 at 0:28
  • 1
    @star2wars3 stack snippets are the HTML, CSS, and Javascript displays that you can add in the editor, or Ctrl-M. While auto format for codeblocks would be awesome, it woulds also be much harder, since SE would have to determine what type of code it was, then apply the correct formatting. I think it would be much easier to autoformat three set languages.
    – Jacob G
    Commented Feb 27, 2016 at 0:57
  • 5
    The HTML/CSS/JavaScript stack snippets do have a Tidy button that seems to work well.
    – Alex
    Commented Feb 27, 2016 at 1:22
  • Hmm.. We should have that for all types of code, not just HTML / CSS / JS stack snippets. Commented Feb 27, 2016 at 8:35

1 Answer 1

14

Stack-Snippets™ already have a tidy button.

If you're talking about a tidy button for the post editor, rather than the Stack-Snippet™ editor, you might want to amend your question to clarify that.

2
  • 2
    For some reason, that button wasn't appearing for me, seems like I had some problem. I feel really stupid right now.
    – Jacob G
    Commented Feb 27, 2016 at 23:32
  • 1
    I like the idea of a "Tidy" button for the post editor. It would save time while posting and make our editors' lives easier as well. Also, it could answer some questions by revealing typos or incorrect brackets.
    – jkdev
    Commented Apr 28, 2016 at 3:36

You must log in to answer this question.

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