I have a shortcode for rendering abbreviations. As it’s simplest, the shortcode is called with {{< abbr "html" >}}
, the shortcode template looks up a definition within .Data
using the passed argument as a key and then outputs something like <abbr title="Hypertext Markup Language">HTML</abbr>
.
However, I can’t use this shortcode within a Markdown link, e.g. check out the [{{< abbr "html" >}} standard](https://html.spec.whatwg.org/multipage/)
; it gets rendered literally as check out the <a href="https://html.spec.whatwg.org/multipage/">{{< abbr "html" >}}</a>
.
Is there anyway to force Hugo to process the shortcodes in the content file first, before passing the result to the Markdown renderer? I can’t see anything in the Goldmark configuration that would be relevant here.
Or, is it possible to use something like resources.ExecuteAsTemplate
within the Markdown render hook for a link? For reference, my render-link.html
file is:
<a href="{{ .Destination | safeURL }}"{{ with .Title}} title="{{ . }}"{{ end }}{{ if strings.HasPrefix .Destination "http" }} target="_blank" rel="noreferrer noopener"{{ end }}>{{ .Text | safeHTML }}</a>