sphinx-extensions2 / sphinx-tippy

Get rich tool tips in your sphinx documentation!
https://sphinx-tippy.readthedocs.io
MIT License
33 stars 5 forks source link

🐛 fix: make math tips work in non-furo themes #14

Closed ValMystletainn closed 4 months ago

ValMystletainn commented 7 months ago

Fix the Equation hover in other themes

The math reference hover tips only work in furo theme, but not for other themes.

and It has been observed by other users, like this

It‘s caused by "filter the div with class 'math-wrapper' to build id_to_html". The 'math-wrapper' class is provided by furo theme but not by the mathjax extension. So in other themes, we will miss the equation element and fail to build the tips.

This commit aims to change the filter to div with class "math", "notranslate" and "no highlight", which is provieded by mathjax extension. and make the math preview work in other themes.

Visualzation test

before

5a6836dc6b7291522a41fe1c91e97aa

With Furo

b6180819b4b8c0dfaf22f1371fdfdf6

With classic

After

012986c7bbbbb549d1fefeec6240c60

With Furo

35102209d8d6f4863f9507f19473ca3

With classic

References

Furo init function code that adds math-wrapper div

sphinx ext mathjax code that adds those three class