Hugo

Single paragraph rendered withing shortcode using {{ .Inner }} is missing <p> tag

I have a very simple shortcode that wraps the content in aside tags:

shortcodes/aside.html

<aside>
{{ .Inner | markdownify }}
</aside>

Generally it works as expected, for example:

Input:

{{% aside %}}
The first paragraph

The second paragraph
{{% /aside %}}

Output:

<aside>
<p>The first paragraph</p>

<p>The second paragraph</p>
</aside>

However, if there is just a single paragraph inside then the <p> tags are missing:

Input:

{{% aside %}}
A single paragraph
{{% /aside %}}

Output:

<aside>
A single paragraph
</aside>

I’ve tried adding blank lines around the single paragraph, but that doesn’t affect the output.

Hugo version: v0.58.3-4AAC02D4 windows/amd64

Hi!

This is a known ‘bug’ caused by the markdown renderer, I guess.

This hack I posted recently should help.