I created a custom export command to export markdown with included mermaid and other language fragments as easy as possible using md2pdf, a node.js command line app.
The export dialog let's me choose a target directory - however, I am not able to pick up that directory in the custom command, so that always the directory of the input file applies.