Markdown inside HTML tags is fine as long as there's a paragraph break (two newlines) between the Markdown and the HTML tag. So it usually goes like:
<detail>
<summary>...</summary>
Some `markdown`
</detail>
I would imagine this sort of behavior is in commonmark, but I am too lazy to check.