Tech writer at work blog.

Living and writing documentation at Documatt, small team of programmers that write documentation too.

Literal block expected; none found

Symptoms

Sphinx build failed with the error similar to:

WARNING: Literal block expected; none found.

Reasons

Literal block (after ::), usually used for showing code examples and typically rendered in a monospaced font, needs be intended. The warning above means you forgot to intend it.

Example

Literal lock expected; none found::

installation/
theming/
conf.py
index.rst
second.rst
third.rst

Or, more easy to forgot literal block indentation is in list item. Step two do not contain literal block because isn't indented.

#. Step one.

#. Step two::

   import logger
   logger.info("hello world")

#. Step three.

Solution

Literal lock expected; none found::

    installation/
    theming/
    conf.py
    index.rst
    second.rst
    third.rst

#. Step one.

#. Step two::

       import logger
       logger.info("hello world")

#. Step three.