I have an application that needs to display trustworthy HTML content produced by an application (an old Microsoft Word) that did not necessarily produce “complete and correct” HTML as perceived by Internet Browsers of the present day (e.g. Internet Explorer 8/9). What I would like to quickly find is a module that, given an HTML text-string as input, will do what is necessary to clean-up the structure of that string. For example, if tags are missing it will insert them.
What is happening right now is that the HTML provided is being blindly inserted into the template (Toolkit, of course ...) and sometimes that results in an ill-formed HTML page. Most browsers are pretty tolerant of these things, but Microsoft’s (of course...) generally are not.
Again, I am not trying to “vet” the HTML content, merely to find a way to compensate graciously for its structural shortcomings (whatever those may be).