Search code examples
pythondocumentationrestructuredtext

Source Code in Bullet Lists with reStructuredText


I am trying to include source code in bullet lists with reStructuredText; like this:

- List item 1 ::

  code sample...
  code sample...

- List item 2 ::

  code sample...
  code sample...

However, I get the following warning: System Message: WARNING/2 Literal block expected; none found.

The empty lines in the list are indented by a single space. Any ideas?


Solution

  • You haven't indented enough. Think of it this way.

    - List item 1 
      ::
    
          code sample...
          code sample...
    
    - List item 2 
      ::
    
          code sample...
          code sample...