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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@davegardner/markdown-it-responsive

v0.2.3

Published

markdown-it plugin for responsive images with support for Netlify Large Media Transforms

Downloads

47

Readme

markdown-it-responsive

Build Status NPM version Coverage Status

A markdown-it plugin for responsive images. This plugin overloads original image renderer of markdown-it.

Usage

Enable plugin

var md = require('markdown-it')({
  html: true,
  linkify: true,
  typography: true
}).use(require('markdown-it-responsive'), options);  // <-- this use(package_name) is required

How to specify options?

The notation to specify responsive sizes is as follows.

// There are two ways to structure responsive image filenames:
// - by suffix eg: header-sample.jpg, sets setsrc files to
//      header-sample-small.jpg
//      header-sample-medium.jpg
// - by using netlify large media transformation querystrings eg: header-sample.jpg sets setsrc files to 
//      header-sample.jpg?nf_resize=fix?w=320
//      header-sample.jpg?nf_resize=fix?w=640
// - in either case the src filename is unchanged. This is problematic with automatically resized files such as
//   netlify transformations because usually the default file is huge. The problem could be solved if netlify
//   supported quality transformations, but they don't.

// BEWARE of overlapping wildcard patterns eg "example-*" and "example-1-*"
// The FIRST matching rule is used
describe('markdown-it-responsive', function () {
  var option = {
    responsive: {
      'srcset': {
        'header-*': [         // <= files matching this wildcard pattern
          {                   // rule 0
          width: 320,         // assign this width
          rename: {           // 
            suffix: '-small'  // file is renamed with this suffix
          }
        }, 
        {                     // rule 1
          width: 640,         // assign this width
          rename: {           // 
            suffix: '-medium' // and rename file with this suffix
          }
        }
          // more rules can go here
        ],
        'missing-params-*': [ // <= files matching this wildcard pattern
          {                     // rule 0
            width: 320,         // assign this width
            nf_resize: 'smartcrop' // use netlify transformations: https://docs.netlify.com/large-media/transform-images/
          },
          {                     // rule 1
            width: 640,         // assign this width
            rename: {           // and rename
              suffix: '-medium' // with this suffix
            }
          }
          // more rules can go here
        ],
        'netlify-*': [        // <= files matching this wildcard pattern (that did not match above)
          {                   // rule 0
            width: 320,         
            nf_resize: 'fit' 
          }, 
          {                     // rule 1
            width: 640,         // and this width
            nf_resize: 'fit'    // use netlify transformations: https://docs.netlify.com/large-media/transform-images/
          }
          // more rules can go here
        ]
      },
      'sizes': { // this list must match wildcard patterns above
        'header-*': '(min-width: 36em) 33.3vw, 100vw', 
        'missing-params-*': '(min-width: 36em) 33.3vw, 100vw', 
        'netlify-*': '(min-width: 36em) 33.3vw, 100vw', 
      }
    }
  };

Example

With the options above, a markdown

![test](header-test.png)

is rendered as

<p><img src="header-test.png" srcset="header-test-small.png 320w, header-test-medium.png 640w" sizes="(min-width: 36em) 33.3vw, 100vw" alt="test"></p>