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

Handle math tags properly #45

Open
strogonoff opened this issue Feb 4, 2025 · 3 comments
Open

Handle math tags properly #45

strogonoff opened this issue Feb 4, 2025 · 3 comments

Comments

@strogonoff
Copy link
Contributor

Currently, we do not parse the nested structure of MathML, and simply treat it as a string. In math node’s toDOM(), we create a math element and assign that string to its innerHTML.

This is not a problem during offline rendering. However, react-prosemirror only allows returning array specs from toDOM(). Returning a DOM node causes an error when instantiating ProseMirror component. This is handled generically by falling back to pre-rendered HTML contents if any errors occurs when rendering the editor, so for now it’s not a significant issue, but it would be handy to handle math more properly.

One way of handling it more properly could be converting the MathML string to an array spec in toDOM(). There can probably be a generic function that converts a given serialized DOM string to PM array spec.

@ronaldtse
Copy link
Contributor

For rendering MathML, the proper way is either use the default browser rendering or MathJax (WebKit MathML support is buggy). For accepting other math formats, please preprocess using Plurimath.

@strogonoff
Copy link
Contributor Author

strogonoff commented Feb 5, 2025

Firelight renders MathML as MathML and I intend to keep it that way (maybe adding a polyfill for unsupporting browsers, but that’s another ticket). The ticket is about a slightly different aspect.

@opoudjis
Copy link

opoudjis commented Feb 6, 2025

Note metanorma/isodoc#642: from next release you will need to ignore stem, and process fmt-stem instead. This is to preserve the original MathML where number formatting has been introduced (and where MathML wrappers has been removed, in the case of standalone numbers).

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