I'm interested in using JSXGraph in the context of providing graphics for interactive exercises for the PreTeXt project but there is a need to be able to create static versions for output other than HTML. I'd like to be able to use the same code that is used for the HTML version. Suppose I have the javascript code to generate a figure on a webpage and want to generate it in a scripted setting offline with Node.js.
Is there a way to create an svg outside the browser and without a webpage and save it as a file? I see references online that jsxgraph is part of npm (I have installed it), but I can't find documentation to how it might be used. I am new to node/npm. I found a reference saying to use the command:
JXG = require('jsxgraph')
But when I try JXG.JSXGraph(...) it requires the id of a jxgbox div, which doesn't exist in this context, as there isn't even a document defined.
Does anyone have an example of how this might be done?
Thank you in advance,
D. Brian Walton