Comment

Luke Plant

A long time ago I wrote django-output-validator to do this kind of thing. https://pypi.python.org/pypi/django-output-validator/1.5 but it ran as a middleware and notified you immediately (in development) if a generated page was invalid HTML.

However, with HTML5, HTML validation got a whole lot harder, and ridiculously complex and slow, as you discovered. Since HTML5 is also a moving target, and what matters is whether it works in browsers, I decided it wasn't worth maintaining that package.

In your case, a simple check for well-formedness would have found it, and that can be coded up with a few lines of Python. It might be a more practical solution that attempting full HTML5 validation.