Search code examples
restructuredtext

reStructuredText link to section with custom text


I'm aware of the documentation regarding implicit hyperlinks in the reStructuredText manual, but I'm wondering if it is possible to reference a section without having to repeat the full section title. E.g. if I take the example from the documentation,

Titles are targets, too 
======================= 
Implict references, like `Titles are targets, too`_.

then I'd like to have a way to refer to the section by using a different link name (e.g `the target section`_). How can I do that?


Solution

  • You can refer to a section titled Titles are targets, too with:

    `link text <Titles are targets, too_>`_
    

    This creates a link whose text is link text but points to the section titled Titles are targets, too.