readthedocs / sphinx-hoverxref

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

using hoverxref with php domain ? #305

Open nmatton opened 2 months ago

nmatton commented 2 months ago

I'm not completely familliar with the RTD architecture and domain principles, but I struggle to add crossref to a PHP class (or watherver) definition.

In short, when using the "default" cross-ref system, all works using

:php:class:\`FOO\\Helpers\\QueryBuilder\\QueryBuilder\`

However, I cannot find the equivalent using hoverxref

Here is my conf.py

extensions = [
    "myst_parser",
    "sphinx.ext.doctest",
    "sphinx.ext.autodoc",
    "sphinx.ext.autosummary",
    "sphinx.ext.intersphinx",
    "sphinx.ext.autosectionlabel",
    'hoverxref.extension',
    'sphinx_rtd_theme',
    'sphinxcontrib.phpdomain',
    'sphinx_js']
autosectionlabel_prefix_document = True
hoverxref_domains = ['php']

And the file where the class is defined

QueryBuilder
============

.. php:namespace:: FOO\Helpers\QueryBuilder

.. php:class:: QueryBuilder

Can you give me some hint to solve the issue ? Thanks

Future work will be to cross ref some methods of the class and so on...

Thanks !

humitos commented 2 months ago

PHP Sphinx domain is not currently supported.

I think it could be added by doing something similar to what we are doing with the Python domain:

Note that I'm not currently working on this extension to add new features since we replacing it with a more generic feature built-in into the Read the Docs platform.

nmatton commented 2 months ago

Thanks for your answer. I make it working on a local version (I have the tooltip openned with the "Loading...") but nothing when pushed to RTD.

What I did is

However, the build in RTD does not show any error but it acts just like hoverxref was unexistent ...

I also have those lines in the build

Using default style (tooltip) for unknown typ (hoverxref). Define it in hoverxref_role_types.
Using default style (tooltip) for unknown typ (meth). Define it in hoverxref_role_types.
Using default style (tooltip) for unknown typ (hoverxref). Define it in hoverxref_role_types

which makes me think that hoverxref is present (I'm ok with the default, reason why I didn't define them in hoverxref_role_types. I have the same log warning in the local build)

Any idea ?

RTD build : https://app.readthedocs.org/projects/tisaac-boilerplate/builds/25533610/

Thanks !

humitos commented 2 months ago

I make it working on a local version (I have the tooltip openned with the "Loading...") but nothing when pushed to RTD.

Yeah, the extension doesn't work locally.

You should confirm that on Read the Docs you are executing your modified version of hoverxref. I guess you are not, because it should show at least the same "Loading..." message.