【问题标题】:Conditional output in Sphinx DocumentationSphinx 文档中的条件输出
【发布时间】:2011-01-14 00:05:50
【问题描述】:

我正在使用Sphinx 编写一些文档,并且我想打印出特定的文本块,仅用于 HTML 文档,而不是用于 LaTeX 文档。有些东西告诉我我应该可以用sphinx.ext.ifconfig 做到这一点,但我不知道怎么做。有谁知道怎么做?

【问题讨论】:

    标签: python python-sphinx


    【解决方案1】:

    不需要扩展。只需使用only 指令。

    (旧链接,来自 2010 年的原始帖子)
    https://web.archive.org/web/20100129001557/http://sphinx.pocoo.org/markup/misc.html#including-content-based-on-tags

    (最新链接)
    https://www.sphinx-doc.org/en/master/usage/restructuredtext/directives.html#including-content-based-on-tags

    它是这样工作的:

    .. 只有:: 乳胶 这里的东西只出现在乳胶输出中。 .. 仅:: html 此块中的内容仅出现在 HTML 输出中。它是 将此指令与它一起使用通常很有用: .. 原始:: html 它适用于嵌入内容,例如视频。

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-08-04
    • 2021-11-06
    • 1970-01-01
    • 2012-10-02
    • 1970-01-01
    相关资源
    最近更新 更多