Closed hardyoyo closed 2 years ago
Hi!
I'm not sure it's desirable in general scenarios to disable typesetting on startup, it's just important to know that it exists and that it CAN be turned off.
How to turn off initial typesetting is not documented in the documentation for this library because it's not a feature of this library, it's a feature of MathJax and I only document the extension to MathJax in React that this library offers here. Nonetheless, you can read about how to turn off automatic typesetting here for MathJax version 2 and here for MathJax version 3.
Here are configuration examples that accomplishes this:
Version 2:
const config = {
skipStartupTypeset: true
}
Version 3:
const config = {
startup: {
typeset: false
}
}
Hope it works! :)
Mind if I make a PR for adding the above links to the README?
Hmmm, I'm really grateful for you initiative but I don't think that's a good idea for the following reasons:
better-react-mathjax
is already very large and larger than most other similar libraries. As a matter of fact, even though a reduced-size readme is used for the package itself (as opposed to the Git repo), NPM often does not show the readme, probably because it's considered too large. The documentation is large because there is a lot to be said, but it is still a good point to try to limit the size.Hope you can see my point of view and thanks again for your input! I will see if I can add some clarification on the configuration object and make it clear that information about it should be sought from the main MathJax docs next time I redo the readme.
I'd normally be inclined to agree, however, I have been trying to debug some odd behavior I was seeing from Better-MathJax-React, specifically MathJax was always rendering for all content on a page, even though we were carefully trying to manage where and when MathJax would appear, by only conditionally wrapping some markup with a MathJax component. And only after a very careful reading of the docs did I realize this was because the only way to make the MathJax component relevant (in this context) was to specifically turn off MathJax rendering on page load. So, yes, I did eventually figure it out, but only after much frustration. I'd like to save someone else that frustration. Happy to help. I do think the text that indicates that it's possible to disable typesetting on page load could provide a link to the MathJax docs for version 2 and version 3, as you did above, without adding too much bulk to the README. I'll leave that up to you, and will close this issue.
Ok, I can agree with that.. just supplying links for these settings can absolutely be done (I thought you had a paragraph with examples in mind). Will also take care to make it clear that MathJax typesets automatically and what the role of a React MathJax package is. COULD turn off automatic typesetting by default but I feel that could break a lot of existing uses where people use this library (but in the wrong way relying on the behaviour of automatic typesetting on startup).
Thanks again for your input!
The readme mentions in several places that it is possible and desirable to configure MathJaxContext to not typset on page load (which is the default behavior of MathJax). However, the readme omits any example of how to do this.