Skip to content

Sphinx Readthedocs

Sphinx and Read the docs#

What to Write#

  • Tutorials
  • Topical guides
  • Reference Material

More info:

Reasons for Documentation#

You will be using your code in 6 months#

The context in your brain can be put on paper. It is hard to know who will be maintaining that code 6 months from now.

You want people to use your code#

Have to onboard people. If there is a repo with no readme, you won’t use that project.

Makes your code better#

Thinking about how your code is going to be used and the problems you are solving are a fundamental way to build better API’s. Writing things from a user perspective is important.

You want to be a better writer#

Github issues, email, code comments and commit messages are fundamental to the job. 80% of our jobs.

Tech Overview#

  • reStructuredText - markup language similar to markdown - solving a harder / complex problem
  • docutils - python implementation of restructured texts
  • Sphinx - wrapper for documenting software using Rst - extends tool to work with software contents
  • Readthedocs - hosts sphinx projects - continuous integration for documentation


Lightweight markup language

  • base format for other formats -> creates html, pdf etc.
  • readable as plain text
  • Works well with programming tools
  • whitespace sensitive
  • powerful, but slightly awkward

Semantic HTML#


<b>issue 72</b>

HTML Good:

<span class="issue">issue 72</span>


. issue { text-format: bold; }

RST example#


<font color="red">Warning: Don't do this!</font>


<span class="warning">Don't do this!</span>


.. warning:: Don't do this

Markdown vs Rst#

Markdown does not have semantic meaning. Semantic is the meaning behind the words.

  • Markdown is just HTML, not for semantics
  • reStructuredText does more, more complex
  • reStructuredText is ugly, not only because of its complexity

Basic Sphinx Layout#

* project/
    * docs/
    * MakeFile
    * index.rst
    * tutorial.rst

How to built docs

make html


Sphinx Quickstart

  • Best documenation the owner knows
  • Search built-in - JS style
  • Multiple formats: HTML, PDF, zipper HTMl and ePub


  • Webservice for automatic documentation building for sphinx documentation
  • Always up to date
  • Different versions of docs
  • localisation
  • search via elasticsearch

RST Getting Started#

Every Sphinx document has multiple level of headings. Section headers are created by underlining the section title with a punctuation character, at least as long as the text