Sphinx文档中的条件输出

ast*_*rog 21 python documentation python-sphinx

我正在为Sphinx编写一些文档,我想打印出一些仅用于HTML文档的文本块,而不是用于LaTeX文档.有些东西告诉我,我应该能够做到这一点,sphinx.ext.ifconfig但我无法弄清楚如何.有谁知道如何做到这一点?

ddb*_*eck 27

无需延期.只需使用唯一的指令.它的工作原理如下:

.. 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.