mathjax / MathJax-node

MathJax for Node
Apache License 2.0
615 stars 97 forks source link

No css output without html or htmlNode #292

Closed pkra closed 7 years ago

pkra commented 7 years ago

Extracting this from https://github.com/mathjax/MathJax-node/pull/289#issuecomment-279821382

[...] to handle requests for css when there is no request for html or htmlNode. You may want to move line 594 to the top of that function, right before line 566.

If I make the change, the following test still fails.

 var tape = require('tape');
var mjAPI = require("../lib/main.js");

tape('CSS output', function(t) {
    t.plan(1);
    mjAPI.start();
    var tex = 'x';
    mjAPI.typeset({
        math: tex,
        format: "TeX",
        css: true
    }, function(data) {
        t.ok(data.css, 'css output while no other output');
    });
});

Digging a little bit, CHTMLSTYLES is undefined at that point. Maybe it's a restarting issue?

dpvc commented 7 years ago

OK, I checked a little further, and I had misremembered how things worked. I thought both output jax had been forced to load, but it is only the input jax that are forced. The output jax defaults to SVG unless data.html (or now data.htmlNode) is specified, so that's why the CHTMLSTYLES its undefined. So you are probably right, adding data.css to line 687 is probably the answer. you will also need to add it to line 787, I suspect, so that if both data.css and data.svg are specified (an unlikely case), you get both.

pkra commented 7 years ago

Merged into develop.