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

MathJax 3 support #252

Open
tfeb opened this issue Dec 3, 2019 · 7 comments
Open

MathJax 3 support #252

tfeb opened this issue Dec 3, 2019 · 7 comments

Comments

@tfeb
Copy link
Contributor

tfeb commented Dec 3, 2019

I've been playing with getting Frog to work with MathJax 3. As best I can tell currently this requires two changes:

  • The math-jax widget needs a way of not asking for a configuration as this seems not to be the approved way to do it in MathJax 3
  • markdown (so, not Frog) needs to generate different output for maths, and in particular the <script type="math/tex">...</script> thing seems not to work now.

The markdown change seems to be backward-compatible.

I have made changes which seem to make all this work, which in due course I could submit a pull requests for.

Is this something that would be interesting? If so I'll do some work on it in due course to make the changes cleaner & submit pull requests. If not just close this issue!

@greghendershott
Copy link
Owner

I no longer use Frog myself and I'm no longer actively maintaining it in terms of adding new features. For example note I deliberately did not add a GitHub Sponsors button to this repo 😄

Having said that, I'm not opposed to merging a PR from you -- if you can be available to field any follow-up issues that might result?

Things I don't know, but you might (or could find out):

  • The MathJax history.
    • Is the status quo working with MathJax 1 or 2?
      • If so, is anyone using that with Frog?
        • If so, would the proposed change break?
  • Is it necessary to change the markdown parser? For some things, yes, the markdown parser must be changed, period. For others, Frog can post-process the resulting xexpr it gets from that parser. The latter avoids touching two repos and is sometimes just as easy as futzing with the markdown parser. Which is better here, I don't know.

@tfeb
Copy link
Contributor Author

tfeb commented Dec 3, 2019

I don't know about MathJax 1. It does work with 2. The way I've made the change to Frog is that unless you say so nothing will change (there's a new keyword argument which defaults to 'be compatible').

For markdown I need to think more. There's no change to the syntax that the parser accepts, but there is a change to the HTML it produces (but only in the case where there is MathJax in the input). Again, the HTML it produces works with both MathJax 2 & 3. The screen output looks better (for both versions!) with the new thing, which is surprising, but may be because I don't understand bootstrap.

I definitely need to think about it some more. If I decide it's worth doing (I have no real reason to move to MathJax 3 except the nightmare of getting stuck on some barely-maintained version worries me) I'd certainly be willing to support the changes.

@tfeb
Copy link
Contributor Author

tfeb commented Jan 14, 2020

I've now played with this a bunch more, and I'm convinced that my changes are safe (and in fact are improvements even for MathJax 2). The I'll clean things up a little (the changes are really small) & submit a couple of pull requests (one for frog, one for markdown) in the next little while.

I am certainly willing to undertake support for them for both packages. I can also write a thing on what you need to do to change to using MathJax 3.

@greghendershott
Copy link
Owner

Thanks for following up!

One thing that could be good to write -- maybe you could even post it here? -- would be the "elevator pitch" for "why MathJax 3".

In other words, if someone is content using Frog with an older version of MathJax, what's the story for them?

If they upgrade Frog, will things break until they migrate to 3? If so, and if they're inclined to feel grumpy about that -- why will they feel better about making the effort to migrate?

[To be clear, these are genuine questions, not some passive-aggressive push back. 😄 I honestly don't know the story here. Just anticipating it as something that often needs to be addressed in these cases.]

@tfeb
Copy link
Contributor Author

tfeb commented Jan 18, 2020

So the elevator pitch for MathJax 3 is really the usual depressing one: at some time the MathJax people will stop making changes to MathJax 2 (this time may already be in the past), and at some time after that drift in browsers will mean it breaks, and MathJax 3 will start to be necessary.

What this change does (will do) is make it so that Frog can support MathJax 3 if the user wants it to, so at the point it becomes necessary it is also possible. Upgrading to the version will not force an upgrade to MathJax 3: unless you change the configuration, in the form of page-template.html, nothing will change, at all. In particular if you use the same version of markdown the output will be bitwise the same. All the change does is make it possible to generate URLs of the right form for MathJax 3.

Caveat to the above: the output generated by my proposed change to markdown (I need to raise a PR for that) is different. But it's simpler, and it works with MathJax 2.

I hope that makes sense (and I didn't think your questions were passive-aggressive, and I hope the above doesn't read as rude: it's not meant to be).

Finally: while writing this I realised I could make the change even tinier: rather than having a #:no-config option I can just allow the existing #:config option to be #f which makes the change smaller. I've changed that but let me check the output is all fine before submitting a PR.

@soegaard
Copy link
Contributor

soegaard commented Jan 20, 2020 via email

@tfeb
Copy link
Contributor Author

tfeb commented Feb 25, 2020

OK, I've now submitted both PRs for this:

There are no dependencies between them, although you need both if you want to use MathJax 3 with frog.

I've also just checked all this with Racket 7.6 which I hadn't noticed when submitting the PRs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants