Ignoring fragments of markup - Taritsyn/WebMarkupMin GitHub Wiki
If you have fragments of markup, that you would like to preserve, then wrap them in a ignoring comment tags:
<!--wmm:ignore-->
<div class="mermaid">graph TD;
A-->B;
A-->C;
B-->D;
C-->D;
</div>
<!--/wmm:ignore-->