2. Related to my workaround above, I am wondering if there's a way to refer to a source block as the macro definition. At the moment I just joined my whole elisp block into a single line for the macro definition, but I would love to have it in a proper source block so I can edit it properly, have indentation and syntax highlighting, etc.
How about adding this to your emacs config:
(defun my/org-macro-keys-code (str)
"Split STR at spaces and wrap each element with `~' char, separated by `+'."
(mapconcat (lambda (s)
(concat "~" s "~"))
(split-string str)
(concat (string ?\u200B) "+" (string ?\u200B))))
Make sure that that always evaluates before you do Org exports, and then simply use this in your Org files:
#+macro: keys (eval (my/org-macro-keys-code $1))
{{{keys("Ctrl c Ctrl e H H")}}}
PS: Thanks for sharing that code! You are following the vision of ox-hugo.. replacing Hugo shortcodes with Org macros :+1: :)