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

Render MathJax in the backend (SSR) #33

Open
fast-reflexes opened this issue Nov 4, 2022 · 3 comments
Open

Render MathJax in the backend (SSR) #33

fast-reflexes opened this issue Nov 4, 2022 · 3 comments

Comments

@fast-reflexes
Copy link
Owner

There has been discussion around this earlier and now it seems NextJS 13 is supporting serverside components. This makes it more interesting to look into using the MathJax library itself to generate MathJax n the serverside and then not downloading MathJax in the frontend at all.

@pkra
Copy link

pkra commented Nov 7, 2022

Just to avoid people finding the wrong resource: https://docs.mathjax.org/en/latest/server/start.html links to official examples.

A common problem is that some client-side features are lost when rendering server-side, e.g., the mathjax menu (and everything it enables) depends on client-side rendering and there's currently no hydration solution (besides re-rendering).

You can do a lot of things server-side however (e.g., generate descriptions for accessibility) and it's sometimes easier to just build your own for these missing features (e.g., copy&paste for sources).

@fast-reflexes
Copy link
Owner Author

Good points. And I know accessibility is a very important concern of the Mathjax creators so definitely worth to thread lightly here.

@pkra
Copy link

pkra commented Nov 8, 2022

I personally prefer SSR and have built (with help from the MathJax team) a lightweight helper that makes expressions explorable on the client (see the last examples on github pages). While it's naturally possible to do this on the client, too, I suspect most people would prefer the standard client-side MathJax experience.

Given how MathJax works the full experience invariably needs re-rendering - which might still be done efficiently (e.g., via an instant.page or quicklink kind of approach).

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

2 participants