Currently we use innerHTML to do the initial text render (including <tspan>s), and then augment things after a render cycle. This is ugly when we have already rendered LaTeX components but can't even set the width of the relevant <tspan> until after we see a rendered version.
Maybe requestAnimationFrame could help over setTimeout.
Alternatively, if we manipulated the DOM directly, we could at least set the <tspan>'s width correctly (if LaTeX already rendered). Perhaps we should even re-use LaTeX rendered elements instead of recreating them, and update their location after render but assume their previous locations were pretty close.
Currently we use
innerHTML
to do the initial text render (including<tspan>
s), and then augment things after a render cycle. This is ugly when we have already rendered LaTeX components but can't even set the width of the relevant<tspan>
until after we see a rendered version.requestAnimationFrame
could help oversetTimeout
.<tspan>
's width correctly (if LaTeX already rendered). Perhaps we should even re-use LaTeX rendered elements instead of recreating them, and update their location after render but assume their previous locations were pretty close.