I've run into an issue with the StackExchange API (with a safe filter) returning question body content with malformed HTML, specifically <li>
elements that do not have closing tags (and no valid parent).
The question I've seen this occur with is http://stackoverflow.com/questions/19774073/strange-behavior-of-length-command-oracle. I've just noticed that server response on the actual StackOverflow page also includes the same issues.
The problem I'm facing is that I'd like to embed the question body in a custom web page and the unclosed elements are causing the browser to misinterpret the html (particularly when body content is put into container <li>
elements).
So my question is: is this a bug in the StackExchange API (or backend), or should API clients not assume that body content will be well-formed html? If the answer is the latter, what kinds of workarounds are available for displaying body content on the web in a more predictable way?