Sphinx error: Literal block expected; none found#
Did you Sphinx documentation project has failed with the error Literal block expected; none found? This guide provides an explanation and solution to resolve the issue.
Symptom#
Sphinx build failed with the error similar to:
WARNING: Literal block expected; none found.
Worry-free Sphinx?
Documatt app is a Sphinx-based tool which hides its complexity with free hosting for your books and docs.
Reason#
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.