Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to include space in a hyperlink target using reStructuredText?

I can do this:

For more info, see Target_.

.. _Target: http://google.com

This correctly generates documentation that links Target to "http://google.com".

I want to replace Target with text that has spaces:

For more info, see Text With Space_.

.. _Text With Space: http://google.com

The above example generates documentation that incorrectly links "Space" to an unknown location. I want it to link "Text With Space" to "http://google.com".

How can I achieve this?

like image 572
mpenkov Avatar asked Jan 03 '18 03:01

mpenkov


2 Answers

From the Sphinx documentation for Hyperlinks, External links.

Use Link text <http://example.com/>_ for inline web links.

You can also separate the link and the target definition (ref), like this:

This is a paragraph that contains `a link`_.

.. _a link: http://example.com/
like image 71
Steve Piercy Avatar answered Sep 17 '22 16:09

Steve Piercy


You can do this:

.. |Target| replace:: Text With Space
.. _Target: http://google.com

For more info, see |Target|_
like image 20
asrjarratt Avatar answered Sep 19 '22 16:09

asrjarratt