Internal hyperlink in restructured text with custom text

I know how to create an external hyperlink with customized text.

`My cool link <http://www.asdf.com>`_ 

But I want to link to an internal link.

 .. _foo: Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. 

So, I would like to do something like

 `My cool internal link <foo>`_ 

But that will not work.

+5
source share
3 answers

Decision:

 `My cool internal link <foo_>`_ 
+4
source

Use 2 underscores for text and 1 undescore for links, for example:

 `My cool internal link <foo_>`__ ... somewhere lower ... .. _foo: This staff is referenced by "My cool internal link" 

When I use one underscore instead of 2, rst2pdf throws an error.

+2
source

If John's solution does not work for you:

 `My cool internal link<foo>` 
0
source

Source: https://habr.com/ru/post/1246841/


All Articles