I am using Sphinx to document a C++ project. I have a readme
in the src
folder and a full-fledged help website for publishing to readthedocs in docs
folder generated using sphinx. I want to reuse the readme
in my src
folder. The readme
includes the code in src
folder (using literalinclude
directive).
The project has the following structure:
project
src
algo.cpp
readme.rst
CMakeLists.txt
docs
source
index.rst
conf.py
code_link.rst
build
Makefile
Following advise in this question I was able to link my index
with my readme
but the path to the code file in the readme
is now relative to the docs
. Thus the readme
no longer renders independently on its own defeating idea of reuse.
Is there a way to have links in included file relative to included file?