AqNWB uses Doxygen with Graphviz for documentation. The cmake related instructions on this page follow the Developer Presets installation instructions using the dev preset.
To create a new page as part of the For Users docs, simply create a new .dox file in the docs/pages/userdocs folder, e.g.:
and add a corresponding - \subpage mypage entry to the page listing of the docs/pages/1_userdocs.dox file. Note, the subpage command uses the label of the page (here mypage) and not the name of the file.
Similarly, we can add pages to the For Developers docs by adding a new .dox file to the docs/pages/devdocs and including it as as subpage in docs/pages/2_devdocs.dox.
Code examples are defined as part of the unit tests to ensure code examples used in the documentation are tested and work as expected.
First we need to define our code example by creating a new cpp file in the tests/examples folder. Here we use the file test_examples.cpp shown below. The file looks like a regular unit test with the addition of Doxygen comments of the form // [example_hdf5io_code_snippet] to mark regions in the code that we want to include in the docs as code snippets.
To make sure our example code builds and runs correctly, we add it to the unit test suite.
See the Testing 🛡️ section for more details about how to build and run the test suite.
To display a code snippet from our example in the documentation we can use the \snippet <file> <label> Doxygen command in our *.dox documentation file. For example to just show the line where we create the HDF5IO object we use:
which displays as follows in the docs:
To add a heading to a code snippet we can use \par command, e.g., \par test_example.cpp to indicate the filename.
AqNWB uses Graphviz to improve the quality of the UML diagrams generated by Doxygen. With this, we can also generate custom figures using dot, simply by including the corresponding dot code directly in the doxygen file. For example:
to create this figure: