Starting a project

Creating the documentation project

A doxphinx documentation project is a Sphinx project configured and used in a specific way. Before using doxphinx to build the actual documentation, a Sphinx project is needed. If you do not have already a documentation Sphinx project available or you are starting a new one, first create a Sphinx project as explained below.


The configuration process of the Sphinx project detailed below will follow a set of conventions that will make the Sphinx project a doxphinx documentation project.

Creating a Sphinx project

A Sphinx project consists of a top folder or directory plus a set of files inside including your actual documentation text files.

Create a directory

Create a new folder or directory where all the files related to this documentation project will be stored.


In the following instructions replace my-project.dox with a proper name for your actual project. You can use whatever name you want for the folder but the convention for a doxphinx project is to end the folder name with .dox

$ mkdir my-project.dox

Initialize the directory

Enter into the new documentation directory and run there the Sphinx command sphinx-quickstart to initialize this directory as a Sphinx project.

$ cd my-project.dox

$ sphinx-quickstart
Welcome to the Sphinx 1.8.3 quickstart utility.

Please enter values for the following settings (just press Enter to
accept a default value, if one is given in brackets).

Selected root path: .


The steps shown below correspond to the sphinx-quickstart command provided with Sphinx 1.8.5. In recent version 2.0, these steps have changed and simplified a lot, so not every one of these questions will be asked.

Sphinx will ask a set of questions in order to configure the documentation project.


By pressing <RETURN> repeteadly you can accept all the default answers, which is a good way to start using Sphinx. To learn more about the options to configure a Sphinx project, see Getting Started in the Sphinx documentation site.

However, in order to create a doxphinx project reply instead with the answers detailed below.

Separated source and build directories
You have two options for placing the build directory for Sphinx output.
Either, you use a directory "_build" within the root path, or you separate
"source" and "build" directories within the root path.
> Separate source and build directories (y/n) [n]

Answer y to create two different subdirectories. The source folder will contain all the documentation files and the build folder is where Sphinx will generate the HTML or PDF files for the final documentation.

Prefix for the _static and _templates directories
Inside the root directory, two more directories will be created; "_templates"
for custom HTML templates and "_static" for custom stylesheets and other static
files. You can enter another prefix (such as ".") to replace the underscore.
> Name prefix for templates and static dir [_]:

Hit <ENTER> or answer _. The _static folder will contain additional files, for example the logo image. And the _templates directory will be used to override the default HTML templates of both Sphinx and the doxphinx theme for your own purposes, for example to set Google Analytics scripts.

Name of the project, author, etc.
The project name will occur in several places in the built documentation.
> Project name: my-project
> Author name(s): Alan Turing
> Project release []: 3.1.4

In these entries, give a name for the project, the author’s name and a release number. All these values can be changed later in the file.

Language for internally generated strings
If the documents are to be written in a language other than English,
you can select a language here by its language code. Sphinx will then
translate text that it generates into that language.

For a list of supported codes, see
> Project language [en]:

Hit <ENTER> or answer en. This value is used to set the internal literals and messages that Sphinx uses when creating the final documentation files. This value can also be changed later.

Extension for the documentation files
The file name suffix for source files. Commonly, this is either ".txt"
or ".rst".  Only files with this suffix are considered documents.
> Source file suffix [.rst]:

Leave the suffix or extension for the source documentation files to .rst to mark them as reStructuredText files.

Master documentation file
One document is special in that it is considered the top node of the
"contents tree", that is, it is the root of the hierarchical structure
of the documents. Normally, this is "index", but if your "index"
document is a custom template, you can also set this to another filename.
> Name of your master document (without suffix) [index]:

Also, leave the name for the main file in the source documentation files to index. The actual, complete name of the master document will be index.rst

Sphinx extensions
Indicate which of the following Sphinx extensions should be enabled:
> autodoc: automatically insert docstrings from modules (y/n) [n]:
> doctest: automatically test code snippets in doctest blocks (y/n) [n]:
> intersphinx: link between Sphinx documentation of different projects (y/n) [n]:
> todo: write "todo" entries that can be shown or hidden on build (y/n) [n]:
> coverage: checks for documentation coverage (y/n) [n]:
> imgmath: include math, rendered as PNG or SVG images (y/n) [n]:
> mathjax: include math, rendered in the browser by MathJax (y/n) [n]:
> ifconfig: conditional inclusion of content based on config values (y/n) [n]: y
> viewcode: include links to the source code of documented Python objects (y/n) [n]:
> githubpages: create .nojekyll file to publish the document on GitHub pages (y/n) [n]:

You can answer n to all questions, unless you know that you need a specific extension for the project to document. However, answer y for the ifconfig extension. These are extensions provided by the Sphinx tool; in the next section you will add the doxphinx extensions.

A Makefile and a Windows command file can be generated for you so that you
only have to run e.g. `make html' instead of invoking sphinx-build
> Create Makefile? (y/n) [y]:
> Create Windows command file? (y/n) [y]: n

Answer y to the first question in order to create a Makefile to be able to generate the final documentation files from the source files. For a Windows system, answer y to the second question.

After these questions are answered, Sphinx creates a Makefile, the project configuration file and an example first source file index.rst to modify.

Creating file ./source/
Creating file ./source/index.rst.
Creating file ./Makefile.

Finished: An initial directory structure has been created.

You should now populate your master file ./source/index.rst and create other documentation
source files. Use the Makefile to build the docs, like so:
   make builder
where "builder" is one of the supported builders, e.g. html, latex or linkcheck.

Testing the project

Sphinx has created a preconfigured file, as well as an example index.rst file. At this point it should be possible to build the documentation for this example project.

To test the documentation in HTML format, run:

$ make html

and a full HTML website will be generated in the subdirectoty build/html. Open the file index.html in that folder using a web browser to see the result. Try, for example, if firefox is installed in your system:

$ firefox build/html/index.html

To test the built PDF documentation, issue:

$ make latexpdf

and a PDF file (in this example, my-project.pdf) will be generated in the subdirectoty build/latex. Open the file with a PDF reader to see the generated documentation. Try, for example, if mupdf is installed in your system:

$ mupdf build/latext/my-project.pdf


At this point Sphinx is still using the default theme to format the ouptut documentation. In the next chapter you will link the doxphinx theme and extensions to your documentation project.