Closed pkra closed 5 years ago
The state
property is not intended to be configurable itself. It is expected to be one of two values: either a blank object {}
, or a state object from a previous call. It represents internal state data that mathjax-node maintains itself, not configuration parameters that you set. So setting state.ID
as you have done is not a supported (indeed, you are not supposed to be aware of the structure of the state itself, as it is internal data that could change between versions).
The reason your setting it doesn't affect the first call is that the state is only used to initialize mathjax-node if it is a "complete" state (as opposed to an empty state). Mathjax-node uses the presence of the state.AMS
sub-object to decide if the state is already initialized, and since your state doesn't have that, it is considered to be a blank state and is not used initially (it is only used to store the state as it is after the typeset call is made). So your initial value of ID
is not used, as you have seen. In order to to get your ID value to be used, you would need to provide a complete state object, including all the values it holds.
I think the correct solution is to provide an actual configuration property for the ID, as you suggest in #427.
I'm ok with implementing an option for the IDs. But...
you are not supposed to be aware of the structure of the state itself,
The state is documented at https://github.com/mathjax/MathJax-node#promiseresolveresultoptions--promiserejecterrors--callbackresult-options, so I would have expected that part to be stable. If it's not, then the readme should reflect which parts are. For example, I think we definitely need to know where to find the glyphs if useGlobalCache
is used.
duplicate from above
Sorry for the double post -- Firefox remembers the comment when re-opening a closed tab.
The following seems like a bug: