Issue using MathJax in Electron (with Vue component)

#1

I’m trying to call the typeset method from mathjax-node from my Vue component in Electron, but the callback method is never called. I tried running the code as a standalone js-file which works fine. However running the same exact code in here doesn’t work.

Am I missing something obvious? Anyone know how to fix this?

#2

Sorry, when I replied to you in the other thread, I misread your statement as being about the interaction of Electron with Vue. It’s very common for threads here to get resurrected by people who don’t actually have the exact same issue.

I have never used MathJax, but I’ve given it a look over and right now I suspect that the culprit might be jsdom. I found this comment:

No, jsdom is an emulation of the DOM in Node.js. If using it, you’ll miss out on most non-DOM APIs (any web API that isn’t DOM related e.g. websockets, web storage, etc).

If jsdom is an emulation, then the code isn’t executing inside the Electron DOM. Based on the MathJax script, it looks like it should direct console messages up to Electron’s console, but it’s not for whatever reason. I don’t know why, but I did find mathjax-electron and would recommend trying that package first to see if it works.

1 Like
#3

Thank you for the reply!

I’ll give mathjax-electron a go (not sure how I didn’t find that one in the first place). I’ll get back to you if it works.

#4

@DamnedScholar, I got it to work with mathjax-electron, thanks a bunch for your help! For anyone who’s interested the (working) code is available here.

1 Like