sphinx-hoverxref icon indicating copy to clipboard operation
sphinx-hoverxref copied to clipboard

Handle explicit intersphinx inventory names in all domains

Open shiftinv opened this issue 3 years ago • 0 comments

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.1.3 and this PR can be seen here:

  • https://sphinx-test-stuff.readthedocs.io/en/hoverxref-intersphinx/
  • https://sphinx-test-stuff.readthedocs.io/en/hoverxref-intersphinx-fixed/

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/

shiftinv avatar Oct 05 '22 21:10 shiftinv