New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@fedek6/rehype-img

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@fedek6/rehype-img

Rehype plugin for `next-mdx-remote`. By using it you can rewrite image src to whatever you like.

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2
decreased by-60%
Maintainers
1
Weekly downloads
 
Created
Source

rehype-img-src

Rehype plugin for next-mdx-remote. By using it you can rewrite image src to whatever you like.

Example

  • dir is used for a server path.
  • url is used for public url.
  const source = await serialize(file.content, {
    mdxOptions: {
      // use the image size plugin, you can also specify which folder to load images from
      // in my case images are in /public/images/, so I just prepend 'public'

      rehypePlugins: [
        [
          setImageSrc,
          {
            dir: "public/images/hello-world-3/",
            url: "/images/hello-world-3/",
          },
        ],
      ],
    },
  });

This way you can use:

![my image](./test.jpg)

And copy assets to /public of a Next.js instance.

More docs soon...

FAQs

Package last updated on 09 Aug 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc