-
Notifications
You must be signed in to change notification settings - Fork 213
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 a linkedom adaptor (mathjax/MathJax#2833) #774
Conversation
Thanks @dpvc . When do you think this will get integrated into MathJax? |
It will be merged into |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As this is now the third adaptor which share very similar components (with liteAdaptor
, jsdomAdaptor
) I believe that it is time to refactor the common elements into an abstract superclass.
As a common superclass might not fit, as some inherit from |
I did that in the next PR. I didn't do it here because I referred the original requester to this PR to get the linkedom adaptor until this is public. So the refactoring was in a separate PR.
I considered that, but used a mix-in instead. |
I also thought about that. But having tried to explain mixins here for an afternoon, I am now aware that they add considerable hurdles to understanding the code. |
Yes, some can be complicated, and not quite as flexible as I would like. But the one used here is less complicated than the more sophisticated ones need for MathItem and MathDocument render actions (which are pretty horrible). So I thought this was reasonable. I, too, which there were an easier way to deal with multiple inheritance. |
return this.outerHTML(node); | ||
} | ||
|
||
/** |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not use a pollyfill for getComputedStyle?
E.g. see https://gist.github.com/abbotto/19a6680bf052e8c64f6e and https://github.com/mikemadest/jest-environment-linkedom/blob/main/src/get-computed-style-polyfill.js
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(Sorry, see my comment below. I entered it in the wrong box.)
Both of the links you provide are only polyfills to get a version of To get a version of |
Got it. I see the problem. If it's a similar problem with the other adapters, it shouldn't be a show stopper here. |
Yes, all the node-based adaptors have the same issue. The |
@dpvc thank you for the detailed help you've offered me here. I really appreciate it. I've been trying to figure out how to use the develop branch in my project to make use of the linkedom adapter, but it seems Mathjax has a confused build process that npm can't understand. I thought that this would work,
but it doesn't. This does pull the development version into node_packages, but it doesn't actually build anything. Is it possible that this could be fixed by adding the right "build" script to package.json in the develop branch? Or is there another trick for importing and building mathjax from github using npm? Or is there a way to get the development branch from the npm registry somehow? |
You are right that the GitHub repository doesn't include the compiled or webpacked versions of the files, and doesn't build those on install. You would need to
The last line is only needed if you are using one of the component-based means of accessing MathJax. If you use the direct approach, only the first three lines are needed. |
(sorry, left out one line. You probably need |
This PR adds an adaptor for the linkedom node-based DOM implementation.
Resolves issue mathjax/MathJax#2833.