This is due to an outstanding bug in the upstream markdown library.
<details>
<!-- ignore the backslashes; markdown in markdown is hard -->
\`\`\`yaml
foo
\`\`\`
</details>
Renders as
<details>
<!-- ignore the backslashes; markdown in markdown is hard -->
\`\`\`
foo
\`\`\`
</details>
Instead of
<details>
<pre><code>
foo
</code></pre>
</details>