I have a shortcode for citations, which just calls a partial and removes leading and trailing spacing:
{{- /**/ -}}{{- partial "cite.html" . -}}{{- /**/ -}}
The partial itself looks like this (simplified):
<cite>{{- .Params.title | markdownify | safeHTML -}}</cite>
And then I have another shortcode for blockquotes (again simplified):
<blockquote>
{{ .Inner | markdownify | safeHTML }}
</blockquote>
However, if I try to call the citation shortcode within the blockquote .Inner
, the resulting HTML gets escaped, and then wrapped into a <pre
>.
Hereās an example of the Markdown content file:
{{< blockquote >}}
This is a **Markdown** test.
This is an <b>HTML</b> test.
This is a {{< q >}}shortcode with closing shortcode{{< /q >}} test.
This is a normal shortcode test: {{< abbr "html" >}}.
This is a shortcode-with-a-partial test: {{< cite title="test" >}}.
{{< /blockquote >}}
ā¦but the resulting HTML looks like:
<blockquote>
<p>This is a <strong>Markdown</strong> test.</p>
<p>This is an <b>HTML</b> test.</p>
<p>This is a <q>shortcode with closing shortcode</q> test.</p>
<p>This is a normal shortcode test: <abbr title="Hypertext Markup Language">HTML</abbr>.</p>
<p>This is a shortcode-with-a-partial test: <cite class=“cite”</p>
<pre><code> itemscope
itemprop="citation"
itemtype="https://schema.org/CreativeWork"
><span itemprop="name">test</span></cite>.
</code></pre>
</blockquote>
If I change the blockquote shortcode to just .Inner | safeHTML
, all of the shortcodes render correctly but the first line with the Markdown doesnāt. If I swap the order (.Inner | safeHTML | markdownify
) the Markdown line renders correctly again, but the shortcode-with-a-partial gets escaped again. If I replace the whole pipeline with .Inner | .Page.RenderString
I get the same result.
Hugo version: hugo v0.115.4-dc9524521270f81d1c038ebbb200f0cfa3427cc5+extended linux/amd64 BuildDate=2023-07 -20T06:49:57Z VendorInfo=snap:0.115.4