readthedocs / sphinx-hoverxref

Sphinx extension to show tooltips with content embedded when hover a reference.
https://sphinx-hoverxref.readthedocs.io/
MIT License
95 stars 40 forks source link

Handle explicit intersphinx inventory names in all domains #236

Closed shiftinv closed 1 year ago

shiftinv commented 1 year ago

Intersphinx supports explicitly specifying the inventory name in a link target, e.g. the python: part in :ref:`python:datetime-datetime`.

The custom missing_reference hook in hoverxref handles such target names as well, but only in the std domain (as far as I can tell, particularly for :ref:, which is in the std domain).

Intersphinx supports target names with explicit inventories regardless of role/domain, which means :py:attr:`python:datetime.time.minute` results in the correct link, but without the hoverxref popup as the python: prefix isn't handled by hoverxref in this case.


This PR attempts to fix this by removing the check for the std domain, which I believe intersphinx also doesn't check.

I'm very much not sure if this makes sense with how Sphinx, Intersphinx and sphinx-hoverxref interact, or if there are side-effects, I don't know a whole lot about Sphinx internals :sweat_smile: Nevertheless, this fixes the aforementioned issue, and tests pass fine :)

The difference between sphinx-hoverxref 1.2.0 and this PR can be seen here:

Note the difference on the second :attr: link, while hovering over the second :ref: link works in both versions.


:books: Documentation preview :books:: https://sphinx-hoverxref--236.org.readthedocs.build/en/236/


:books: Documentation preview :books:: https://read-the-docs-sphinx-hoverxref--236.com.readthedocs.build/en/236/

onerandomusername commented 1 year ago

Would you mind updating this to be based on version 1.2.0?

humitos commented 1 year ago

@shiftinv @onerandomusername I just released 1.3.0. Please, let me know if it works as you expected 💯

shiftinv commented 1 year ago

@humitos Awesome, much appreciated! Everything seems to be working fine, all references are now being found :tada: