Use the same README content in sphinx and github - relative links

I am adding the Read the Docs page for my project. At the moment I want to get the same content on the Read the Docs homepage as in my README. My file docs/index.rstlooks like this:

.. include:: ../README.rst

.. toctree::
   :maxdepth: 2
   :caption: Contents:


Indices and tables
==================

* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`

This basically works, with the exception of relative links. For example, my README contains:

See `INSTALL.rst`_ for advanced and detailed instructions.

Since Sphinx creates everything in the docs directory, it expects to find INSTALL.rstdocs inside the directory.

Since Github displays the file from the root, it expects to find INSTALL.rstin the root directory.

How can I make Github and read documents (Sphinx) correctly relate relative links without duplicate files (or, preferably, any duplication)?

+4
1

.

sphinx:

INSTALL.rst -> ../INSTALL.rst
+1

Source: https://habr.com/ru/post/1671486/


All Articles