I have the Problem, that I fetch HTML (and md) from a headless CMS (Directus). The Problem is that the Images are not optimized. How can I automatically replace all fetched tags with Next`s Image-Component?
This is how I fetch the Html Code:
<div dangerouslySetInnerHTML={ {__html: data.path} }></div>
This is how I fetch MD:
<ReactMarkdown rehypePlugins={[rehypeRaw]}>
{data.path}
</ReactMarkdown>