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.
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. usingsed
), and if so, remove it, and use the--toc
command line option topandoc
, which generated a table of contents in the very beginning of the document.