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_resolve function for the given api_github_repo.

class LinkcodeInfo[source]#

Bases: TypedDict

A TypedDict for the signature of the function given to linkcode_resolve.

module: str[source]#
fullname: str[source]#
get_blob_url(github_repo: str, *, rev: str | None = None) str[source]#

Get the base URL for blobs in the given GitHub repository.

If rev is 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.