jmlarson
jmlarson

Reputation: 978

Sphinx latexpdf ignore parts of a file

Is it possible to have Sphinx ignore part of index.rst when building the pdf with latexpdf?

For example, my index.rst file contains (but does not begin with) the lines


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

These should appear in the html that is built, but not in the PDF. I didn't see anything here: https://www.sphinx-doc.org/en/master/latex.html

Is it possible to tell sphinx to ignore these lines?

Upvotes: 4

Views: 639

Answers (1)

aflp91
aflp91

Reputation: 673

I think you could use only directive:

  • in index.rst
 .. only:: html

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

    make -e SPHINXOPTS="-t html" html

Upvotes: 4

Related Questions