sphinx_gallery.docs_resolv#
Link resolver objects.
Functions#
- sphinx_gallery.docs_resolv.embed_code_links(app: Sphinx, exception: Exception | None) None[source]#
Embed hyperlinks to documentation into example code.
Classes#
- class sphinx_gallery.docs_resolv.SphinxDocLinkResolver(config: dict[str, Any], doc_url: str | Path, gallery_dir: str, relative: bool = False)[source]#
Resolve documentation links using searchindex.js generated by Sphinx.
- Parameters:
doc_url (str | pathlib.Path) – The base URL of the project website.
relative (bool) – Return relative links (only useful for links to documentation of this package).
- resolve(cobj: dict[str, Any], this_url: str) tuple[str | None, Any | None][source]#
Resolve the link to the documentation, returns None if not found.
- Parameters:
cobj (Dict[str, Any]) –
Dict with information about the “code object” for which we are resolving a link.
cobj[‘name’] : function or class name (str)
cobj[‘module’] : module name (str)
cobj[‘module_short’] : shortened module name (str)
cobj[‘is_class’] : whether object is class (bool)
cobj[‘is_explicit’] : whether object is an explicit backreference (referred to by sphinx markup) (bool)
this_url (str) – URL of the current page. Needed to construct relative URLs (only used if relative=True in constructor).
- Returns:
link (str or None) – The link (URL) to the documentation.
type_ (str) – The type. Only returned if return_type is True.