How can I make a numbered list in reStructuredText where each item is a link to some corresponding text below? For example for use in an “FAQ” page, where the questions are listed and numbered as hyperlinks and each question’s link leads to its answer below on the page. For example:
1. question 1 [links to #1 below]
2. question 2 [links to #2 below]
3. question 3 [links to #3 below]
4. ...
#1 question 1:
the answer to question 1
#2 question 2:
the answer to question 2
#3 question 3:
the answer to question 3
In HTML this can be done with hrefs and the # symbol, but I’m wondering what is the equivalent reStructuredText syntax?
See enumerated lists and internal hyperlink targets in the first Google result for “restructuredtext list”. You can combine these like so:
For backreferences per your comment, you can use “inline internal targets“, which the quick reference mentions but only the full reference actually describes. Unfortunately, it seems to be impossible for the same text to be both a link and a target (even if the syntax technically allowed it, it would be ambiguous), so you would need more text in the list item than just the question. Your best way might be to have each question link back to the list rather than to a particular list item – eg,