-
-
Notifications
You must be signed in to change notification settings - Fork 92
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
Show tooltips in text for glossary terms and permalinks for definitions #540
Comments
+1 from me. That sounds as a good way to go: just to style the terms with a dashed underline. The link is already generated. Apart from this, my ideal situation would be
|
I gave it a shot, but unfortunately the markup for all links that are internal to the docs use the same class of <a class="reference internal" href="../glossary.html#term-React">
<span class="xref std std-term">React</span>
</a> There is currently no parent selector, according to this recent Stack Overflow post. We can either close this issue as "won't fix", or wait until the standards settle and get adopted by web browsers. |
+1 for won't fix (terms get generated link to glossary per default, that's good)
|
There is a new release of https://sphinx-hoverxref.readthedocs.io/en/latest/ that now allows references to non-RTD hosted sites. |
@ksuess what do you think of this implementation? https://sphinx-hoverxref.readthedocs.io/en/latest/usage.html#tooltip-on-glossary-terms sphinx-hoverxref allows tooltips for glossary terms with no additional markup, just a configuration item. It also allows it for other objects. |
@stevepiercy, this looks pretty good, but…. I set it up locally. If I'm not completely wrong, there is a limitation to readthedocs hosting. The tooltip content is loaded as https://readthedocs.org/api/v3/embed/?doctool=sphinx&doctoolversion=4.4.0&url=http://localhost:8000/glossary.html#term-TTW, which fails with 400 error | "External domain not allowed. |
Another approach could be the way collective.glossary will do:
And jquery.glossarizer to automatically markup glossary terms on a page and display definitions as a tooltip. The json could be generate as pre-commit hook? |
Oh, bummer, you are correct. https://sphinx-hoverxref.readthedocs.io/en/latest/installation.html
Are links still clickable? I cannot tell because the demo has |
It appears that trying to implement sphinx-hoverxref for static sites increases page load times significantly. |
This one actually does not require a server, but the theme itself appears to generate the necessary markup for glossary terms. See: As a bonus, it could work on docstrings, too, with the use of pdoc to automatically generate a JSON file, as @ksuess mentioned. pdoc appears to work only on docstrings, though, and not glossary terms. Double bonus: permalinks for Glossary terms. I would love this. |
From #506 (comment)
There are several possible implementations.
It appears that the downside of all these implementations is that they require the docs to reside on a server for the tooltip to make an XHR to grab the content from the reference. Else it's a lot of copy-paste for each instance of a
term
.IMO this is too much work with not enough benefit, when users can open a link to a term in a new window or tab.
Instead I would suggest that we implement a custom style to indicate that a link is to a term in the Glossary. I think a dashed underline is typical for that.
The text was updated successfully, but these errors were encountered: