sphinx-hoverxref
sphinx-hoverxref copied to clipboard
Tooltip on sidebar
It may be interesting to be able to hover on the sidebar and get the first paragraph of the content referenced.
- Requires a change in the backend to let it know to return chunked content and not the whole section
- Would be good to make the amount of content configurable via a
hoverxref_config that is sent to the backend
I found the place where the toctree is created is at https://github.com/sphinx-doc/sphinx/blob/b08a00af739ffbf5e957c0649ac4c4c8d4f866ed/sphinx/environment/adapters/toctree.py#L261-L265
Adding this chunk of code into that section inside the for, the sidebar shows tooltips:
refnode['classes'].extend(['hoverxref', 'tooltip'])
refnode._hoverxref = {
'data-project': 'sphinx-hoverxref',
'data-version': 'latest',
'data-doc': 'configuration',
'data-docpath': '/configuration.html',
'data-section': 'configuration',
}
I wasn't able to find all the data that I need because the target is missing in these nodes (take into account they are not sphinx.addnodes.pending_xref but just regular docutils.nodes.reference nodes.