using hoverxref with php domain ?
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 !
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:
- Declare the class for PHP domain: https://github.com/readthedocs/sphinx-hoverxref/blob/91c4d87c80c409e4b6e36d68fe551214ad3b3567/hoverxref/domains.py#L69-L80
- Override the default class: https://github.com/readthedocs/sphinx-hoverxref/blob/91c4d87c80c409e4b6e36d68fe551214ad3b3567/hoverxref/extension.py#L124-L133
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.
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
- remove
sphinx-hoverxref==1.4.0fromrequirements.txt - update the
extension.pyas suggested (basically duplicating the lines 124-133 by replacing "py" by "php" + renaming "extension.py" to "hoverxref.py" and fixing (absolute) import issue - in conf.py: adding the line
import os, sys; sys.path.insert(0,os.path.abspath('./hoverxref'))and replacing'hoverxref.extension',by'hoverxref',in extensions
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 !
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.