What would it take to create a package that provides a lilypond function that invokes the lilypond command and automatically embeds the resulting output? Are there any packages that do something similar?
Impossible at the moment. A package cannot call an external command.
If you want to do that for your personal project, you have to make a custom build script that first runs lilypond, puts the output somewhere, and then renders the Typst document (which includes the lilypond output somewhere).
1 Like
This recent answer may interest you: