Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create link to local index.html from Sphinx documentation?

I'm writing some docs for Sphinx/rst. How can I link to something on local disk which is relative to the page you're viewing?

For example:

====================
My App documentation
====================

The official My App documentation can be found here:
https://myapp.com/docs

A local mirror is available:
../../_static/docs_mirror/index.html

On my machine, the _static folder resides in:

file:///Users/fredrik/code/repos/myapp/docs/_static

...but I don't want to hard-code that path, as that path might not be the same path for another user who has downloaded cloned the repository.

like image 344
fredrik Avatar asked Jul 09 '16 11:07

fredrik


People also ask

What is Intersphinx?

ext. intersphinx – Link to other projects' documentation. New in version 0.5. This extension can generate links to the documentation of objects in external projects, either explicitly through the external role, or as a fallback resolution for any other cross-reference.


1 Answers

Here is one way to do it:

`local mirror <_static/docs_mirror/index.html>`_

Another option:

`local mirror`_

.. _local mirror: _static/docs_mirror/index.html

Reference: http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html#hyperlink-references.

like image 137
mzjn Avatar answered Nov 15 '22 10:11

mzjn