Extract table of contents from HTML and add anchors to headings Returns a tuple of [html_with_anchors, toc_html_fragment]