-
Notifications
You must be signed in to change notification settings - Fork 183
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
mathml to asciimath #8
Comments
Hi, I am using this conversion when user copies the seletion to the clipboard or starts dragging (by handling without js code web browsers will put "12πi" into clipboard (text/plain), and I want to have "12/(2*pi)". P.S. |
Your image seems to show a selection from an equation rendered on mathjax.org so this probably belongs on the MathJax issue tracker. In any case, this won't work for several reasons. First, MathJax output does not consist of MathML markup (except for the NativeMML output) but renders MathML (which is used internally) into HTML/CSS (or SVG but you won't get selection with SVG content in browsers so I'm assuming you are using the HTML/CSS output). That's why the user selection is selecting HTML fragments (lots of spans basically) and as plain text this will yield a bunch of Unicode characters. To get what you want, you would first have to get the underlying MathML, then figure out which subexpression the user selection corresponds to. That's technically not impossible (since the output has a lot of structure relating to the underlying MathML and you could do more) but there's nothing built into MathJax to do so. After that you would tackle the topic of this issues -- convert that subexpression to asciimath.
Thanks. You might want to file a bug on the repo. |
Another note. https://github.com/learningobjectsinc/mathml-to-asciimath follows an interesting idea -- converting (a subset of) MathML back to asciimath notation.
It reminds me of HTML to markdown converters (which work surprisingly well) and could prove very useful.
The text was updated successfully, but these errors were encountered: