GithubHelp home page GithubHelp logo

mathml to asciimath about asciimathml HOT 2 OPEN

asciimath avatar asciimath commented on May 3, 2024
mathml to asciimath

from asciimathml.

Comments (2)

Yaffle avatar Yaffle commented on May 3, 2024

Hi, I am using this conversion when user copies the seletion to the clipboard or starts dragging (by handling copy and dragstart events with js, and using event.dataTransfer.setData(...)):

text-selection

without js code web browsers will put "12πi" into clipboard (text/plain), and I want to have "12/(2*pi)".
Do you know about any other solutions for this issue?
If somebody is interested I can share my selection serialization code.

P.S.
Seems, https://github.com/learningobjectsinc/mathml-to-asciimath ignores operator precedence...

from asciimathml.

pkra avatar pkra commented on May 3, 2024

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.

Seems, https://github.com/learningobjectsinc/mathml-to-asciimath ignores operator precedence...

Thanks. You might want to file a bug on the repo.

from asciimathml.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.