Search code examples
markdowndoxygentableofcontents

Markdown file with table of contents exported to a doxygen documentation does not create a TOC in HTML


There is a markdown file which I'm using to create part of a doxygen documentation through cmake directives and doxyfile.in statements. The generated documentation is almost correct. Actually this markdown file is the main page of the doxygen documentation.

The beginning of the markdown file reads

# Title1

[TOC]
## Title2

and the rest of the document goes on. Nevertheless, when I generate the doxygen documentation the table of contents does not appear. Please, does someone have any clue?


Solution

  • We are dealing here with the in-page table of contents.

    Looks like that there are multiple problems.

    1) [TOC] should be before the first header (i.e. # Title1) (when this is not the case the table of contents is still incorrect unless other commands are given like \page.)

    2) The TOC_INCLUDE_HEADINGS (in the Doxyfile i.e. the doxygen configuration file) should be set to a value > 0 to get an n-page TOC. From the Doxyfile / doxygen documentation:

    # When the TOC_INCLUDE_HEADINGS tag is set to a non-zero value, all headings up
    # to that level are automatically included in the table of contents, even if
    # they do not have an id attribute.
    # Note: This feature currently applies only to Markdown headings.
    # Minimum value: 0, maximum value: 99, default value: 0.
    # This tag requires that the tag MARKDOWN_SUPPORT is set to YES.