4
votes

I have a question about pages and groups in doxygen. I have a project, where I grouped classes etc. with the @defgroup and @ingroup cmds. So far this works fine.

Now I'd like to add special documentation to the project with markdown pages. These pages should appear in the dedicated module (group). I tried to create pages with the @page and @subpage cmds. That works fine, but the pages appear plain in the menu.

So I tried to add them to the groups with @ingroup. But that doesn't work as I guessed. Is it possible to add pages to modules (groups)?

The result should look like this:

Project
|-- Modules
| |-- "Module1"
| | |-- documentation page1 (from *.md file)
| | |-- class documentation
| |-- "Module2"
| | |-- documentation page2
| | |-- class documentation

I hope you can help me!

2

2 Answers

6
votes

In described case we have two types of documentation for groups:

  1. documentation from source files
  2. documentation from markdown files

And we need create tree structure for this goups.

For example, we create 2 groups :

  1. Main Application with documentation in source code
  2. Library with documentation in file library.md

Main Application group source code (for C++) may look like this:

/** @defgroup app Main Application */

/** @addtogroup app
  * @brief Main application description.
  *
  * @{
  */

int main() { return 0; } //do nothing

/** @} */

MarkDown file library.md contain simple text:

Library File {#library}
============

Library Page Content from library.md.

Now to define structure we create mainpage.md file with content:

Pages {#mainpage}
============

Content:

- @subpage library

@defgroup Library
@addtogroup Library
@copydoc library
@{
@}

@subpage tag in mainpage.md used to hide all pages from tree to one root item (Pages). @defgroup tag create new group for markdown documentation. @copydoc tag copy content from library page to Library group.

On screenshot you can see result structure:

Doxygen groups and pages

Note, that Module Group name and Page name may be different in that case. You can also paste content from MarkDown files into source code documentation using @copydoc tag.

Reference: http://www.doxygen.nl/manual/grouping.html

0
votes

I have done it using @{ and @} commands and it works like this -

/**  
 * @defgroup module_name Sample Module   
 * @{   
 *     @page page_name [Optional Page Heading]   
 *     here will be the texts for the page ...    
 * @}   
 */   

If you have the module already defined some where, probably you need to use @addtogroup instead of @defgroup.

Hope this helps.