pythonpython-sphinxrestructuredtextcross-reference

Link a Sphinx substitution


I have a Sphinx project, with some substitutions. I have a variable |total_downloads| (which works fine) on which I want to link some section statistics. I tried the following two pieces of code:

:ref:`|total_downloads| <statistics>`

and

:ref:`\ |total_downloads|\  <statistics>`

which both create correctly correctly the link, but display |total_downloads| instead of the content of the variable.

Is there any way to solve this issue? Thank you for your help!


Solution

  • The correct answer is in the comment, as @StevePiercy says, restructuredtext does not support anything other than plain text inside its links.

    My advice would be to change it to say something like "1234 downloads (see full statistics <statistics>_)" so that both the information, and the link to the supporting section, are both clear.