Skip to content
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

Tooltip content fails to generate #278

Open
pique-b opened this issue Jan 10, 2024 · 3 comments
Open

Tooltip content fails to generate #278

pique-b opened this issue Jan 10, 2024 · 3 comments

Comments

@pique-b
Copy link

pique-b commented Jan 10, 2024

I have been trying to implement tooltip functionality in my Sphinx document for a project.

I have installed hoverxref in my virtual environment and after running the sphinx build, I am unable to see the tooltips being displayed beyond the small tooltip window saying 'Loading...'.

I am using the following to implement the tooltip:

Before a section header, I have added the following label:

.. _my-test-tooltip:

A Section Header
-----------------

Some descriptive texts here...

Some more descriptive texts...

Then from the next section 'A New Section' I am trying to generate the tooltip.

A New Section
--------------

Some texts here...

In this New Section I am implementing the tooltip like this:

This line contains a hoverxref tooltip :hoverxref:`here is a tooltip <my-test-tooltip>`.

However, no tooltip content is generated as stated above.

This is my requyiments.txt:

alabaster==0.7.13
Babel==2.14.0
certifi==2023.11.17
charset-normalizer==3.3.2
docutils==0.20.1
idna==3.6
imagesize==1.4.1
importlib-metadata==7.0.1
Jinja2==3.1.2
MarkupSafe==2.1.3
packaging==23.2
Pygments==2.17.2
requests==2.31.0
snowballstemmer==2.2.0
Sphinx==7.2.6
sphinx-hoverxref==1.3.0
sphinx-togglebutton==0.3.2
sphinxcontrib-applehelp==1.0.7
sphinxcontrib-devhelp==1.0.5
sphinxcontrib-htmlhelp==2.0.4
sphinxcontrib-jquery==4.1
sphinxcontrib-jsmath==1.0.1
sphinxcontrib-qthelp==1.0.6
sphinxcontrib-serializinghtml==1.1.9
urllib3==2.1.0
zipp==3.17.0

In my config file I have added the following:

extensions = ['sphinx.ext.autodoc',
              ...,
              'hoverxref.extension', << The hoverxref extension added
              ...,              
]

hoverxref_role_types = {
    'hoverxref': 'tooltip',
    'ref': 'tooltip',
    'confval': 'tooltip',
    'mod': 'tooltip',
    'class': 'tooltip',
    }

As stated above, I am working in virtual env and rest of the Sphinx functionalities are working.

Checked this issue Content not loading #224 but find it still open and could not gather a way from it to resolve the issue I am facing.

I am on Python 3.9 and Sphinx v7.2.6.

What do I need to do to make this work?

@humitos
Copy link
Member

humitos commented Jan 10, 2024

This extension only works for projects hosted on Read the Docs (we have a warning note in the installation page of the documentation: https://sphinx-hoverxref.readthedocs.io/en/latest/installation.html) since it requires a backend server.

So, building the documentation locally will succeed, but won't render the tooltips since it's making a request to Read the Docs and not finding the project hosted there.

@pique-b
Copy link
Author

pique-b commented Jan 11, 2024

Oh! So does it mean that there is no way the documentation can be tested except by porting it to RTD?

Is there any chance (in the foresseable future) of the feature being extended to locally developed documentation?

@humitos
Copy link
Member

humitos commented Jan 11, 2024

Oh! So does it mean that there is no way the documentation can be tested except by porting it to RTD?

Short answer: No.

However, it's possible, but not easy and it involves installing a Read the Docs development instance locally. It's documented in https://sphinx-hoverxref.readthedocs.io/en/latest/development.html and I wouldn't recommend you to follow those steps just for "testing the extension locally".

If you are considering not using Read the Docs for your documentation, I wouldn't recommend you to use this extension. On the other hand, if you plan to use RTD, you can import your project there and use pull request previews to test the docs easily. See https://docs.readthedocs.io/en/latest/pull-requests.html

Is there any chance (in the foresseable future) of the feature being extended to locally developed documentation?

We don't plan to work on this currently. You can find more information about this in #69

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants