Generate Docs using Sphinx

Lingling Yang
1 min readJan 23, 2020

--

Sphinx is a tool for creating documentation under the BSD license. Official Guideline: https://www.sphinx-doc.org/en/master/index.html.

  1. Install Sphinx
  • Conda install
$ conda install -c anaconda sphinx
  • Ubuntu
$ apt-get install python3-sphinx

2. Quick Start

The root directory of a Sphinx collection of reStructuredText document sources is called the source directory. This directory also contains the Sphinx configuration file conf.py, where you can configure all aspects of how Sphinx reads your sources and builds your documentation.( https://www.sphinx-doc.org/en/master/usage/quickstart.html)

  • Script: sphinx-quickstart sets up a source directory and creates template files including a default conf.py. It also creates an empty build directory.
$ sphinx-quickstart

3. Running the Build

Two methods can be used to build the code and generate the documentations such as html files.

  • Using the sphinx-build program
$ sphinx-build -b html sourcedir builddir

where sourcedir is the source directory, and builddir is the directory in which you want to place the built documentation. The -b option selects a builder, here building HTML files.

  • Using Make
$ make html$ make pdf

if there are a Makefile and a make.bat which can be created by the sphinx-quickstart program.

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

No responses yet

Write a response