4 ms·
If you're serious about HTML checking and cleanup consider using SGML and my (inofficial) HTML 5.1 DTD [1]. It doesn't do magic (like indentation or removing/s
by tannhaeuser 10y ago
If you're serious about HTML checking and cleanup consider using SGML and my (inofficial) HTML 5.1 DTD [1].
It doesn't do magic (like indentation or removing/simplifying CSS) if that's what you're after, but it gives you straightforward capabilities to filter out script elements, check/suppress event handler attributes and other places where JavaScript can occur maliciously in HTML, enforce presence of HTML elements, etc. Since it's entirely driven by an SGML DTD grammar for HTML it can be customized to death really (for context-dependent filtering, injection prevention, whatever).
[1]: http://sgmljs.net/blog/blog1701.html http://sgmljs.net/blog/blog1701.html