Here’s a quick Keyboard Maestro macro to make it easier to insert images into blog posts, or any other markdown or HTML document really. The details of the macro are set up to create a Hugo figure shortcode, but the Hugo-specific bits are just scaffolding and could be swapped out for whatever you need.
You can download the macro file here, but the whole thing ended up being a bit long so I’m not going to include the usual image of the whole macro (which is 1,965 pixels tall). Let’s step through it.
After selecting the image, we need to load it onto a named clipboard because Keyboard Maestro’s image actions generally work on the contents of a clipboard.
Then we need to prompt the user to confirm the attributes of the figure.
Any of these can be empty, so after assembling the shortcode text blank attributes are removed:
And then lastly the figure shortcode text is inserted by pasting, which is handy because it end up on the clipboard if anything goes wrong — like it did when I changed the focus when inserting the previous screenshot!