Reputation: 11110
Using Sphinx, how can I make a substitution depending on the output-format?
Basically, I would like to have something like
if html:
|CLICK| unicode:: U+21E8
elif latex:
|CLICK| raw:: latex
$\LongRightArrow$
but I cannot seem to get the syntax right.
Upvotes: 5
Views: 712
Reputation: 3659
Use the .. only::
directive instead. While it is normally used with flags (or tags as sphinx puts it), the output format is made available as a tag as well:
.. only:: html
.. raw:: html
<a href="http://www.google.com">google</a>
.. only:: latex
latex specific
Official documentation: https://www.sphinx-doc.org/en/master/usage/restructuredtext/directives.html#including-content-based-on-tags
Upvotes: 4