scanpydoc.rtd_github_links¶
GitHub URLs for class and method pages
This extension registers a Jinja filter called github_url()
that you can use to convert a module path into a GitHub URL
Configuration¶
Uses the following config values in conf.py
:
project_dir: Path = ... # default: Path.cwd()
html_context = dict(
github_user=...,
github_repo=...,
github_version=...,
)
The project_dir
is used to figure out the .py file path relative to the git root,
that is to construct the path in the github URL.
The html_context
is e.g. also used like this in the sphinx_rtd_theme.
Usage¶
You can use the filter e.g. in autosummary templates.
To configure the sphinx_rtd_theme,
override the autosummary/base.rst
template like this:
:github_url: {{ fullname | github_url }}
{% extends "!autosummary/base.rst" %}
Functions¶
- github_url(qualname)¶
Get the full GitHub URL for some object’s qualname.
- Parameters:
- qualname :
str
The full qualified name of a function, class, method or module
- qualname :
- Return type:
- Returns:
A GitHub URL derived from the
html_context
.