Insert relative link in reStructuredText

Dan Menes picture Dan Menes · Sep 2, 2010 · Viewed 7.4k times · Source

I am documenting a library that has a Python component and a JavaScript component. The overall user documentation, and the Python API documentation are in reStructuredText, processed with Sphinx. The JavaScript API is in jsdoc and is processed with jsdoc-toolkit. The principal output format will be HTML. I am new to reST, Sphinx and jsdoc.

I have set up a build system so all the generated html pages are dumped into a single directory tree. I now need to insert into the main page (generated from reST) a link to the generated Javascript documentation. This needs to be a relative link, since the docs may be located in different places on different installations. reST will automatically parse a full URL, but I can't figure out how to make it insert a relative link. Constructs like :ref: and :doc: don't seem to help, because they expect the target to be reST.

Any ideas?

Answer

Dan Menes picture Dan Menes · Sep 2, 2010

Figured it out. The following inserts a relative reference to the document js/index.html:

`Javascript API <js/index.html>`_