Looks like adding allowDangerousHtml:true
to your options should allow the html elements to get through unchanged.
See the readme: https://github.com/micromark/micromark/blob/main/packages/micromark/readme.md#options
import { micromark } from 'micromark';
import { gfm, gfmHtml } from 'micromark-extension-gfm';
const mdd = `
# Title
<div>
This is HTML inside markdown.
<img src="image.jpg" alt="Example image" />
</div>
`;
console.log(micromark(mdd, { allowDangerousHtml:true, extensions:[ gfm() ] }));