recma-import-images

0.0.3 • Public • Published

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

Readme

Keywords

Package Sidebar

Install

npm i recma-import-images

Weekly Downloads

1,135

Version

0.0.3

License

MIT

Unpacked Size

3.07 kB

Total Files

3

Last publish

Collaborators

  • bradlc