New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@picperf/rehype

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@picperf/rehype

A Remark plugin for optimizing images with PicPerf.io.

latest
npmnpm
Version
0.6.0
Version published
Maintainers
1
Created
Source

@picperf/rehype

Use this plugin to transform the URLs in your Markdown images into PicPerf URLs, ready to be optimzed.

Install the Package

Run npm install @picperf/rehype.

Usage

Wire it up by importing the plugin and configuring it with your Markdown setup. Here's an example from Astro:

import { rehypePicPerf } from "@picperf/rehype";

export default defineConfig({
  markdown: {
    rehypePlugins: [rehypePicPerf],
  },

  // Other stuff...
});

Overriding Transformations

By default, absolute URLs will be prefixed with "https://picperf.dev". If you'd like to override this behavior for particular URLs, you can use the shouldTransform() option:

markdown:{
    rehypePlugins: [[ rehypePicPerf, {
        shouldTransform: (url) => {
            // Return a boolean based on the URL, or not.

            return false;
        }
    }]],
},

Setting a Host

Out of the box, this plugin will not transform image root-relative URLs, like this:

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

In order to transform these, pass a host option. That value will be used when transforming the URL:

markdown:{
    rehypePlugins: [[ rehypePicPerf, {
        host: "https://macarthur.me"
    }]],
},

Questions?

Get in touch by finding me on Twitter/X or my website.

Keywords

image optimization

FAQs

Package last updated on 07 Dec 2025

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