10  reStructuredText and Python Documentation

Guiding Question: How can plain text become an entire documentation system?

Software is written for computers.

Documentation is written for people.

Yet throughout the history of computing, documentation has often been treated as an afterthought. Programs evolved, features multiplied, and code improved, while manuals quickly became outdated or were never written at all.

The open-source movement helped change this culture.

As software projects grew larger and attracted contributors from around the world, good documentation became just as important as good programming.

Developers needed a way to write manuals, tutorials, reference guides, and API documentation using the same principles that had already proven successful in programming: plain text, version control, collaboration, and automation.

One of the most influential answers to that need was reStructuredText, commonly abbreviated as reST or RST.

10.1 What Is reStructuredText?

reStructuredText is a lightweight markup language designed primarily for technical documentation.

Created by the Python community, it emphasizes clarity, consistency, and semantic structure while remaining readable as plain text.

Like Markdown, a reStructuredText document can be opened in any text editor.

Unlike a traditional word processor, the source document contains only text and lightweight markup.

The result is a document that is easy to edit, search, compare, and maintain.

10.2 A Language Designed for Documentation

Every markup language reflects the priorities of the community that created it.

HTML focused on hypertext.

XML emphasized structured information.

LaTeX pursued typographic excellence.

reStructuredText focused on documentation.

Its syntax was designed to express the kinds of structures commonly found in technical manuals:

  • headings
  • code examples
  • notes
  • warnings
  • references
  • tables
  • hyperlinks
  • indexes
  • cross-references

Rather than forcing authors to invent their own conventions, reStructuredText provides a rich vocabulary for technical communication.

10.3 Readable Even Before Rendering

One of the design goals of reStructuredText is that documents should remain readable in their source form.

For example, a heading might appear as:

Introduction
============

A bullet list remains an ordinary bullet list.

Code examples appear exactly as code should appear.

Even without rendering the document into HTML or PDF, the structure remains understandable.

This quality reflects one of the recurring themes of this primer:

The source itself should be pleasant to read.

10.4 The Python Connection

reStructuredText became closely associated with the Python programming language.

Much of Python’s official documentation is written using reStructuredText.

Countless Python libraries also rely upon it.

This close relationship encouraged a culture in which documentation became an expected part of software development rather than an optional extra.

For many Python programmers, writing documentation became almost as natural as writing code.

10.5 Sphinx: From Documents to Publishing

The true power of reStructuredText became evident with the arrival of Sphinx.

Originally developed to build Python’s own documentation, Sphinx transformed collections of plain text files into professional documentation websites.

From a single source, Sphinx can generate:

  • HTML websites
  • PDF documents
  • EPUB ebooks
  • searchable documentation
  • indexes
  • cross-references

Large documentation projects containing hundreds or even thousands of pages became manageable through automation.

For many developers, Sphinx demonstrated that documentation could be treated as a publishing project rather than a collection of disconnected text files.

10.6 Documentation as Source Code

One of the ideas popularized by reStructuredText and Sphinx is that documentation deserves the same care as software itself.

Documentation can be:

  • version controlled
  • reviewed
  • tested
  • automatically published
  • collaboratively edited

This philosophy aligns naturally with modern software development practices.

Documentation evolves alongside the code instead of being written months later.

The result is more accurate, more maintainable, and more useful.

10.7 Rich Semantic Features

Although reStructuredText is often described as a lightweight markup language, it offers sophisticated capabilities.

Authors can create:

  • internal references
  • footnotes
  • citations
  • glossaries
  • directives
  • substitutions
  • indexes
  • admonitions such as notes, warnings, and tips

These features make reStructuredText particularly well suited to large technical manuals where precise organization matters.

10.8 reStructuredText and Markdown

Readers often compare reStructuredText with Markdown.

The comparison is understandable.

Both are lightweight markup languages.

Both are plain text.

Both generate multiple output formats.

Yet they emphasize different priorities.

Markdown values simplicity and minimal syntax.

reStructuredText values expressive documentation.

Its richer feature set sometimes results in a steeper learning curve, but it also enables authors to describe more complex technical documents without relying heavily on extensions.

Neither language is universally superior.

Each reflects the needs of the community that shaped it.

10.9 The Legacy of reStructuredText

Although Markdown has become the most widely recognized lightweight markup language, reStructuredText continues to occupy an important place in technical publishing.

Many Python projects still rely upon it.

Numerous documentation systems continue to build upon its capabilities.

More importantly, it helped establish an important principle:

Documentation is not merely supplementary material.

It is an essential component of software itself.

10.10 Lessons for the Textsmith

reStructuredText reminds us that good documentation is an act of craftsmanship.

Programs may solve problems.

Documentation enables people to understand those solutions.

By expressing documentation as structured plain text, reStructuredText allows manuals to benefit from the same qualities that make source code successful:

clarity,

maintainability,

version control,

automation,

and long-term preservation.

In doing so, it helped transform technical documentation into a first-class publishing discipline.

10.11 Key Ideas

  • reStructuredText is a lightweight markup language designed for technical documentation.
  • It emphasizes semantic structure rather than visual formatting.
  • Its source documents remain readable even before rendering.
  • The Python community adopted reStructuredText as a major documentation standard.
  • Sphinx transformed reStructuredText into a powerful publishing system capable of generating multiple output formats.
  • Documentation benefits from the same text-first workflows as software development.
  • reStructuredText demonstrates that carefully structured plain text can support documentation projects of remarkable scale and sophistication.

In the next chapter, we explore another documentation language that took a different path.

How can technical documentation scale from a single manual to an entire enterprise?

That question leads us to AsciiDoc, a markup language designed to bridge the gap between simplicity and professional publishing.