(You should be able to edit your recent posts now, I bumped your forum level up to “known human”.
Bots like to post one thing that sounds vagualy plausible and then edit spam into the post a week or two later, hence the automatic restriction on new accounts.)
So yes, with a little alteration you could throw all of what you’re doing with Automator into the Processing pane and just have that execute as part of clicking the Compile button. There is little reason not to do that (unless your .md files tend to come from multiple sources, not just Scrivener), as there are flags for keeping the source files around in case you tend to make modifications between compile and final output, or just want to skip the whole re-compile phase (the slowest part) to fix typos you spot. But with the removal flags enabled the output is very clean: you get only the .docx file.
The main tweak you would want to make is to how the output name and input .md file are referred to. I’ve attached a simple little demonstration of how that can be done.
Pandoc (DOCX).scrformat (22.6 KB)
Drop the .scrformat file into your project’s compile Format sidebar to import it, double-click to edit, and then in the Processing pane, click the edit button to examine the script. It’s just your basic Bash stuff here, using $1 and $2 as taken from the arguments we provide in the text field below the scripting area.
That should also solve your image path problem as well, as Scrivener will be running your script from the output location, where the images will also be.
I suspect that if you were to break your process down into manually run steps, doing things exactly as Automator would, that when you run the Pandoc script you’ll be getting a bunch of errors about missing images. That’s because it is where Pandoc runs from that matters, not where the .md file is located relative to the resources. Kind of weird if you aren’t expecting it (though it is fairly normal for shell commands), but it does allow for some interesting use-cases, like running Pandoc from different resource folders to build different documents (maybe B&W for laser print, small-res for online distribution, high-res calibrated CMYK for print, etc.).
In any case, when I open up the md file in an editor, none of my images with scaling attributes appear there. If I go and manually remove the scaling attributes, then they appear in the md editor.
Your Markdown editor may not be capable of parsing Pandoc syntax, but you should check the options to see if it has a switch somewhere for that. At any rate it appears to be unrelated since they start working once you remove the Pandoc-specific scaling information.