numbas / Numbas

A completely browser-based e-assessment/e-learning system, with an emphasis on mathematics
http://www.numbas.org.uk
Apache License 2.0
199 stars 118 forks source link

When saving HTML variables, MathJax's output shouldn't be saved #898

Closed christianp closed 2 years ago

christianp commented 2 years ago

A question has an HTML variable containing some LaTeX, which is inserted into the statement. When the suspend data is saved, the HTML is serialised to a string. When MathJax runs on the HTML element, it replaces LaTeX with its own output. On resuming the attempt, the MathJax elements are present, but without the extra info that MathJax adds to the elements, causing an error.

I think that HTML values should be serialised to a string on creation, and this string should be used when rendered to JME.

But all of this would be avoided if the HTML wasn't saved at all and the value was re-created from its definition on resume, as #828 would do.