0.0.3 • Published 1 year ago

recma-import-images v0.0.3

Weekly downloads
-
License
MIT
Repository
-
Last release
1 year ago

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);
  }
0.0.3

1 year ago

0.0.2

1 year ago

0.0.1

1 year ago