linkcode#
import sphinx_api_relink.linkcode
A linkcode resolver for using sphinx.ext.linkcode with GitHub.
- get_linkcode_resolve(github_repo: str, *, debug: bool, rev: str | None = None) Callable[[str, LinkcodeInfo], str | None][source]#
Get a
linkcode_resolvefunction for the givenapi_github_repo.
- class LinkcodeInfo[source]#
Bases:
TypedDictA
TypedDictfor the signature of the function given tolinkcode_resolve.
- get_blob_url(github_repo: str, *, rev: str | None = None) str[source]#
Get the base URL for blobs in the given GitHub repository.
If
revis provided, it is used directly. Otherwise, several attempts are made to determine a valid Git ref (commit SHA, tag, or branch) that exists in the repository.Warning
This function makes network requests to GitHub to verify the existence of URLs.