A sequence of shortcodes arenāt wrapped with paragraphs if you put Markdown paragraph breaks between them. If you donāt put Markdown paragraph breaks between them, they are wrapped in a paragraph.
I tried putting <span> elements in the shortcodes in case that made a difference, but it doesnāt. I also found another wrinkle:
One shortcode on a line on its own: no paragraph wrapper. Two shortcodes on a line on their own: paragraph wrapper.
So it looks as if the rule is: Two or more shortcodes in succession will always get wrapped in a paragraph, unless you separate them with a blank line.
I donāt think the Commonmark spec explains this behavior, and I donāt recall ever seeing it documented.
I guess as long as people can find this discussion and the workaround, thereās nothing else to be done, because changing Hugoās behavior at this point would likely break thousands of sites.
Iāve updated the example with the four cases on one page, including a detailed explanation of what happens (and why) in each of the four cases.
git clone --single-branch -b hugo-forum-topic-14929 https://github.com/jmooring/hugo-testing hugo-forum-topic-14929
cd hugo-forum-topic-14929
hugo server