Performance: Move TOC parsing into rendering stage

This moves the html5lib parsing to extract a table of contents out of the document view critical path.