Dynamically generate the table of contents