-
Notifications
You must be signed in to change notification settings - Fork 40
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
Move from overridden domains to a custom role #14
Comments
It's defining a custom role as well, |
But it might be possible to patch the standard roles used instead of replacing the domains. Replacing the domains will eventually be fragile, and will likely cause linking issues. |
If we can get the domain used to produce/resolve a node, we can just connect to It may be possible, but I'm not seeing it clearly. Do you have something in mind? |
Not yet, this will require more experimentation. This is likely getting into a solution that might hack up Sphinx at a deeper level. But, as often is the case here, a lightweight hack in Sphinx internals can actually be less fragile than hoping the domains can be overridden without issues. We can alter the doctree through capturing an event, but if you don't have the correct information on the resolved ref node, this might not be a good avenue. |
Yeah. Overriding the Domains is not an elegant solution, but I will only fail if there is another extension that also overrides the same domain. Also, I think that there is more research that can be done about how I'd like to find a way to extend an already defined domain, but I wasn't able find that path yet. |
Instead of using a custom role, this extension is using overrides on domains, which is going to introduce problems with reference resolution as Sphinx has multiple Python and Standard domains.
Couldn't this instead implement our own custom role, instead of repurposing
XRefRole
and having to catch reference resolution in every domain?https://github.com/readthedocs/sphinx-hoverxref/blob/master/hoverxref/extension.py#L176-L184
The text was updated successfully, but these errors were encountered: