.. highlight:: text Cross references ================ Hyperlink text -------------- There are different ways to create a `link `_. +-----------------------------------------------+-------------------------------------------+ | :: | | | | Citation style `link 1`_. | | Citation style `link 1`_. | | | | .. _link 1: https://example.com/ | | .. _link 1: https://example.com/ | | +-----------------------------------------------+-------------------------------------------+ | :: | | | | Inline 1 `link 2 `_.| | Inline 1 `link 2 `_. | | +-----------------------------------------------+-------------------------------------------+ | :: | | | | Inline 2 ``_. | | Inline 2 ``_. | | +-----------------------------------------------+-------------------------------------------+ | :: | | | | Inline and citation combined | | Inline and citation combined | `link 3 `_. | | `link 3 `_. | | | | .. _my link: https://example.com/ | | .. _my link: https://example.com/ | | +-----------------------------------------------+-------------------------------------------+ | :: | | | | Sphinx style https://example.com/ | | Sphinx style https://example.com/ | | +-----------------------------------------------+-------------------------------------------+ Anonymous hyperlinks ******************** `Anonymous hyperlinks `_ allow to circumvent warnings due to duplicated target names. They are formed using 2 underscores (``__``) instead of one +------------------------------------------------+---------------------------------------------+ | :: | | | | `anonymous link 1 `__ | | `anonymous link 1 `__ | | +------------------------------------------------+---------------------------------------------+ | :: | | | | `anonymous target 2`__ | | `anonymous target 2`__ | | | | .. __: https://example.com/ | | .. __: https://example.com/ | | +------------------------------------------------+---------------------------------------------+ | :: | | | | `anonymous target 3`__ | | `anonymous target 3`__ | | | | __ https://example.com/ | | __ https://example.com/ | | +------------------------------------------------+---------------------------------------------+ .. note:: The order of anonymous references and target is important. The third example is a more convenient alternative for the second case. .. warning:: It is easy to abuse this feature, and it affects accessibility so use with care. Internal document references ---------------------------- Use ``.. _label name:`` plus a blank line before any text location. Then you can reference to those labels in the reST way (only works for labels within the document):: `label name`_ Example: `citation`_ Or in the Sphinx way:: :ref:`displayed text