http://www.perlmonks.org?node_id=34682

The prospect of auto-detecting when the user failed to insert CODE tags was discussed at Automatic CODE tags. In particular, Corion came up with some basic test code here.

Lately, there have been several posts that did not use the CODE tags. While I'm all for educating users, there will always be un-tagged posts as long as we have new users. I (re)suggest the following:

  1. Users have an "auto-correct CODE tags" option, which defaults to on. This sets whether PM checks when you post.
  2. If your post contains no CODE tags,
  3. AND you have the auto-correct option set,
  4. AND your post contains more than 5 (?) semicolons (not a heavily used punctuation in non-code), then your entire post will be wrapped in CODE tags
  5. If the post is thus wrapped, "CODE automatically wrapped, please use <CODE> </CODE> tags in the future (See Site How To for info)" is added to the top of the post.
This looks fairly simple to add to the code base, doesn't effect advanced users, and tries to teach newbies, while making PM easier to navigate.

(We could alternatively use Corions code, but it looks to based too much on syntax, which will be highly variable with newbies.)

Replies are listed 'Best First'.
RE: Returning to Auto CODE tags
by Corion (Patriarch) on Sep 30, 2000 at 00:33 UTC

    In fact, I just revisited that code and noticed that lhoward made another valuable comment there, namely, just applying that magic to monks with XP less than 50. Other monks should know better and use the <CODE> tags.

    That code is still some heuristic hack and I don't know how it would stack up in the real world here, maybe I'll do some local checking against nodes that don't have formatted code ...