movedo / MoVeDo

build-system for Modular, Versioned Documentation
GNU General Public License v3.0
6 stars 3 forks source link

TOC (table of contents) generation #5

Open hoijui opened 4 years ago

hoijui commented 4 years ago

CodiMD (and co.) support an [TOC] in-document command, to be placed where the table of contents shall be in the document when generating the (HTML) output.

GitLab supprts [[_TOC_]], which works in the same way.

Pandoc supports neither (in none of the Markdown flavors), so we need hackery for that!

Idea

Check if a document to be converted has either [TOC] or [[_TOC_]] present (e.g. using sed), and if so, remove it, and use the --toc command line option to pandoc, which generated a table of contents in the very beginning of the document.