Generate and insert tables of contents in markdown files