This document covers our documentation process for component.
In short, to generate HTML files, run:
makeWhen header files are updated, be sure to run clean target.
make clean all- Requirements
- Files and Directories
Makefiletargets- Writing documentation
- Deploying the documentation
Install the following software.
sphinx is used because the default HTML files generated by doxygen looks
not so human-friendly.
breathe and sphinx_rtd_theme are extensions of sphinx.
index.rstThe top page of the documentationconf.pyConfiguration file forsphinx(andbreathe)doxygen.confConfiguration file fordoxygenMakefileGNU Makefile to automate HTML generationdoxygen.logLog file ofdoxygen(can be safely removed)_docs/xmlOutput directory fordoxygen(can be safely removed)_build/htmlOutput directory forsphinx(can be safely removed)
Makefile has a few targets to build the documentation. The most notable ones
are:
make allormakemake clean
This is the default target, which invokes html target.
make all
# or
makeThis target generates HTML files after invoking build-doxygen.
make htmlThe generated HTML files is under _build/html directory. To see the HTML
files, run:
firefox _build/html/index.htmlBy default, warnings are treated as errors. To ignore errors, probably because
the code is old and fixing it takes a long time, use SPHINX_FLAGS, which
overrides the default value.
make SPHINX_FLAGS=""There are other variables that can be overridden in Makefile, such as variables
assigned with ?=.
FOO?= barThis target parses the source code (header files only).
make build-doxygenThis targets clean up unnecessary files and directories. Be sure to run this target when header files are modified.
make cleanUpdate the HTML files.
make clean allThe overview of the documentation process is:
- Write API documentation in the code
- Write
index.rstand reference the API documentation from it bydoxygenfiledirective - Generate HTML files by
make - Verify the result and fix issues until the output is satisfactory
- Clean uo by
make clean(optional).
When writing a component, describe functions, macros, structures, among other
things, in the code. Read how to document APIs at:
Writing API Description.
The API documentation in the code is parsed by doxygen. The output of
doxygen can be later used in documentation files under this directory, such
as index.rst.
In addition to the API documentation, index.rst is where additional
information, such as usages, notes, and warnings are documented.
Read Basic Syntax at ESP-Docs User Guide for general formatting rules.
To include the automatically generated API documentation, doxygenfile
(the documentation)
is the directive to generate the appropriate output for the contents of a
source file. If the component has just a single header file, filename.h for
instance, this is what you need in index.rst.
Welcome to Foo's documentation!
===============================
.. doxygenfile:: filename.hBy default, the documentation is published on GitHub Pages when the component
has been released. See publish-gh-pages.yml
and build-docs.yml at
esp-idf-lib/shared-workflows.