-
Notifications
You must be signed in to change notification settings - Fork 9
Conversation
I rebased it, because the diff is to large to display ;) |
Should mathjax be included, and not a dependency? |
@minrk Including is better because it's easier to include only what's needed (I explored both for preview-inline). There aren't really any packages on npm or bower which would fit - any 'general purpose' package would by definition include things which aren't needed - and a full MathJax install is a beast because they support many browsers and configurations. Even the subset that jupyter/ipython use is pretty heavy. You go from a 35MB install for the full MathJax, to about 12MB for a semi-slim one like ipython use, to about 3MB when you only need to support Atom/Electron (and i suspect it could be even less with a better understanding of font requirements). |
Gotcha. It might be worthwhile to make that a package, anyway, even within the nteract org: |
I guess that could work, assuming it doesn't add too much administrative overhead. Could be a package or a git submodule. |
This sounds like a great idea, what do you think @lgeiger? I'd use it outside of classic transformime as well (while still in an electron context).
We'll find that out fairly quickly! |
This sounds like a great idea! I'm a bit busy at the moment so it may take a while, but I'll give it a try this evening. |
It can be exactly what you have in here as well, including mathjax-helper.js |
OK I made a new package: mathjax-electron |
I couldn't figure out how to unittest the SVG from |
I was able to do some testing in preview-inline using Atom's testing framework since that gives you access to a DOM page for testing. Basically just test that an element is rendered (i.e. exists after the call). No idea how this works in bare Electron. I think it's reasonable to assume MathJax Just Works since they have their own test suite. |
You may want to work with electron-mocha, that's what we use on nteract/nteract and a few other packages instead of JSDom. Works quite well as a drop-in replacement for |
Maybe I'll try |
Now that the phosphor folks have fully divested from transformime, I think it's reasonable for us to go ahead with this even though it says Electron on the tin (it's more "chrome-like" than Electron I suppose). |
container.type = 'math/tex'; | ||
container.innerHTML = value.replace('<br>', ''); | ||
|
||
mathjaxHelper.loadMathJax(document); |
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.
Will this reload MathJax every time a LaTeXTransform is done?
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.
It should only load the first time: https://github.com/nteract/mathjax-electron/blob/master/src/mathjax-electron.js#L6
Merging, let's keep iterating. Thank you for stellar work as always @lgeiger! |
Oh I'm flattered 😄. Should we do another minor release? |
Sounds great to me. |
Include a slimed down version of MathJax similar to
preview-inline
as proposed by @mangecoeur in #99The file size is
3 MB
in total (mainly the font).I tested it with
![latex](https://cloud.githubusercontent.com/assets/13285808/14413848/84cff6f6-ff86-11e5-8094-c6dec529807b.png)
hydrogen
and it works great: