使用reStructuredText编号的图像和代码列表

时间:2014-05-01 20:24:03

标签: python restructuredtext

在reStructuredText中,如何实现具有非平凡条目的编号元素列表?

示例:

1. foo
2. bar
   *code block*
3. waldo
   *image*

1 个答案:

答案 0 :(得分:2)

确保正确缩进列表项内的块,并使用空白行预先添加并跟踪它们。

例如,这......

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

......应该像这样呈现:

enter image description here