Extract preamble
Callisto uses mitex (and cmarker) to parse LaTeX commands in Jupyter Notebooks.
Part of their capability is that some cell can define a \newcommand, and a few cells further down, this command can be used.
Since those are different cells, this means those are two different calls to #mitex (or #mitex-convert).
But the \newcommand defined in the first call, should be remembered, since the second call doesn't have this...
This issue is already discussed here, and we could do some crude workarounds (using regexes to extract \newcommand), but it would be really beneficial if mitex itself could extract these commands and either retain state (probably not wanted) or return these preambles (then the caller can combine these like shown in https://github.com/mitex-rs/mitex/pull/192).
For example (see the referenced issue in callisto):
// But something equivalent for mitex, since cmarker actually only directly calls mitex
#let (out1, preamb) = cmarker.render(markdown1, extract-preamble: true)
#let (out2, preamb) = cmarker.render(markdown2, extract-preamble: true, preamble: preamb)
#let (out3, preamb) = cmarker.render(markdown3, extract-preamble: true, preamble: preamb)
// the preamble argument would be specified like shown in #192