Implement table of contents builder (auto-detect h1 elements and add it to a TOC)