Is it possible, using sphinx, to have hover-boxes for words that appear inside code snippets, similar to what the hover-boxes in the code samples in the angular.js landing page look and behave like?
-
Since it's possible to add this as an additional step after the sphinx plain build (because code blocks are easy to recognize in the generated html), I guess it's possible as another step after sphinx finished its thing. – matanster Nov 21 '13 at 22:20
3 Answers
(For those who landed here while looking for hover tooltips in regular RsT text)
The :abbr:
inline markup produces tooltips in HTML,
like that:
:abbr:`linkified text (tooltip text)`
An alternative, fully functional solution is the sphinx-hoverxref
extension, which retrofits a :ref:
-like role that fetches tooltip content from the referenced section, figure, etc:
Unfortunately, I don't think this will be supported out of the box (see: https://bitbucket.org/birkenfeld/sphinx/issue/73/show-term-contents-in-a-tooltip).
It's also worth mentioning that Angular's landing page is not a documentation page, it's a webapp in its own right, so there's lots of code and CSS trickery going on that it would first appear.

- 3,164
- 3
- 26
- 34
-
I cannot access that bitbucket repo unfortunately. And I don't see why it should be so complicated to render some of the content of a rst page as a hoverbox – Omni Jan 06 '19 at 20:00
-
The issue is at GitHub now (closed, won't fix): https://github.com/sphinx-doc/sphinx/issues/73 – mzjn Feb 20 '20 at 13:38
It's possible as an additional build step, obliviously of any input or extension to sphinx, since sphinx code snippets (typically) are very easy to recognize in the html output generated by sphinx. So an additional postprocessing step following after the sphinx step, can easily locate them, and then some logic can be sprinkled on top, that adds hover boxes per your preference.

- 15,072
- 19
- 88
- 167