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

markdown-it-fitvids

v0.2.0

Published

A markdown-it plugin to make iframes and videos responsive by setting aspect-ratio.

Downloads

13

Readme

A markdown-it plugin to make iframes and videos responsive. The original idea goes back to FitVids.js and the evolutionary improvements that are possible because web browsers are capable of more now.

Fitting media

Videos and iframes are not automatically responsive or fluid. They come with a fixed setting for width and height. To make them responsive, while keeping aspect-ratio, markdown-it-fitvids will expand the style attribute of these elements with the aspect-ratio property, based on the given width and height attributes. Also added to the style attribute will be the settings max-width:100%; height:auto;. These settings will allow the video to shrink, but not to expand above its initial size. To let the video grow above its initial size, the options of markdown-it-fitvids can be adjusted to add width: 100%; to the style attribute.

[!IMPORTANT] The above described fitting of media can only be performed for elements that have the html attributes width and height set, or that do already have aspect-ratio set in the style attribute!

For example, the following iframe

<iframe
  src="https://player.vimeo.com/video/304626830"
  width="600"
  height="338"
></iframe>

after processed by markdown-it-fitvids will become

<iframe
  src="https://player.vimeo.com/video/304626830"
  style="aspect-ratio:600/338; max-width:100%; height:auto;"
  width="600"
  height="338"
>
</iframe>

Options

markdown-it-fitvids has the following default options:

{
  fitSelector: "iframe,video",
  applyStyle: "",
  applyClass: "",
  minimalStyle: false
}
  • fitSelector: Identify the html elements that should be processed by markdown-it-fitvids
  • applyStyle: For every processed element the here provided string is added to the style attribute. E.g, to let processed elements grow above their initial size, add the string width:100%;. Defautl is ""
  • applyClass: For every processed element the here provided CSS classe are added to the class attribute. This is a string with space separated CSS class names. You are responsible to maintain the CSS classes within your stylesheet. Default is ""
  • minimalStyle: By default every processed element will get the setting max-width:100%; height:auto; assigned to the style attribute. If you do not want to set the style attribute, and instead do the styling through CSS classes, set this option to true. Default is false. When setting this to true, you are then responsible to provide the suitable CSS classes within your stylesheet and to mention those classes in applyClass option.

Usage

import markdownIt from "markdown-it";
import markdownItFitVids from "markdown-it-fitvids";

markdownIt({
  html: true,
}).use(markdownItFitVids, { //default options, you can omit these
});