[tex2svg-page]-like processing: styles only included in first rendering
Sorry for the convoluted title. I'm not sure if the following is expected or not.
Say you do the following (based on https://github.com/mathjax/MathJax-demos-node/blob/master/direct/tex2svg-page)
const { mathjax } = require('mathjax-full/js/mathjax.js');
const { TeX } = require('mathjax-full/js/input/tex.js');
const { SVG } = require('mathjax-full/js/output/svg.js');
const { RegisterHTMLHandler } = require('mathjax-full/js/handlers/html.js');
const {
BaseConfiguration,
} = require('mathjax-full/js/input/tex/base/BaseConfiguration.js');
const { jsdomAdaptor } = require('mathjax-full/js/adaptors/jsdomAdaptor.js');
const { JSDOM } = require('jsdom');
const adaptor = jsdomAdaptor(JSDOM);
RegisterHTMLHandler(adaptor);
const tex = new TeX({
packages: [
BaseConfiguration.name,
],
});
const svg = new SVG({
fontCache: 'global',
});
const run = (documentstring) => {
const mj = mathjax.document(documentstring, {
InputJax: tex,
OutputJax: svg,
});
mj.render();
return (
adaptor.doctype(mj.document) + adaptor.outerHTML(adaptor.root(mj.document))
);
};
console.log(run(`<!DOCTYPE html><html lang="en">$$x$$ </html>`))
console.log(run(`<!DOCTYPE html><html lang="en">$$x$$ </html>`))
Then the second output will not include the SVG output styles (<style id="MJX-SVG-styles">...</style>
).
Is this expected? It makes it slightly difficult to test multiple page renderings.