This is just a short, half-baked idea that I’d love some feedback about. It’s pretty common in the forums for users to post a code snippet in their question, say “Hey! This isn’t working!” and then having a conversation with the community about how they should fix their code so it works. The problem is that people have to keep copying and pasting the code block over and over again, or they just don’t bother, and it becomes fairly difficult to follow the thread.
Why not have a little wiki-style area at the top where any contributor to the thread could edit the code sample, slowly turning it into a quality piece of code. Just like a wiki, moderators would be able to control it, and a history would be kept. The code snippet could be locked down (maybe when the question is marked as answered?) Then, at the top of answered questions, you’d have a community validated code snippet.
Here’s my mockup of what it might look like. What do you think?