Here’s what I put together. I actually think it turned out pretty much complete, but if not, hopefully it will be a solid starting point for you.
First of all here are two Drafts (specifically Drafts 5) actions that are intended to run against an empty draft. They just insert a block of text at the current cursor position.
Next are the two bits of automation that process the content of a templated draft. First is the Drafts action that extracts the data and builds the HTML. Second is the Shortcuts custom shortcut that the Drafts action calls to create and share the PDF. Make sure you have the Shortcuts shortcut installed before you try running the Drafts action.
The Drafts action parses the draft content and splits the sections based on the level 1 Markdown headings. It uses the heading and the section content to generate Drafts template tags, which can then be referenced in other places. Once the tags are generated, the HTML is generated using those placeholder tags (I fixed a few formatting issues that came through from the original template, so it should look even cleaner than the original with any luck).
At this point the Drafts action shows a preview. you can disable this once you are happy with the results.
Drafts Action Preview
After selecting continue, the Drafts action will trigger the Shortcuts custom shortcut, and will pass in the HTML.
The custom shortcut will convert the HTML to rich text and convert that into a margined PDF. It has to be portrait is the only restriction here. The shortcut includes another preview; again you can disable it if you wish.
Shortcuts PDF Quick Look
Finally the share sheet is opened for sharing the PDF.
Anyway, that’s basically it. Hopefully that’s the sort of thing you were after.