Forrest logo
back to the sphinx-build tool

sphinx-build:tldr:ee133

sphinx-build: Build documentation.
$ sphinx-build -b ${select} ${path-to-source_dir} ${path-to-build_dir}
try on your machine

The sphinx-build command is used to build documentation from source files using Sphinx, a documentation generator tool.

The command syntax is as follows:

sphinx-build -b <builder> <path-to-source_dir> <path-to-build_dir>
  • -b: This option is used to specify the builder to use for the documentation. The <builder> argument represents the name of the builder to use. Builders are responsible for transforming the source files into the desired output format, such as HTML, PDF, or EPUB.

  • ${select}: This placeholder represents a value that should be substituted with the name of the desired builder. For example, if you want to build HTML documentation, this placeholder should be replaced with "html".

  • ${path-to-source_dir}: This placeholder should be replaced with the path to the directory containing the source files of your documentation. Sphinx will recursively search for source files within this directory, generally in reStructuredText format with a ".rst" extension.

  • ${path-to-build_dir}: This placeholder should be replaced with the path to the directory where the built documentation should be generated. Sphinx will output the generated HTML, PDF, or other format files to this directory.

For example, to build HTML documentation from source files located in the "docs/source" directory and generate the output in the "docs/build/html" directory, you would run the following command:

sphinx-build -b html docs/source docs/build/html

This command would use the HTML builder to generate HTML documentation from the source files in "docs/source" and store the output in "docs/build/html".

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the sphinx-build tool