A new feature called Stack Snippets was introduced that allows users to embed runnable code snippets in their posts. According to the blog post:
If you feel that a particular site should have Stack Snippets, post a feature-request on that site’s meta – if there’s support from the community there, we’ll enable them.
Well, I think Stack Snippets would be pretty great here, for several reasons:
- Other users can run and test submissions directly from their browser, without even having to click another link
- Test cases can be embedded naturally into posts, to verify that the code works properly
- We could hide very long ungolfed commentated snippets within collapsed Stack Snippet blocks, so that people who want to see how everything works could, while the answer wouldn't get too long
Finally, here's an example of Stack Snippets in action. (Note that you can make them non-collapsed by default, so you can still see the code.) Try it out here!
And when expanded: