Why this rather than LyX, Texmacs, Jupyter Notebook, LaTeX (and a suitable editor), or Typst (and a suitable editor)?
replies(2):
Basically we need to marry LyX and Jupyter.
https://github.com/WillAdams/gcodepreview/blob/main/literati...
(with a bit of help from folks on tex.stackexchange.com: https://tex.stackexchange.com/questions/722886/how-to-write-... )
could be used for that --- you'd just need to execute the code once it is written out, then read the files in once they have been made.