-
Hi there, I have lots of
And in the file
All these image files are not put in assets folder( Gatsby have Here are some ideas:
|
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 1 reply
-
I think you need MDX for that, so you can import the image import image from "./path/to/image"
<img src={image} /> In plain Markdown, you have to move the images to the public folder and then do |
Beta Was this translation helpful? Give feedback.
-
made a little package to do this in remix https://github.com/meoyawn/markdown-assets |
Beta Was this translation helpful? Give feedback.
-
You could use mdx-js to transform Markdown to JSX. Then your Markdown ![](./image.png) gets transformed to something like that: import _rehypeMdxImportMedia0 from './image.png'
export default function MDXContent() {
return (
<p>
<img alt="" src={_rehypeMdxImportMedia0} />
</p>
)
} Here's a Vite config: import mdx from '@mdx-js/rollup';
import rehypeMdxImportMedia from 'rehype-mdx-import-media';
defineConfig({
...
plugins: [
mdx({
rehypePlugins: [
rehypeMdxImportMedia
]
}),
remix({
...
})
]
}) |
Beta Was this translation helpful? Give feedback.
I think you need MDX for that, so you can import the image
In plain Markdown, you have to move the images to the public folder and then do
/path/to/image
, without that the image will not be moved to public automatically.