-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Allow extensions to define the keys returned by linkcode ext #11824
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 4 commits
727787b
f87766a
c20cd8b
d6084d3
54e8225
fbf71ab
73f435b
85efe3e
7321ca3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1178,6 +1178,15 @@ def add_autodoc_attrgetter(self, typ: type, getter: Callable[[Any, str, Any], An | |
logger.debug('[app] adding autodoc attrgetter: %r', (typ, getter)) | ||
self.registry.add_autodoc_attrgetter(typ, getter) | ||
|
||
def add_linkcode_domain(self, domain: str, keys: list[str]) -> None: | ||
"""Register a new list of keys to use for a domain by the | ||
:mod:`sphinx.ext.linkcode` extension. | ||
|
||
.. versionadded:: 7.3 | ||
""" | ||
from sphinx.ext.linkcode import domain_keys | ||
domain_keys[domain] = keys | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just wondering but what happens if two extensions do the same? should extend the keys and removing duplicates? Also, you should probably say (in the doc) that the keys an extension defines overrides whatever keys were previously defined if we go with the current implementation. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I don't think so, the idea is that an extension that provides support for a new domain, for instance Another possibility I see would be to completely forbid overriding an existing key, or maybe add a warning when a key is overridden. But I thought overriding the existing keys could also be useful in a way. Maybe we should wait for another opinion? I'm not in a hurry for this feature.
I will add a more descriptive explanation when we settle on the preferred behaviour. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would like the opinion of another maintainer/contributor. Since we are in a holiday period, it might take a while though. When we release new versions, we create an issue and you can ask at that moment if we didn't decide on anything. |
||
|
||
def add_search_language(self, cls: Any) -> None: | ||
"""Register a new language for the HTML search index. | ||
|
||
|
Uh oh!
There was an error while loading. Please reload this page.