Generate a markdown-formatted table of contents from an existing file