Dynamically create a TOC from the contents