A lot of trouble with this, most of the new people dont understand the importance of code tags. I was thinking maybe a tooltip below the submit that said something like:
Tip* Please use code tags! they help make your code easier to read for others! These tags can be located on either the bottom of the screen or bottom right side under the image '<>'
Something interesting would be like StackOverflow. What it does is sense if the user has input some code, and if so, it makes them put in code tags. We could have something like this except have a tooltip, and not be so forceful.
One of the first rules of UI design is that the user doesn't read squat.
Daniweb has had ongoing difficulties getting new posters (and some not-so new posters) to use the tags, despite having some very aggressive efforts to make people use them.
One solution is to have a "code tag moderator", who spends his life fixing people's code tags, but that doesn't usually work out very long.
If the forum script is complex enough, it could try to recognize unformated code and automatically tag it -- but this does produce some mistakes. However, most of the mistakes could be mitigated with some careful programming, I think -- so this is the option I would choose.
The only problems are: 1) not breaking older posts, and 2) time spent to make it work.
Duoas had a great idea, but i feel if you just put a little note under the submit button newer readers would at least see the tooltip(maybe in red or a color that stands out) and use the code tags.
Problem isn't whether they know about it. The problem is whether they care to do it. Some are lazy or just don't care and simply copy/paste the code with the question and leave it at that. You'd even have users misusing the tags (putting output in code tags, code in output tags, or mixing it with quote tags. The problem is the user, not the site. The user will use what the feel like using and ignore the rest (same is done with advice, as I'm sure you have noticed people will comment on one thing and seemingly ignore the rest of your comment like you had said nothing).
Example, the admin at Allegro.cc added a spoiler tag to hide things that could ruin either a game, movie, or such. He even said not to use them willy nilly, yet in one thread every post has one or more spoiler tags.
What about just having a javascript wrapper that says "There has been code detected in this post. Please add code tags. [OK, I will fix it] [I don't care]" meh.. :P
Javascript wouldn't work as a lot of people have JS disabled and have popup blockers on. This is an issue that has always been an issue on every site and it will always be a problem no matter how you address it. I saw a veteran user of a site use code tags to paste an article on the site. He only changed it after I told him that using quote tags would make it more readable.
As an alternative, people could refuse to help a poster that chose not to use code tags. If people only replied to such posts with "Please edit your post so that the code is safely nestled within the tags, then we will try to help answer your question." or something similar. And when (or if) such posters comply, they are rewarded with the constructive criticism they wanted.
@atropos: We've tried the peer pressure method here for a while now, it has a predictable success rate. Some users stay and others get discouraged because between the tags and our particular opinions on the proper way to do things we end up looking like a site full of rule Nazi's. I think our current objective might be to retain more of those users who get discouraged.
Have we thought about just not dropping the white space from regular post submissions? It would be better if we could get users to use code tags but assuming that the ideal is impossible to obtain maybe we should try a different direction?