Skip to content
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

singleton module prevents simultaneous multiple configurations #37

Closed
anandthakker opened this issue Oct 13, 2014 · 13 comments
Closed

singleton module prevents simultaneous multiple configurations #37

anandthakker opened this issue Oct 13, 2014 · 13 comments

Comments

@anandthakker
Copy link

The problem: there's important module-scoped variables in mj-page, making it a singleton. This makes it awkward to have multiple configurations going in the same program. And actually, because of #36, there's no clear workaround. Conversely, changing this would basically remove the need for restarting MathJax, which is what 36 is about.

Two use cases for why it would be good to have the API be "instanceable":

  1. A prerender server that takes the output format as a query parameter. (I'm working on one now, in fact.)
  2. Testing: running the API (or something that depends on it) through multiple tests is currently problematic.

I'm advocating for something like:

var mathjaxnode = require('MathJax-node');

var api1 = mathjaxnode(config1);
var api2 = mathjaxnode(config2);

Where config1 and config2 are configuration objects in the form currently expected by config().

Happy to work up a PR for this if the maintainers are in support.

@pkra
Copy link
Contributor

pkra commented Oct 14, 2014

Thanks for those your bug reports.

Those are interesting use cases that we (obviously) had not considered (mostly because for MathJax itself cannot reconfigure all components by just changing the configuration).

We're definitely open to a pull request here though the approach will probably need a bit of discussion with @dpvc (who is busy). But perhaps you can draw up something to base a discussion on? (Oh, and we'd also need a CLA eventually, see http://www.mathjax.org/cla/)

@anandthakker
Copy link
Author

@pkra Yep, I can open an initial PR to start discussion, though it might have to wait a day or few as I finish up some other work. I went ahead and signed the CLA.

If you want to play around with it, the (very rough) prerender server I mentioned is here: https://github.com/anandthakker/prerender-mathjax . My particular reason for building it is ultimately to target PDF output (via PrinceXML) for a series of math textbooks that I'm moving to HTML.

@pkra
Copy link
Contributor

pkra commented Oct 15, 2014

Thanks for signing and confirming the CLA. No rush at all; things are busy anyway. Thanks for the link!

@geyang
Copy link
Contributor

geyang commented Oct 15, 2014

let me clean up and finish my PR. I will try to get to this tonight
@pkra. It does not solve the problem in this issue, but the PR will be a
bit more complicated to merge after work on this starts.

On Wed, Oct 15, 2014 at 11:32 AM, Peter Krautzberger <
notifications@github.com> wrote:

Thanks for signing and confirming the CLA. No rush at all; things are busy
anyway. Thanks for the link!


Reply to this email directly or view it on GitHub
#37 (comment).

@pkra
Copy link
Contributor

pkra commented Oct 16, 2014

@episodeyang are you referring to a different issue / pull request?

@geyang
Copy link
Contributor

geyang commented Oct 16, 2014

yes! sorry about the confusion. It is about #26 which fixes #25 .

@pkra
Copy link
Contributor

pkra commented Oct 16, 2014

No worries. I just wanted to make sure 😄

@pkra pkra added this to the Once upon a v3.0 milestone Feb 18, 2016
@pkra
Copy link
Contributor

pkra commented Apr 11, 2016

This bug is about mj-page so please note #206; I'm guessing some of this applies to mj-single as well though.

@pkra pkra added Upstream and removed Upstream labels Feb 22, 2017
@pkra
Copy link
Contributor

pkra commented Feb 23, 2017

I'm not sure what to do about this issue. It's an upstream issue and we plan to address it in MathJax v3. However, we expect MathJax v3 to run in nodejs straight away, so mathjax-node will become somewhat obsolete. Also, in my experience, the most commonly requested configuration changes (e.g., input and output options, pre-processor configurations) can be changed relatively easily, especially when re-building mj-page using mj-single/main.

I'm leaning towards closing this.

@anandthakker
Copy link
Author

👍 I'm fine closing this, esp. given the note about MathJax v3.

@pkra
Copy link
Contributor

pkra commented Feb 23, 2017

@anandthakker I'd still be curious to learn more about the configuration options that were causing issues for you.

@anandthakker
Copy link
Author

@pkra ack... unfortunately, the use case is long gone, and I don't actually remember the specific config options that were problematic.

@pkra
Copy link
Contributor

pkra commented Feb 23, 2017

Ah, I had feared as much. Thanks for the follow up!

@pkra pkra removed this from the After MathJax v3.0 milestone Mar 21, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants