I am attempting to set up a set of shortcodes that will wrap the inner shortcode content in some html, and render the markdown inside, as shown in this video on https://gohugo.io/ . At the end of this video this is made possible by using {{% in the shortcode call.
When a block tag is used in the shortcode template itself, around the {{ .Inner}}, the markdown is not rendered. This is not what is shown in the tutorial, as a <p> tag is successfully used.
Based on the documentation and the tutorial I expected the markdown to be rendered and the result inserted into whatever html was in the shortcode, not for the unrendered markdown to be passed into the shortcode and then the shortcode rendered.
Test case:
contentfile.md
This is rendered as markdown **markdown**
{{% foo %}}
This is rendered as markdown **markdown**
{{% /foo %}}
{{% bar %}}
This is rendered as markdown **markdown**
{{% /bar %}}
{{% baz %}}
This is not rendered as markdown **markdown**
{{% /baz %}}
foo.html
{{ .Inner }}
bar.html
<span>{{ .Inner }}</span>
baz.html
<p>{{ .Inner }}</p>
I asssume this is Hugo 0.55?
Sorry - yes 0.55. I found {{ .Inner | markdownify }} works as a workaround, but I thought this was the purpose of using % in the shortcode call.
Please read the release notes for 0.55. We will get the docs updated soon, but it's Easter so a little slow in the Hugo Enterprise.
I'm not sure I understand this change 馃 what's the difference between using % and < now, if both don't render Markdown?
Thanks
I confirm the same issue with hugo 0.55.6
Inside a shortcode, <figcaption>{{.Inner}}</figcaption> is not rendered as a markdown (raw content is displayed), while <span>{{.Inner}}</span> is rendered correctly by markdown engine.
Inserting {{ $_hugo_config := `{ "version": 1 }` }} in the top of the shortcode renders markdown correctly.
Looks like all block html tags are not rendered while inline html tags are rendered.
@bep Why is this issue closed?
This might clarify things a bit: https://discourse.gohugo.io/t/misunderstanding-of-shortcode-syntax-in-0-55/18538
Most helpful comment
I'm not sure I understand this change 馃 what's the difference between using
%and<now, if both don't render Markdown?Thanks