mdx-util
mdx-util copied to clipboard
relative image path ?
Sorry I was not able to handle by myself...
Have a markdown containing an image tag:

I was assuming, the mdx-loader would resolve the picture from the markdown document file, and then let webpack do the regular job (take the picture, move it to the static dist, hash...) .
But it looks it's not the case... Is it something I can achieve (I mean with regular markdown, without import './img.jpg')
Have you any thoughts ? Thanks
I'd really like to have support for this, but don't have time to implement it right now.
Would you be interested in doing this as a PR?
Same time situation for me, but I would love too... Let's see.
As a workaround, I am using the components prop to modify an img tag with a relative src to an absolute path:
imageFactory = ({ src, ...props }) => {
const imgSrc = src.startsWith('http')
? src
: <construct-absolute-url>
return <img {...props} src={imgSrc} />;
};
// ...
<Document components={{ img: this.imageFactory }}