Sphinx 文档中的条件输出
我正在使用 Sphinx 编写一些文档,并且我只想打印特定的文本块适用于 HTML 文档,不适用于 LaTeX 文档。有些东西告诉我我应该能够使用 sphinx.ext.ifconfig 来做到这一点,但我不知道如何做。有谁知道该怎么做?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
无需延期。只需使用
only
指令即可。(旧链接,来自 2010 年原始帖子)
https://web.archive.org/web/20100129001557/http://sphinx.pocoo.org/markup/misc.html#include-content-based-on-tags
(最新链接)< br>
https:// www.sphinx-doc.org/en/master/usage/restructivetext/directives.html#include-content-based-on-tags
它的工作原理如下:
No extension is required. Just use the
only
directive.(old link, from original 2010 post)
https://web.archive.org/web/20100129001557/http://sphinx.pocoo.org/markup/misc.html#including-content-based-on-tags
(latest link)
https://www.sphinx-doc.org/en/master/usage/restructuredtext/directives.html#including-content-based-on-tags
It works like this: