npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

gatsby-remark-picture

v1.0.1

Published

Transform images to responsives pictures

Downloads

36

Readme

gatsby-remark-picture

npm package

Features

  • Wrap images by a <picture> tag.
  • Make remark images reponsives by generating differents sizes
  • Add a <source> tag with srcset, sizes and type attributes.

With gatsby-remark-picture

Hello Word!

![](image.jpg)

The previous markdown will generate the following DOM:

<div>
  <p>Hello Word!</p>
  <picture>
    <!-- With "withWebp: true" option -->
    <source
      srcset="
        /static/image-e5090913465832b3ea4cd5728e0970b2-0a74b.webp 200w,
        /static/image-e5090913465832b3ea4cd5728e0970b2-4de56.webp 400w,
        /static/image-e5090913465832b3ea4cd5728e0970b2-d9af4.webp 800w,
        /static/image-e5090913465832b3ea4cd5728e0970b2-6c443.webp 1200w,
        /static/image-e5090913465832b3ea4cd5728e0970b2-4010f.webp 1600w,
        /static/image-e5090913465832b3ea4cd5728e0970b2-17ee1.webp 2400w,
        /static/image-e5090913465832b3ea4cd5728e0970b2-64024.webp 4240w
      "
      sizes="(max-width: 800px) 100vw, 800px"
      type="image/jpeg"
    >
    <!-- With "withSource: true" option -->
    <source
      srcset="
        /static/image-e5090913465832b3ea4cd5728e0970b2-0a74b.jpg 200w,
        /static/image-e5090913465832b3ea4cd5728e0970b2-4de56.jpg 400w,
        /static/image-e5090913465832b3ea4cd5728e0970b2-d9af4.jpg 800w,
        /static/image-e5090913465832b3ea4cd5728e0970b2-6c443.jpg 1200w,
        /static/image-e5090913465832b3ea4cd5728e0970b2-4010f.jpg 1600w,
        /static/image-e5090913465832b3ea4cd5728e0970b2-17ee1.jpg 2400w,
        /static/image-e5090913465832b3ea4cd5728e0970b2-64024.jpg 4240w
      "
      sizes="(max-width: 800px) 100vw, 800px"
      type="image/jpeg"
    >
    <img
      srcset="
        /static/image-e5090913465832b3ea4cd5728e0970b2-0a74b.jpg 200w,
        /static/image-e5090913465832b3ea4cd5728e0970b2-4de56.jpg 400w,
        /static/image-e5090913465832b3ea4cd5728e0970b2-d9af4.jpg 800w,
        /static/image-e5090913465832b3ea4cd5728e0970b2-6c443.jpg 1200w,
        /static/image-e5090913465832b3ea4cd5728e0970b2-4010f.jpg 1600w,
        /static/image-e5090913465832b3ea4cd5728e0970b2-17ee1.jpg 2400w,
        /static/image-e5090913465832b3ea4cd5728e0970b2-64024.jpg 4240w
      "
      src="/static/image-e5090913465832b3ea4cd5728e0970b2-d9af4.jpg"
    >
  </picture>
</div>

Note: To remove the paragraph tag wrapping the picture tag, you can use gatsby-remark-unwrap-images plugin before gatsby-remark-picture

Without gatsby-remark-picture

Hello Word!

![](image.jpg)

The previous markdown will generate the following DOM:

<div>
  <p>Hello Word!</p>
  <p>
    <img src="image.jpg" />
  </p>
</div>

Getting started

gatsby-remark-picture

You can download gatsby-remark-picture from the NPM registry via the npm or yarn commands

yarn add gatsby-remark-picture
npm install gatsby-remark-picture --save

Usage

Add the plugin in your gatsby-config.js file:

module.exports = {
    plugins: [
        {
            resolve: "gatsby-transformer-remark",
            options: {
                plugins: [
                    // Optional: Remove the paragraph tag wrapping images
                    "gatsby-remark-unwrap-images",
                    // Wrap images by pictures
                    "gatsby-remark-picture",
                ],
            },
        },
    ],
}

Props

| Name | PropType | Description | Default | Example | | -------------- | -------- | -------------------------------------------------- | ------- | ------------------- | | className | string | Add custom className | - | "myCustomClassName" | | withSource | boolean | Add a <source> tag with responsives images | false | true | | withSourceWebp | boolean | Add a <source> tag with responsives .webp images | false | true |

Contributing

  • ⇄ Pull/Merge requests and ★ Stars are always welcome.
  • For bugs and feature requests, please create an issue.

See CONTRIBUTING.md guidelines

Changelog

See CHANGELOG.md

License

This project is licensed under the MIT License - see the LICENCE.md file for details