Perhaps tidy -i should better respect that this comment was not
associated with any line:
<p>A</p>
<!-- COMMENT -->
<p>B</p>
Which alas becomes
<p>A</p><!-- COMMENT -->
<p>B</p>
At least it should be like plain tidy,
<p>A</p>
<!-- COMMENT -->
<p>B</p>
tidy 5.6 HTML 5.