Preformatted (verbatim) hyperlink in Sphinx-reST-RTD
Asked Answered
V

1

1

I am building documentation with Sphinx-RTD.

I want to have a link somewhere, and be styled as a verbatim or preformatted text.

For example, say I have this verbatim:

ALTER TABLE

Is there a way to link it somewhere, say a :ref:... or even just a standard hyperlink?

Vociferance answered 23/11, 2019 at 10:40 Comment(0)
S
4

If I am not mistaken the "Replacement Text" directive can help.

As reStructuredText doesn't support nested inline markup, the only way to create a reference with styled text is to use substitutions with the "replace" directive:

I recommend you try |Python|_.

.. |Python| replace:: Python, *the* best language around
.. _Python: http://www.python.org/

So maybe something like this:

Click |altertable|_ to read details about |altertable|.

----

Blah blah blah

----

.. _altertable:

Here are the details about |altertable|: blah blah blah.

.. |altertable| replace:: ``ALTER TABLE``
Sacral answered 23/11, 2019 at 12:9 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.