Skip to content Skip to sidebar Skip to footer

Sphinx Substitution With A Container

How can I substitute a container directive ? The following doesn't work: .. |sub| container:: Some text here .. image:: img/some_image.png Some other text here The

Solution 1:

This is not possible. ReST substitutions apply to inline text (single paragraphs), but a container is a block element.

And if you try

.. |sub| replace:: container::

    Some text here

    .. image:: img/some_image.png

    Some other text here

you will get

ERROR:Errorin"replace" directive: may contain a single paragraph only.

You could work around this by putting the container in a separate file and pull it in to the master file using .. include::.

Post a Comment for "Sphinx Substitution With A Container"