class DocstringLinker(Protocol): (source)
Known subclasses: pydoctor.linker.NotFoundLinker
, pydoctor.linker._AnnotationLinker
, pydoctor.linker._EpydocLinker
A resolver for crossreference links out of a ParsedDocstring. DocstringLinker is used by ParsedDocstring to look up the target URL for crossreference links.
Method | link |
Format a link to a Python identifier. This will resolve the identifier like Python itself would. |
Method | link |
Format a cross-reference link to a Python identifier. This will resolve the identifier to any reasonable target, even if it has to look in places where Python itself would not. |
Method | switch |
Switch the context of the linker, keeping the same underlying lookup rules. |
pydoctor.linker.NotFoundLinker
, pydoctor.linker._AnnotationLinker
, pydoctor.linker._EpydocLinker
Format a link to a Python identifier. This will resolve the identifier like Python itself would.
Parameters | |
target:str | The name of the Python identifier that should be linked to. |
label:Flattenable | The label to show for the link. |
Returns | |
Tag | The link, or just the label if the target was not found. |
pydoctor.linker.NotFoundLinker
, pydoctor.linker._AnnotationLinker
, pydoctor.linker._EpydocLinker
Format a cross-reference link to a Python identifier. This will resolve the identifier to any reasonable target, even if it has to look in places where Python itself would not.
Parameters | |
target:str | The name of the Python identifier that should be linked to. |
label:Flattenable | The label to show for the link. |
lineno:int | The line number within the docstring at which the crossreference is located. |
Returns | |
Tag | The link, or just the label if the target was not found. In either case, the returned top-level tag will be <code>. |
pydoctor.linker.NotFoundLinker
, pydoctor.linker._AnnotationLinker
, pydoctor.linker._EpydocLinker
Switch the context of the linker, keeping the same underlying lookup rules.
Useful to resolve links with the right Documentable
context but create correct - absolute or relative - links to be clicked on from another page rather than the initial page of the context. "Cannot find link target" errors will be reported relatively to the new context object.
Pass None to always generate full URLs (for summaries for example), in this case error will NOT be reported at all.