Auto-generate a table of contents in an HTML document