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 mathjax support to text input boxes boxes #269

Closed
crazy4pi314 opened this issue Nov 5, 2021 · 3 comments · Fixed by #417 or #846
Closed

Add mathjax support to text input boxes boxes #269

crazy4pi314 opened this issue Nov 5, 2021 · 3 comments · Fixed by #417 or #846
Assignees

Comments

@crazy4pi314
Copy link
Member

Would be nice to support latex in submission boxes for things like the abstract on the submission page or method description. Might be possible to use in node mathjaxs: http://docs.mathjax.org/en/latest/server/components.html

@WrathfulSpatula
Copy link
Collaborator

Let me clarify the difficulty to date in adding MathJax to Metriq:

By default, MathJax renders once on initial page load. However, Metriq doesn't actually have the applicable content loaded by the time of the initial page load, because it uses client-side rendering. To make MathJax work, it's necessary to manually call for it to render whenever a view finishes rendering content from API requests.

This isn't easy. For that matter, React.js plugins that render MathJax commonly rely on inserting formulas into React.js tags, which works for static content, but we'd actually have to parse LaTeX expressions out of API requests and wrap them in React.js tags, (and alter the DOM). Some plugins might work with in-line expressions, but it's still difficult to get this to work with client-side rendering from content in API requests.

Again, this is surprisingly hard! We also can't go the route of server-side rendering, as this contradicts the fundamental the Web development paradigm of Metriq. MathJax is a high-value addition, but we can't just drop the script into the main HTML file and expect it to work at all.

@Aaron-Robertson
Copy link
Contributor

Aaron-Robertson commented May 30, 2023

@WrathfulSpatula Can we use KaTeX instead of MathJax? I'm looking at react-katex (npm, gh) and my impression is that it's better suited to our client-side rendering (since it doesn't require DOM manipulation, and rather uses the virtual).

@WrathfulSpatula
Copy link
Collaborator

@Aaron-Robertson Sounds good to me! If it works for client-side rendering, definitely!

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