Coder Social home page Coder Social logo

Comments (15)

pkra avatar pkra commented on May 20, 2024

The reason is that svg2png depends on PhantomJS and one of core requirements of MathJax-node was to get away from PhantomJS.

AFAIK, there is no pure JS svg2png converter out there. In our experience, Batik performance is better and more stable compared to PhantomJS (but that might be worth re-evaluating).

In any case, we should make it easier to switch converters. I'm not sure how the others feel but simply dropping Batik does not seem ideal to me at this point.

from mathjax-node.

everyx avatar everyx commented on May 20, 2024

@pkra Thanks for you reply, close this issue.

from mathjax-node.

pkra avatar pkra commented on May 20, 2024

Let me re-open and rename this. I definitely want us to abstract the PNG conversion; it should be as converter independent as possible. Since svg2png is authord by Domenic it would be a good model to follow for an NPM bridge to Batik.

from mathjax-node.

everyx avatar everyx commented on May 20, 2024

๐Ÿ‘

from mathjax-node.

pkra avatar pkra commented on May 20, 2024

See also #65 (comment)

from mathjax-node.

SamyPesse avatar SamyPesse commented on May 20, 2024

๐Ÿ‘ svgexport works great

from mathjax-node.

pkra avatar pkra commented on May 20, 2024

@SamyPesse see my earlier comment regarding our original requirements.

from mathjax-node.

physikerwelt avatar physikerwelt commented on May 20, 2024

I agree that both solutions java and phantomjs are not ideal.
I think one of svgexports advantages is that no file needs to be written on "disk".
A node only solution would be awesome, but I guess it's a very challanging tasks, which can not be done a few after work sessions.
(ping @gwicke)

from mathjax-node.

pkra avatar pkra commented on May 20, 2024

Some recent observations

  • Over on the Wikimedia fork, there's a PR building on rsvg, wikimedia#16. Biggest immediate question from my end was: is that a bad dependency?
  • But I just noticed that jsdom now handles canvas via https://www.npmjs.com/package/canvas. That seem to me to be the most natural approach ("universal JS" etc) despite having similarly bad installation requirements on node.

from mathjax-node.

pkra avatar pkra commented on May 20, 2024

Note: I haven't actually tested if the canvas solution for jsdom would be sufficient.

from mathjax-node.

gwicke avatar gwicke commented on May 20, 2024

Some quick notes from my end:

  • We use (a patched version of) rsvg for SVG thumbnailing in production. It is working okay, but lacks support for some features like HTML-in-SVG. There is some RSVG-related discussion on https://phabricator.wikimedia.org/T40010.
  • Latest phantomjs (2.0) is based on relatively recent Blink, so likely has similar SVG support as current Chrome. However, binding support for node is mostly still using phantomjs 1.9. We don't currently use phantomjs in production, but might reconsider it for tasks like HTML-to-PDF in the future.
  • I can't vouch for the quality or performance of the jsdom canvas solution. The dependencies are manageable (we have a few services using it).

from mathjax-node.

d00rman avatar d00rman commented on May 20, 2024

My 2 cents here would be to develop an extension point for MathJax so that people can hook up and test whatever suits them better, while still having a sane default. What is that sane default is arguable, ofc, but the way I see it is that it's sane if it doesn't introduce many (especially binary) external dependencies regardless of the performance penalties or feature set. These could be then mitigated on a case-per-case basis with specialised converters.

from mathjax-node.

pkra avatar pkra commented on May 20, 2024

Thanks for the feedback, @gwicke @d00rman -- much appreciated!

from mathjax-node.

pkra avatar pkra commented on May 20, 2024

See #174 for a first attempt.

from mathjax-node.

pkra avatar pkra commented on May 20, 2024

Closed in favor of #205.

from mathjax-node.

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.