Link to source code and validate references in documentation
Project description
Sphinx Gitref
Keep your sphinx docs in sync with your code.
Adds a :gitref:`..`
role to sphinx to link to your code on GitHub, GitLab or
Bitbucket, and to make sure the references in your docs match the code.
Key features:
- Check code references are up to date
- Link to source code on github
- Incorporate into tests or git hooks
Supports Python 3.7+
Quickstart
Install:
pip install sphinx-gitref
In your Sphinx conf.py
, add sphinx_gitref
to the extensions
list:
extensions = [
...
'sphinx_gitref',
]
See Configuration for options to customise gitref's defaults.
You can then use the :gitref:`..`
role to link to a file on GitHub, GitLab,
Bitbucket, or your own remote git service:
This file is :gitref:`README.rst`
For more information, see the :gitref:`project README <README.rst>`
or link to a variable, function or class in a python file::
The method which turns a reference into a line number
is :gitref:`sphinx_python/parse.py::python_to_lineno` -
this will raise a warning if the reference is not found.
Reference class attributes as you would in Python, such
as :gitref:`sphinx_python/git.py::Repo.path`.
If the file, line number or code reference is not in your code, your docs will fail to build.
See the documentation for more detailed usage instructions and options.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for sphinx_gitref-0.3.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 57c1ee8b4c3582b171c24bcc1fe442a72043ee4578ca8c65b50780777fe237a6 |
|
MD5 | a9fdb74a86279f5ad0e7e5f9719a458e |
|
BLAKE2b-256 | 621cbbb10cc07581793553c3676ec2910160fc4733b1f6ca83dc95d838b8fbd6 |