Home » Questions » Computers [ Ask a new question ]

How can I make a table of contents for a markdown document with Python/AWK/SED?

How can I make a table of contents for a markdown document with Python/AWK/SED?

I have the following markdown document:

Asked by: Guest | Views: 138
Total answers/comments: 2
Guest [Entry]

The Markdown in Python implementation has support for extensions one of which includes Table of Contents generation. Additionally Pandoc (which is a Haskell markup->PDF has support for markdown (in addition to a bunch of other formats) and can output pretty HTML, LaTeX, PDFs, etc.
Guest [Entry]

See this article for a comparison of lightweight markup languages with some information on tables of contents that might lead you in the direction of a solution.