RestructuredText Hyperlink to Line Number

268 views Asked by At

I am writing a FAQ page in restructuredtext and I would like to place a list of questions at the top with links to the answers further down the page. I wrote the following but the link doesn't go anywhere. What am I doing wrong?

`How are you associated with the University? `_

How do I create a hyperlink to a line number in reST?

2

There are 2 answers

0
matthewrsj On

I just found it here: http://docutils.sourceforge.net/docs/user/rst/quickref.html#example-callout

If you wrap the question in backquotes like this:

`How are you associated with the University?`_

then below you can reference the question like this:

.. _How are you associated with the University?:

Now, when you click on the question link it takes you to the correct line, all without using HTML.

2
Yashar On

Put anchor link tag on your your question:

<a href="/donate/faq#n281">How are you associated with the University? </a>

...

Here is your answer:

<a id="n281"></a>
... Your n281 answer  ...