I made documentation for my SDK, using Doxygen. It contains the list of files, namespaces, classes, types etc. - everything that I placed as Doxygen comments in the code. Now I want to write some general information about SDK (kind of introduction), which is not related directly to any code element. I want to place this introduction on the documentation start page. How can I do this?
6 Answers
Have a look at the mainpage
command.
Also, have a look this answer to another thread: How to include custom files in Doxygen. It states that there are three extensions which doxygen classes as additional documentation files: .dox
, .txt
and .doc
. Files with these extensions do not appear in the file index but can be used to include additional information into your final documentation - very useful for documentation that is necessary but that is not really appropriate to include with your source code (for example, an FAQ)
So I would recommend having a mainpage.dox
(or similarly named) file in your project directory to introduce you SDK. Note that inside this file you need to put one or more C/C++ style comment blocks.
-
11At least markdown files (
.md
and.markdown
) are considered as additional documentation files as well. I prefer them over.dox
because they don't need surrounding code comments and can be nicely edited with a markdown editor - without drawbacks.– PascalDec 13, 2017 at 8:44
As of v1.8.8 there is also the option USE_MDFILE_AS_MAINPAGE
. So make sure to add your index file, e.g. README.md, to INPUT
and set it as this option's value:
INPUT += README.md
USE_MDFILE_AS_MAINPAGE = README.md
-
6In addition to this, if you're going to use README.md as the main page, make sure it comes first in the INPUT list. When there are multiple mainpage candidates, the first encountered while parsing is selected, or so it seems. Sep 3, 2015 at 19:09
-
3By the way, in doxygen gui you only have to include your .md file under expert > input > input. Mar 6, 2016 at 3:59
-
1
USE_MDFILE_AS_MAINPAGE
did not work for me. According to the documentation, you have to include{#mainpage}
after the title of the markdown document. This did work.– samvvMay 20, 2016 at 11:41 -
2@samvv I did not add any extra to the markdown document. I just used the
INPUT = README.md
thenINPUT += src
(to follow @Lester's suggestion) and theUSE_MDFILE_AS_MAINPAGE = README.md
and it worked like a charm. Version:$ doxygen --version
returns1.8.11
to me. Jul 10, 2016 at 11:17 -
1
Note that with Doxygen release 1.8.0 you can also add Markdown formated pages. For this to work you need to create pages with a .md
or .markdown
extension, and add the following to the config file:
INPUT += your_page.md
FILE_PATTERNS += *.md *.markdown
See http://www.doxygen.nl/manual/markdown.html#md_page_header for details.
-
7Actually the current 1.8.0 version support markdown BUT doesn't treat them as documentation. So you'll end up with markdown classes listed in Files and Directories section. Solution is to add
dox=md
as anEXTENSION_MAPPING
and rename your markdown extensions to.dox
.So the config will look like:INPUT += your_page.dox EXTENSION_MAPPING += dox=md
Mar 14, 2012 at 9:37 -
6Good point. I'll correct this such that .md and .markdown are treated similar to .dox.– doxygenMar 17, 2012 at 23:25
-
4
Following syntax may help for adding a main page and related subpages for doxygen:
/*! \mainpage Drawing Shapes
*
* This project helps user to draw shapes.
* Currently two types of shapes can be drawn:
* - \subpage drawingRectanglePage "How to draw rectangle?"
*
* - \subpage drawingCirclePage "How to draw circle?"
*
*/
/*! \page drawingRectanglePage How to draw rectangle?
*
* Lorem ipsum dolor sit amet
*
*/
/*! \page drawingCirclePage How to draw circle?
*
* This page is about how to draw a circle.
* Following sections describe circle:
* - \ref groupCircleDefinition "Definition of Circle"
* - \ref groupCircleClass "Circle Class"
*/
Creating groups as following also help for designing pages:
/** \defgroup groupCircleDefinition Circle Definition
* A circle is a simple shape in Euclidean geometry.
* It is the set of all points in a plane that are at a given distance from a given point, the centre;
* equivalently it is the curve traced out by a point that moves so that its distance from a given point is constant.
* The distance between any of the points and the centre is called the radius.
*/
-
@FelixSFD thank you for your feedback. I updated my answer according to your answer. Feb 13, 2017 at 14:31
-
Correct, adding it to the input does not do it, it has to be formatted as above (a comment). May 13, 2022 at 6:12
Add any file in the documentation which will include your content, for example toc.h:
@ mainpage Manual SDK
<hr/>
@ section pageTOC Content
-# @ref Description
-# @ref License
-# @ref Item
...
And in your Doxyfile
:
INPUT = toc.h \
Example (in Russian):
-
1
I tried all the above with v 1.8.13 to no avail.
What worked for me (on macOS) was to use the doxywizard->Expert tag to fill the USE_MD_FILE_AS_MAINPAGE
setting.
It made the following changes to my Doxyfile:
USE_MDFILE_AS_MAINPAGE = ../README.md
...
INPUT = ../README.md \
../sdk/include \
../sdk/src
Note the line termination for INPUT
, I had just been using space as a separator as specified in the documentation. AFAICT this is the only change between the not-working and working version of the Doxyfile.
-
1clarification - doxywizard is the GUI front end that installs on macOS. Nov 27, 2017 at 20:53
-
I had to add \mainpage to get README.md to be recognized as the mainpage– JBaczukFeb 2, 2018 at 1:15