Question

In reStructuredText, how can one achieve a numbered list of elements with non trivial entries?

Example:

1. foo
2. bar
   *code block*
3. waldo
   *image*
Was it helpful?

Solution

Make sure you indent the blocks inside the list items properly, and that you prepend and follow them with a blank line.

For example, this...

1. This is the first item
2. Enumerators are arabic numbers,
   single letters, or roman numerals

   block::

       pass
       print foo

3. List items should be sequentially
   numbered, but need not start at 1
   (although not all formatters will
   honour the first index).

   .. image:: http://docutils.sourceforge.net/rst.png
      :height: 49 px
      :width: 526 px

#. This item is auto-enumerated

...should render like this:

enter image description here

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top