首页 > 解决方案 > Sphinx latexpdf 忽略文件的一部分

问题描述

使用latexpdf构建pdf时是否可以让Sphinx忽略index.rst的一部分?

例如,我的 index.rst 文件包含(但不以)这些行


.. image:: https://img.shields.io/....
  :target: https://pypi.org/....

.. image::  https://travis-ci.org/....
  :target: https://travis-ci.org/...

.. image:: https://coveralls.io/repos/github/....
  :target: https://coveralls.io/github/....

.. image::  https://readthedocs.org/.....
  :target: https://libensemble.readthedocs.org/....

这些应该出现在构建的 html 中,而不是 PDF 中。我在这里什么都没看到: https ://www.sphinx-doc.org/en/master/latex.html

是否可以告诉 sphinx 忽略这些行?

标签: latexpython-sphinxrestructuredtext

解决方案


我认为您只能使用指令

  • index.rst
 .. only:: html

     .. image::  https://readthedocs.org/.....
     :target: https://libensemble.readthedocs.org/....
  • Makefile
 htmldoc:

    make -e SPHINXOPTS="-t html" html

推荐阅读