This is the project documentation for the Apache Mynewt project. It is built using Sphinx.
Each component of Mynewt contains its own specific documentation in its repo under docs. At
build time these are combined to create the full document set for publication.
The Apache Mynewt source code also contains inline comments in Doxygen format to document its APIs.
Embedding Doxygen generated source documentation is through the Breathe
bridge. This bridge embeds source
documentation using Sphinx‘s C domain.
For example:
.. doxygenfile:: full/include/console/console.h
Documents can then refer to code elements using the C domain syntax.
For example: :c:func:`console_read()` or :c:data:`console_input`.
Linking to other files should be relative for ease of deployment and multi-version
support. For example :doc: `../../newt/install/newt_mac`.
Preview Changes
make clean && make docs && (cd _build/html && python -m SimpleHTTPServer 8080)
Setup (macOS)
Note: This build toolchain is known to work on macOS 10.11.
cd mynewt-documentation/versions/vX_Y_Z/mynewt-documentation
make clean && make docs && (cd _build/html && python -m SimpleHTTPServer 8080)
Generating PDF File
Apply the Workaround
Due to a potential issue with Sphinx’s PDF builder, there is an additional step
that needs to be performed on each dependent repository before building the documentation.
The issue is related to Sphinx’s .. toctree:: directive.
The output (PDF only) renders some sections in incorrect order when there is content in index.rst
files used to chain source RST files together.
The workaround is to manually alter the affected files, so that there is no content but the
toctree directive in those index.rst files.
First, fetch the sphinx-workaround branch for one of the repositories:
Apache Mynewt Documentation
Contents
This is the project documentation for the Apache Mynewt project. It is built using Sphinx.
Each component of Mynewt contains its own specific documentation in its repo under
docs. At build time these are combined to create the full document set for publication.The Apache Mynewt source code also contains inline comments in Doxygen format to document its APIs.
Writing Documentation
Sphinx uses reStructuredText.
Embedding Doxygen generated source documentation is through the Breathe bridge. This bridge embeds source documentation using Sphinx‘s C domain. For example:
.. doxygenfile:: full/include/console/console.hDocuments can then refer to code elements using the C domain syntax. For example:
:c:func:`console_read()`or:c:data:`console_input`.Linking to other files should be relative for ease of deployment and multi-version support. For example
:doc: `../../newt/install/newt_mac`.Preview Changes
make clean && make docs && (cd _build/html && python -m SimpleHTTPServer 8080)Setup (macOS)
Note: This build toolchain is known to work on macOS 10.11.
Prerequisites
Toolchain Install
Setup (Linux)
Most Linux distributions provide necessary packages in their repositories.
Ubuntu/Debian
Fedora
Deploying the latest docs
NOTE: These instructions assume that your workspace has all the mynewt repos cloned under the same parent directory.
masterand that themasterbranch is checked out.Creating a versioned set of docs
When the
master/latestdocumentation is deemed representative of a Mynewt version, it is time to create a versioned set.Make sure all your mynewt-* repos are up to date and that all changes are merged and committed.
Add the new version to mynewt-documentation/docs/themes/mynewt/versions.html
mynewt-documentation/versions/*/mynewt-documentation/docs/themes/mynewt/versions.htmlMake a versions/vX_Y_Z directory
Copy mynewt-documentation/* (except versions!) into versions/vX_Y_Z/mynewt-documentation
Copy the mynewt-core repo into versions/vX_Y_Z/mynewt-core
Repeat for other mynewt-* repos with doxygen docs and a /docs folder
Update the version fields in
docs/conf.pyversions/vX_Y_Z/mynewt-documentation/docs/conf.pyAdd a warning that this is not the most recent documentation to:
To preview the changes:
Generating PDF File
Apply the Workaround
Due to a potential issue with Sphinx’s PDF builder, there is an additional step that needs to be performed on each dependent repository before building the documentation. The issue is related to Sphinx’s
.. toctree::directive. The output (PDF only) renders some sections in incorrect order when there is content inindex.rstfiles used to chain sourceRSTfiles together.The workaround is to manually alter the affected files, so that there is no content but the toctree directive in those
index.rstfiles.First, fetch the
sphinx-workaroundbranch for one of the repositories:Then, rebase onto the downloaded branch:
Repeat the above steps for all dependent repositories, changing the
git fetchcommand accordingly:Build the Docs
In the
mynewt-sitedirectory run:In the
mynewt-documentationrun:This will generate the PDF file (for the version set as the
latestinmkdocs.yml) in the following path:_build/latex/Mynewt.pdf