Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In reStructuredText, how to put an inline literal inside of a hyperlink?

In my reStructuredText document, I have a section defined like so:

Update the ``PATH`` Environment Variable
----------------------------------------

I would like to link to this section like so:

* `Update the ``PATH`` Environment Variable`_

But, when this code is rendered to HTML, it comes out looking like this:

  • Update the ``PATH` Environment Variable`

I'd really like the environment variable PATH to appear in the literal style, but I am pretty new to this. Can anyone help me out?

like image 748
davidrmcharles Avatar asked Dec 29 '15 17:12

davidrmcharles


People also ask

How do I comment a line in an RST file?

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

How do you use a sphinx code block?

Literal code blocks (ref) are introduced by ending a paragraph with the special marker :: . The literal block must be indented (and, like all paragraphs, separated from the surrounding ones by blank lines): This is a normal text paragraph.


1 Answers

With a workaround, yes -- it is possible (hinted from @mzjn's comment).

For example:

.. |dummy| replace:: Update the ``PATH`` Environment Variable
.. _dummy:

Update the ``PATH`` Environment Variable
----------------------------------------

* |dummy|_

This is achieved by taking advantage of the replace directive.

like image 100
jdknight Avatar answered Oct 18 '22 19:10

jdknight