문제

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*
도움이 되었습니까?

해결책

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top