Skip to content
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

Add compatibility with Mathjax3 #85

Closed
Daltz333 opened this issue Aug 17, 2020 · 18 comments · Fixed by #116
Closed

Add compatibility with Mathjax3 #85

Daltz333 opened this issue Aug 17, 2020 · 18 comments · Fixed by #116
Labels
Accepted Accepted issue on our roadmap Improvement Minor improvement to code

Comments

@Daltz333
Copy link
Contributor

@humitos
Copy link
Member

humitos commented Aug 17, 2020

What are you using to render that? Mathjax is the one that's currently supported. See https://sphinx-hoverxref.readthedocs.io/en/latest/usage.html#tooltip-with-mathjax

@Daltz333
Copy link
Contributor Author

It is using mathjax

@Daltz333
Copy link
Contributor Author

Additionally, write clicking on the latex in your example gives this
image

@Daltz333
Copy link
Contributor Author

This is another picture of it showing that we do indeed use mathjax
image

@humitos
Copy link
Member

humitos commented Aug 19, 2020

@Daltz333
Copy link
Contributor Author

Oh no. I do not. Can I ask why it's not enabled by default?

@humitos
Copy link
Member

humitos commented Aug 19, 2020

It's not enabled by default because it triggers some "javascript magic events" to re-render all the formulas in the page; which is not required if mathjax is not used.

If you are curios, see https://github.com/readthedocs/sphinx-hoverxref/blob/master/hoverxref/_static/js/hoverxref.js_t#L112 --I'm not proud of that code, but I didn't find a better way of doing it, 😄

Please, let me know if that worked for you and feel free to close the issue in that case.

@Daltz333
Copy link
Contributor Author

Daltz333 commented Jan 7, 2021

This issue is still present. See the "state" and "inputs" term on this page https://docs.wpilib.org/en/stable/docs/software/wpilib-tools/robot-simulation/physics-sim.html

and confirmed mathjax for hoverxref is enabled.

https://github.com/wpilibsuite/frc-docs/blob/d320917fa10928dbdcb87b01f21e3f93187378d8/source/conf.py#L136

@Daltz333 Daltz333 reopened this Jan 7, 2021
@Daltz333
Copy link
Contributor Author

Daltz333 commented Jan 7, 2021

image

@humitos
Copy link
Member

humitos commented Jan 7, 2021

I guess this is happening because you are using a mathjax version different than the default one? https://github.com/wpilibsuite/frc-docs/blob/d320917fa10928dbdcb87b01f21e3f93187378d8/source/conf.py#L138

If you open the browser console, you will see that the hoverxref code that tries to render latex is being triggered, but it's not defined.

Uncaught TypeError: MathJax.Hub is undefined

So, I guess that Mathjax3 changed the API and hoverxref is not compatible with it.

@Daltz333
Copy link
Contributor Author

Daltz333 commented Jan 7, 2021

Mathjax3 will be the default as of Sphinx 4 as it offers much better page loading times and other optimizations. It'd be great to see hoverxref move toward this. I'll rename the issue

@Daltz333 Daltz333 changed the title LaTeX does not render in tooltips Add compatibility with Mathjax3 Jan 7, 2021
@humitos humitos added Accepted Accepted issue on our roadmap Improvement Minor improvement to code labels Jan 8, 2021
@Daltz333
Copy link
Contributor Author

Just wanted to bump this issue, as Sphinx 4 will be released within the next month per sphinx-doc/sphinx#8195

@Daltz333
Copy link
Contributor Author

Daltz333 commented Apr 7, 2021

Another ding. Sphinx 4 will be releasing this month, and this extension will be broken with the now default Mathjax 3

@humitos
Copy link
Member

humitos commented Apr 13, 2021

@Daltz333 I'm following Sphinx releases closely. However, I haven't had the time to work on this issue. Would you like to do some research about the changes required and start a draft PR?

@Daltz333
Copy link
Contributor Author

I will look into it.

@Daltz333
Copy link
Contributor Author

I did a little bit of investigation. It seems an immediate issue is that MathJax3 uses promises rather than queue. There is a handy little converter https://mathjax.github.io/MathJax-demos-web/convert-configuration/convert-configuration.html that works on configuration objects, but not queue. I'm looking into it now.

@Daltz333
Copy link
Contributor Author

I attempted to use typeset promise, but I was not able to get it to work

@humitos
Copy link
Member

humitos commented May 5, 2021

Sphinx 4 will be releasing this month, and this extension will be broken with the now default Mathjax 3

Just wanted to note here that Sphinx 4 includes a new feature that breaks some compatibility with this extension. See sphinx-doc/sphinx#9115

I think it would be good to mention these limitations in the sphinx-hoverxref's documentation somewhere.

Latest fully supported Sphinx version is <3.5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Accepted Accepted issue on our roadmap Improvement Minor improvement to code
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants