Module_art
Module_art

Reputation: 1068

How to add a html tag in sphinx?

In Doxygen you can add a html tag inside docstrings as follow

"""!    
x<sub>1</sub>,
"""

It will generate following
defines subscript text

the stylesheet for it

sub {
  vertical-align: sub;
  font-size: smaller;
}

Is that possible to do in Sphinx? If so, how? It don't need to be in a docstring it can be anywhere in rst file.

What I tried so far in my rst file

x<sub>1</sub>,
.. x<sub>1</sub>,

without success

I tried to escape tag

x/<sub>1/</sub>,

again without success

I'm sure I missed something here.

Upvotes: 1

Views: 693

Answers (1)

Steve Piercy
Steve Piercy

Reputation: 15045

Use the :subscript: role:

H\ :sub:`2`\ O

or

The chemical formula for pure water is |H2O|.

.. |H2O| replace:: H\ :sub:`2`\ O

You could also use :raw:, but heed its warnings.

Upvotes: 3

Related Questions