Sphinx: generating an external link

Anton Arhipov picture Anton Arhipov · Jun 19, 2013 · Viewed 18.9k times · Source

I'd like to link to some URL in my sphinx docs:

 <a href="http://some.url">blah</a>

I have found something similar in the docs: http://sphinx-doc.org/ext/extlinks.html - but it is rather about replacing the custom syntax with the link, by convention. Instead, I just want to generate a link to external web resource.

Answer

Anton Arhipov picture Anton Arhipov · Jun 19, 2013

Found the answer in the reStructuredText documentation. It can be done either with a named reference:

Test hyperlink: SO_.

.. _SO: http://stackoverflow.com/

Or with an embedded URI:

Test hyperlink: `Stack Overflow <http://stackoverflow.com/>`_.