A way to rewrite sphinx links from one location to another.
When the top level README is rendered by a simple rst processor (github or bitbucket) the links in that document are relative to the project. However, when that document is used by Sphinx, the links wont point to the correct spot.
With this extention, Sphinx is capable of transforming the links, so the simple links work and will work then processed.
This README links to TARGET-DOC. When sphinx processes this file, the links will be changed to link to the html docs.
.. linkrewrite:: :from: ./docs/source/(?P<path>.*)\.rst :to: ./\g<path>.html
To install from github:
pip3 install git+https://github.com/jhgorrell/sphinx-ext-linkrewrite.git#egg=sphinx_ext_linkrewrite
Then, in your sphinx conf.py
:
extentions.append('sphinx_ext_linkrewrite')
To get started as a dev:
git clone https://github.com/jhgorrell/sphinx-ext-linkrewrite.git cd sphinx-ext-linkrewrite source ./setup.env make
- Have
linkrewrite
conditinal on the output backend.