Sphinx and Myst Syntax to write the documentation#

Introduction to the Sphinx documentation system#

Sphinx is the official documentation system used by the Python community (and far behond). It was originally designed for the RestructuredText markup language, which it has expanded on. Since then, Markdown has become the de facto standard to write technical documentation.

Luckily, the people around the Jupyter Project have started a new ecosystem of tools allowing the write Sphinx documentation with an extended version of Markdown called MyST Markdown. This page gives a little bit of context around the Myst toolchain.

Since RestructuredTest is “the mother tongue” of the Sphinx documentation, the reference documentation is still written with this language in mind.

Sphinx official documentation

The Sphinx official documentation can be found under https://www.sphinx-doc.org/en/master/.

Advantages of writing the documentation with Sphinx#

One advantage of writing the documentation with Sphinx and Markdown is that Sphinx can easily generate a static HTML site with the whole content and a LaTeX version for paper. It is possible to write some custom part specifically targetted for the online version and other parts for the written part.

It can therefore allow a “Documentation first” writing of a thesis that could follow steps like

  1. Write the documentation for the project

  2. Convert the relevant parts to LaTeX and include it in the thesis right away.

General introduction using the RST language#

The following video gives a general introduction to the Sphinx documentation system. The first part is presentation and not relevant.

Introduction to using Sphinx with Myst/Markdown syntax#

The following video gives an introduction to using Sphinx with MyST/Markdown.

Documentation and reference material for MyST#

The MyST markdown is an extension of the Markdown to make it on paar with RestructuredText, allowing to use Sphinx roles and directives and to be powerful enough to write a book or a thesis with cross-references, bibliography, figures and a lot more.

Official MyST documentation#

Other good references and tutorials#

Courses about Sphinx#

Static sites with Sphinx and Markdown

The following free course shows how to write good documentation using the Sphinx and MyST/Markdown combination : https://training.talkpython.fm/courses/static-sites-with-sphinx-and-markdown

Various tools#

Extensions#

The following extensions could be very useful to write the documentation efficiently.

Special extensions#

Could be useful for click-based CLI program#

VSCode extension#

Essentially Sphinx snippets to speed up writing in VSCode.