recma-import-images
v0.0.3
Published
recma plugin to import image sources
Downloads
11,542
Readme
recma-import-images
recma plugin to import image sources
Installation
npm install recma-import-images
import { compile } from '@mdx-js/mdx'
import { recmaImportImages } from 'recma-import-images'
let mdx = `![](./image.jpg)`
await compile(mdx, {
recmaPlugins: [recmaImportImages],
})
Example
/*@jsxRuntime automatic @jsxImportSource react*/
+ import image_jpg$recmaImportImages from "./image.jpg";
import {jsx as _jsx} from "react/jsx-runtime";
function _createMdxContent(props) {
const _components = Object.assign({
p: "p",
img: "img"
}, props.components);
return _jsx(_components.p, {
children: _jsx(_components.img, {
- src: "./image.jpg",
+ src: image_jpg$recmaImportImages,
alt: ""
})
});
}
function MDXContent(props = {}) {
const {wrapper: MDXLayout} = props.components || ({});
return MDXLayout ? _jsx(MDXLayout, Object.assign({}, props, {
children: _jsx(_createMdxContent, props)
})) : _createMdxContent(props);
}