Weird stray </p> (closing paragraph) tags

This is a post about this weird closing paragraph tag I am experiencing. The solution comes first, the questions in the end):

  • I have several shortcodes
  • The shortcodes contain valid HTML5 markup with block-tags on the outer side (either
    or )
  • Multiple shortcodes come after each other
  • BUG: the markdown processing adds a closing paragraph tag at the end of the list (only a closing tag, not an opening tag anywhere).
  • Sample:

    {{< activities >}}
    {{< onboardmenu >}}
    {{< enquiry >}}
    {{< cancellationterms >}}
    {{< packages >}}
    {{< call-to-action >}}
    

    (as I wrote, all shortcodes have (1) valid HTML and (2) block tags surrounding whatever happens in there.

    Result:

    The shortcodes are parsed correctly, but right behind the last closing tag of the call-to-action shortcode, I got my stray closing paragraph tag.

    The solution is easy:

    <div>
        {{< activities >}}
        {{< onboardmenu >}}
        {{< enquiry >}}
        {{< cancellationterms >}}
        {{< packages >}}
        {{< call-to-action >}}
    </div>
    

    Adding an extra block element around the group of tags will remove the stray-closing-p.

    My questions are:

    • who (Hugo, markdown, me) is making the wrong assumption?
    • why would the process add only the closing paragraph (there must be a bug in here somewhere)?