How to include custom files in Doxygen

2019-01-13 05:27发布

问题:

I would like to add custom (non-project) files to generate some extra pages with Doxygen.

I am (was actually) unsure how these files should be named and how their content should be formatted.

回答1:

I having been searching quite a lot before I found the answer, so I thought it would be nice to share!

According to this Doxygen gotchas article I finally found that: you need to add a file with the dox extension. Its content should contain C-style comment blocks:

/*!
  \page My test page
  contents
  ...
  more contents
*/

Make sure your custom files are placed in a directory which is included in INPUT setting or in the current directory if INPUT is left empty, so these files can be found.



回答2:

Just for completeness: there are 3 possible extensions which doxygen treats as additional documentation files: .dox, .txt, and .doc.

Files which such extension are hidden from the file index. Inside the file you need to put one or more C/C++ style comment blocks.



回答3:

For even more completeness, starting with Doxygen version 1.8 (I believe), it now supports additional text files which are very similar to markdown syntax. You no longer need to use C/C++ style comment blocks. Instead, just write almost normal text and make sure that the text file is in the INPUT path, and that your doxygen scan actually looks for files with .markdown extension (or any other extension you choose to use, like .md).



回答4:

For clarity:

In the .dox configuration file, add the file to the INPUT directive with something like this:

INPUT = ../src \
        ../include \
        ../docs/my-extra-file.txt

If the file had the appropriate extension, say like .h or .c then Doxygen would find the file without adding to the INPUT directive. Inside the file use normal Doxygen tags, as in the source, i.e. inside comment blocks, like:

/*! \mainpage MyProject - A Brief Description.
\image html Mylogo.png
\section my-intro MyProject Introduction
\htmlinclude about-MyProject.html
*/

One can also just use one of the include tags, like the "\htmlinclude" in the above example, any where in the code.



回答5:

Just list your custom files in the INPUT macro in your doxyfile. You can choose whatever name you find appropriate. Format is text with Doxygen tags.



标签: doxygen