|go ahead... be a heretic|
Site HTML filtering, Phase IIby tye (Sage)
|on Feb 11, 2004 at 03:32 UTC||Need Help??|
I've made several minor improvements to the HTML nesting enforcement code based on the testing done so far. Thanks go to the few who I saw "complain," especially ysth. (:
First, note that P is no longer a block tag as far as PerlMonks html nesting is concerned (because people often don't close a P tag and that shouldn't prevent earlier tags from being closed).
The other improvements mostly have to do with how corrections are displayed. Below is my attempt at documenting the htmlerror reporting levels. With luck, the SiteDocClan will improve these into a PM doc node (along with the previous announcement).
So there are two new settings in User Settings. And pretty soon the htmlnest option will go away (it will become the default behavior that can only be disabled by adding ;htmlnest=0 to a URL).
HTML error reporting levels
Reporting levels summary
Reporting levels details
No matter what htmlerror reporting is set to, any unrecognized, invalid, or unapproved tags simply have their opening < changed to < so that the tag becomes visible as text (see the More HTML escaping announcement).
When you have htmlerror reporting set to 4 (the maximum), nearly all other corrections made to the HTML will also be made visible, but in a grey font:
This level (4) of htmlerror reporting is rather obnoxious and is reserved for when you are composing your own nodes or temporarily request it by adding ;htmlerror=4 to a PerlMonks URL.
If you lower the htmlerror reporting level to 3, then inserted and ignored </p> tags are not displayed. Neither are closing tags that were inserted to close a non-nesting tag other than at the end of the HTML being filtered.
For example, if you have an HTML table that is missing all of its </tr>, </th>, and </td> tags, then these will be inserted but not be displayed (as long as the </table> is not missing).
Level 3 omits showing these most common lapses (that are harmless unless you consider strict compliance to newer HTML standards as a goal in itself) but shows nearly all other mistakes.
Level 2 omits showing ignored closing tags. So it shows non-trivial inserted closing tags (descibed in the next paragraph) and ignored attributes.
Level 1 omits showing ignored attributes. This means that it only shows when tags had to be inserted to close an unclosed or misnested tag (but never shows non-nesting tags unless they were inserted at the end of the filtered HTML, and never shows </p>).
Level 0 (the default) just fixes nesting errors but doesn't display any of them.
In user settings, you can select between htmlerror reporting levels of 0, 1, 2, or 3 to be used when you view nodes at PerlMonks. You can temporarily select any reporting level (including 4) by appending ;htmlerror=4 (for example) to any PerlMonks URL.1
Note that using an error reporting level of 3 will show you harmless "errors" so you shouldn't select this unless you can deal with seeing a lot of "mistakes" without becoming obnoxious in pointing them out to others.
When you start composing a new node, for thefirst preview you can select between htmlerror reporting levels 3 and 4 (the default choice is also controlled in user settings and defaults to 3). For previews after the first, you can pick any reporting level via a form element on the preview page.
[ The patches to Preview are a bit complicated and haven't been finished. At the time of this writing, the first preview uses your 'preview' level of error reporting and there is no form element for adjusting the level while previewing. ]
1 You can't select 4 as your default error reporting level (except for when previewing your own nodes) because it reports harmless "errors" that we expect to be made often by many members and we don't want to hear complaints about such.