fast-reflexes / better-react-mathjax

MIT License
124 stars 16 forks source link

Missing documentation in readme #16

Closed hardyoyo closed 2 years ago

hardyoyo commented 2 years ago

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.

fast-reflexes commented 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! :)

hardyoyo commented 2 years ago

Mind if I make a PR for adding the above links to the README?

fast-reflexes commented 2 years ago

Hmmm, I'm really grateful for you initiative but I don't think that's a good idea for the following reasons:

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.

hardyoyo commented 2 years ago

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.

fast-reflexes commented 2 years ago

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!