A beginner’s guide to reStructuredText

This is a quick reference for reStructuredText (reST). It covers some of the most commonly used features. The following resources are much more comprehensive and come straight from the authoritive reST sources:

If you are using Vim, you may want to look at .vimrc configurgation to make writing documentation easier.

Sections

When creating a new section, make sure that the underline (and overline if necessary) have the same number of characters as the section title.

==============
Section Header
==============

Section
=======

Subsection
----------

Subsubsection
^^^^^^^^^^^^^

Paragraphs are generated by one or more blank lines. All lines of the
paragraph must have the same level of indentation.

Lists

* This is an unorderded (bulleted) list.
* It has two items, the second item spans
  multiple lines and has to be appropriately indented.

#. This is a numbered list of two items.
#. The numbers are automatically generated.

Styling

*emphasis (italics)*
**emphasis (boldface)**
``code``

Code blocks

Code blocks are formed the following way:

::

    This text will appear in a code block.
    This inner text must be indented and seperated by a newline.

Admonitions

See also

this is a test of the seealso directive

Note

this is a test of the note directive

Warning

this is a test of the warning directive

These can be generated with the following code:

.. seealso:: this is a test of the **seealso** directive
.. note:: this is a test of the **note** directive
.. warning:: this is a test of the **warning** directive

.vimrc configurgation

If you use Vim as your text editor, edit your .vimrc to include the following macros for quickly making section headings.:

" reStructuredText files
au BufRead,BufNewFile *.rst set textwidth=80
let @h='yypVr=yykP'   " makes a section header (with overline)
let @o='yypVr='       " makes a section heading
let @i='yypVr-'       " makes a subsection heading
let @u='yypVr^'       " makes a subsubsection heading
let @f='gq}'          " format until next paragraph, fixes column widths

Project Versions

Table Of Contents

Previous topic

Coding Conventions

Next topic

Help out with non-coding tasks

This Page