Search code examples
markdowndoxygentableofcontents

how to add table of contents to doxygen generated html file?


I have a C-project documented with doxygen and want to add a table of contents that shows the sections and subsections. I tried the \tableofcontents and the [TOC] as described in the doxygen manual, but nothing happens. Here is a small example:

/***********************************//**
 * \file        Bsp.c
 * \brief       example
 *
 * \tableofcontents
 *
 * \section sec1 section 1
 * blabla
 *
 * \section sec2 section 2
 * blabla
 *
 * \subsection ssec21 subsection 21
 * blabla
 ***********************************/



/***********************************//**
 * \brief   
 *
 * \section sec1func funcsection 1
 * blabla
 ***********************************/
void func() 
{

}

Here is what I get in html:

link to output of example

What do I do wrong? Thanks in advance for every hint!


Solution

  • The documentation for doxygen says, that @tableofcontents only works on extra pages (@page, @mainpage), not in the regular documentation blocks.

    You can still build your own table of contents using @ref and a bit of html (though it isn't as nice as using the builtin command).