Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In reStructuredText, how do I use emphasis and superscript at the same time?

The following piece of reStructuredText does not give the result I expect.

*:sup:`superscript`*

Expected result: superscript

Actual result: :sup:`superscript`

The reason why it is happening is clear (reST text roles cannot be nested), however how can I obtain the expected result?

like image 761
Andrea Corbellini Avatar asked Dec 18 '12 19:12

Andrea Corbellini


People also ask

How do I add a new line to an RST file?

To get a new line immediately following a few long lines I have to a) start a new (empty) line and b) THEN (on the next line) follow it with | <my new line> .

How do I comment in RST file?

For comments, add 2 periods .. followed by a newline and then your comment indented.


2 Answers

You can use substitution:

The chemical formula for pure water is |H2O|.

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

See the reStructuredText spec for further information on character-level markup and the substitution mechanism.

like image 132
Brent Avatar answered Sep 29 '22 16:09

Brent


As specified in a FAQ, this is not currently possible without using the raw directive or without using a custom, ad-hoc directive.

like image 37
Andrea Corbellini Avatar answered Sep 29 '22 18:09

Andrea Corbellini