`:term:` tooltip problems with terms that share definitions
As others have said, thanks for the extension! It has made a huge difference in the usefulness of my documentation.
I have the following problem:
I have a glossary page with lots of entries like this:
.. glossary::
term 1
term 2
definition for both term 1 and term 2
I have hoverxref setup to show tooltips for terms, However, :term:`Term 1` brings up a tooltip that just says "term 2" and doesn't include the definition. Is there a way around this?
Thanks again!
Hi @zhenry9! This is probably an error in the backend API and how it's doing the parsing of the content before returning it. Unfortunately, that code is not (yet) public available.
There is no current workaround, sorry, but we will consider it in the following month once we start working more deeply on making that code better and finally public :tada:!
I did some experiments on this and it gets dirty too quickly (but, hey!, it works). Basically, we need to:
- get the specific HTML node for the definition
- go up on its siblings until we find a different node than
dtand save all thesedtnodes - go down on its siblings until we find a different node than
dtand save all thesedtnodes - remove all nodes that are not: the current node, the next node and none of the saved nodes
Note that this can be implemented in this chunk of code https://github.com/readthedocs/readthedocs.org/pull/8521/files#diff-93aac61b8b6d747d415ef7412a0f6aa10410dd7b1aa229ea075026177915724fR191
Any updates? We also hit this bug.
@jpfeuffer hi! I haven't had the time to work on this issue yet. Would you like to research a little more and open a PR with a proposed fix? In a previous comment I explained my findings and good to potentially solve it.
Hi! Question about the code. Why do you (at all) go through the whole glossary and delete everything but the entry you want, instead of creating copies for a new html object with just the node that was found by ID and its next dd node?
Honestly, I don't think there is a strong reason for that. I suppose either way will generate the same output
Ok can you point me to the tests of this part of the API?
Got it https://github.com/readthedocs/readthedocs.org/blob/main/readthedocs/embed/v3/tests/test_external_pages.py#L216
Is there an easier way to do a development environment for this? I don't want to install all the docker compose stuff. I just want to do simple python mock tests for the API.
@jpfeuffer unfortunately, that's not possible. You will need to follow this guide https://docs.readthedocs.io/en/latest/development/install.html to be able to develop the EmbedAPI
Ok, sorry then I can't. I do not have 10 GB of free space.
If you want, I can abuse your CI. Otherwise I am afraid someone else has to finish this.