-
Notifications
You must be signed in to change notification settings - Fork 1
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
Getting started documentation #1
Comments
Same problem... |
@dschwen @mangecoeur I'm so sorry that its taken me so long to get back to you both. I'll first try to answer your questions, then if you feel like reading on I'll explain how i'd like to improve the package :D Answers to your questions
100% agree, especially when a full installation of MathJax can be ~55MB.
I originally designed this only as an extension to my package To explain the process that I currently use, within So what should your package do. You could copy Questions for youDo you need a full MathJax installation? The reason why I wanted a full MathJax installation is that I wanted HTML rendering. But if you are happy with any other type output MathJax is able to do then without question your best option is What do you need a full MathJax installation for? If the answer is yes to the last question then what would be incredibly helpful is what you would like a full installation of MathJax for so that I can improve How to make this package betterSo in its current state if other package's start using and potentially loading multiple instances of MathJax as i've described ( So my idea is to load MathJax with a minimal configuration very similar to here. In reality i've found such a configuration is not limiting at all, but I would very much like to hear your opinions on what you think should be included. Then I can expose a couple of API methods in If you've made it to the end then thanks so much for taking the time to read everything. I plan to push on with the changes i've suggest and try to make |
@Galadirith Thanks for the extensive reply! I also tried to use I was wondering how you create the script tags for the Math code - do you just create a DOM element from a string? I've had a lot of difficulty understanding how MathJax does its thing - it seems really designed to process math present in an existing page, but while it should also be able to generate math just for a LaTeX string it seems unduly difficult to actually do so... |
ps. if you are interested in making a "proper" package, I think a better place to start would be the official MathJax-node package- but it needs some tweaks and updates to get it working within Atom (I got somewhere with my private fork of the project) |
@mangecoeur I didn't know that about
I agree. But actually its not too difficult to make it process dynamic content. (If you have the time I would strongly suggest reading The MathJax Processing Model. MathJax has a lot of features and configuration options, but this doc page for me was the most useful and important in understanding how MathJax' works, and I'll reference some of the processing stages they talk about on that page)
Creating DOM elements from a string its exactly where I start. You've then got to ask MathJax to process it. I'll give you the steps I use to get it to work:
I was originally using Sorry for another stupidly long post. I hope that answers you questions but please to post back if anything's unclear or you have more questions. Also I'd be more than happy to look at any of your MathJax code on GitHub if your having trouble getting it to work (although I can't promise I'll be able to make it work either :D) |
Thanks, I got it working nicely in the end (https://atom.io/packages/preview-inline) - in the end I bundled MathJax myself, copying your mathjax-helper and Mathjax tarball into my project, since Atom doesn't yet have a good way to auto-install dependent packages i though it might be more reliable than requiring an extra package install step. I had a think about mathjax node - I think the JSDOM issue could be circumvented by making an atom-specific implementation, creating a hidden instance of atom's BrowserWindow instead of using jsdom's virtual window. If you look at the mathjax-node code there's only a small bit that inits jsdom that could be replaced with browser window. The lack of HTML rendering is indeed annoying though, I'm not sure how this could work - from what I see MathJax relies on loading css and fonts dynamically, meaning the Mathjax object has to be available in the host page (you cant just generate an html chunk and pass that around). |
another note - according to https://github.com/mathjax/MathJax/wiki/Understanding-mathjax-performance it's possible to throw away most of what comes in the MathJax download if you assume you are using a modern browser, shrinking the package from 55MB to 5 MB. At these kinds of sizes it probably makes more sense to have an NPM package rather than an atom package, since the cost of embedding a mathjax install in each package that needs it is much smaller. If we are able to use atom's BrowserWindow then we also don't need JSDOM and friends shrinking the package even further. I'm quite optimistic about this, i will try hacking on it sometime soon to see what happens. |
👍 |
@mangecoeur Fantastic :D
I haven't seen that page before but that was some really exciting stuff. So a while ago I learnt about MathJax-grunt-cleaner which manages the task of removing the extra redundant stuff. I've just spun in up now, trimmed MathJax to what is needed and I've ended up with a drop in replacement for mathjax-complete-node that is ~2MB in size at 233 files rather than ~55MB as ~32000 files! and it works :D This is super awesome. Here are some reproducible steps:
I had not thought about using a BrowserWindow but that's definitely a great idea. I guess it might be possible to just copy over the Do you think we really need to spin it off into an isolated window though? The reason to do this would be to allow anyone to configure MathJax as they need it to be. But I'm not really sure if this is something that most people need. Compared to KaTeX for example, KaTeX has practically no configurability, and people seem to be happy with it? I belive that using a single configuration similar to TeX-AMS_HTML (which is essentially what mathjax-helper just without But I would really love to hear you thoughts on why you thinks its important to spin out to another BrowserWindow. |
@dschwen 👍 ;D @mangecoeur And I'm so sorry I only just noticed in mangecoeur/preview-inline@51c9807 that you've already used |
@mangecoeur nice work on mangecoeur/markdown-preview-plus ;D To give an update I've been working on magnetite today which is to try capture what @mangecoeur has done with an MathJax-custom except as a node module. I haven't published this to Initially magnetite with simply guard against loading MathJax multiple times, but I would like to in future versions have MathJax load in to a separate render process as @mangecoeur suggest previous :D |
@Galadirith glad you mentioned your new work, I literally sat down last night to give the same thing a try! I did some research which I will capture as an issue on your magnetite project |
I'm looking to use MathJax from one of my packages and having a single central MathJax package sure beats having a MathJax installation for each package.
But how does this work? Atom does not have package dependencies (as in a global package is installed rather than a nested package). Does your package just expose a global
MathJax
object? Should my package check if the global object exists and if not prompt the user to install the Plugin (or display a message to that effect on Settings page)?A few lines added to the README.md would go a long way to clear up those questions.
The text was updated successfully, but these errors were encountered: