Generate table of contents for a markdown document.