Question

I'm writing some documentation with Sphinx and I'd like to print out a certain block of text only for HTML documentation, not for LaTeX documentation. Something tells me I should be able to do this with sphinx.ext.ifconfig but I can't figure out how. Does anyone know how to do this?

Was it helpful?

Solution

No extension is required. Just use the only directive. It works like this:

.. only:: latex

    The stuff in here only appears in the latex output.

.. only:: html

    The stuff in this block only appears in the HTML output. It's
    often useful to use this directive with it:

    .. raw:: html

        It's good for embedding stuff, like video.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top