I am unable to reproduce the behavior as described. Try it:
git clone --single-branch -b hugo-forum-topic-48080 https://github.com/jmooring/hugo-testing hugo-forum-topic-48080
cd hugo-forum-topic-48080
hugo server
To achieve this:
<div class="notice">
<p><span class="foobar">Foobar</span>
Lorem ipsum dolor.</p>
</div>
Your reproduction example does not have a blank line though and it still works
Must be something else in our setup then.
I also notice that in your example the {{< foobar >}} never gets wrapped in a <p> tag, even in regular content, which is also unexpected. For example, in your setup
Also, as a rule of thumb, when examining the rendered HTML, view source (Ctrl+U in your browser) instead of relying on the browser’s dev tools. The dev tools willl correct invalid HTML, so in some cases you won’t see what is actually rendered.
Include a link to the source code repository of your project, because we really need the context of seeing your templates and partials to be able to help you. It is trivial to do a quick git clone on your repo, then run hugo server in your project, to help you out. On the other hand, recreating your code from screenshots, or sort of guessing at it, is not.
If you can’t share your repository for whatever reason, consider creating a dummy repo that you can share, which reproduces the problem you’re experiencing.
You are introducing lots of new lines in your version-tag shortcode. Per the CommonMark link I provided earlier, you need to pay attention to new lines when mixing raw HTML with markdown.
Remove the new lines (white space) by replacing {{ with {{- at the beginning of each line.
Then I get this:
<div>
<p>
<span class="version-tag" title="This feature is only available in Contao 123 and later.">
since <strong>123</strong>
</span>
Lorem ipsum dolor.
</p>
</div>
Aaah, yes, thank you very much! I already suspected it’s because of the white space in the inner shortcode and I did test that using {{-/-}} - but something must have gone wrong during testing. (Another issue we currently have is that hugo server says it rebuilt - but the changes are not visible when the browser auto-refreshed, or even when I manually refresh. I always have to do a full rebuild manually.)
Hugo server does not rebuild public. Hugo server runs its own copy. What url are you looking at? I suggest starting a new question. Most forums dont want multiple questions in one thread too difficult for others to find the info.