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

satteri-imgattr

v0.1.1

Published

A Satteri plugin for Markdown image attributes

Readme

Satteri Image Attributes

A Satteri HAST plugin that adds attributes with a second set of parentheses:

![Alt text](./photo.jpg)(width: 640, loading: lazy)

Install

pnpm add satteri-imgattr

Astro

import { defineConfig } from "astro/config";
import { satteri } from "@astrojs/markdown-satteri";
import imgAttr from "satteri-imgattr";

export default defineConfig({
  markdown: {
    processor: satteri({
      hastPlugins: [imgAttr()],
    }),
  },
});

When @astrojs/mdx is installed, it inherits this Satteri configuration for the Markdown parts of .mdx files. The plugin therefore handles ![alt](image.jpg)(width: 640) in MDX, but not JSX <img> elements.

Astro image optimization

For relative local images, Astro passes the resulting properties to getImage(). Optimization options such as width, widths, quality, and format control the generated assets:

![A mountain at sunrise](./mountain.jpg)(width: 640, quality: 80, format: avif)

![Responsive mountain](./mountain.jpg)(widths: [320, 640, 960], sizes: "(max-width: 700px) 100vw, 700px")

Attributes such as sizes, loading, decoding, and data attributes appear on the rendered <img>.

Images referenced from public/ with a root-relative path are not optimized.

Defaults

processor: satteri({
  hastPlugins: [
    imgAttr({
      defaults: { loading: "lazy", decoding: "async" },
    }),
  ],
})

Inline attributes override defaults. Properties produced by an earlier plugin are preserved and also take precedence over defaults.

Syntax

The attribute suffix must follow the Markdown image with no intervening whitespace:

![alt](path)(key: value, another: value)

| Value | Example | Result | | --- | --- | --- | | String | loading: lazy | "lazy" | | Number | width: 640 | 640 | | Boolean | defer: true | true | | Quoted string | title: "A wide view" | "A wide view" | | Array | widths: [320, 640] | HAST list value |

Commas inside quotes, arrays, and nested parentheses are preserved. Quote plain string values that contain a top-level comma.

Satteri normalizes HAST list members to strings, so widths: [320, 640] reaches Astro as ["320", "640"]. Astro accepts these numeric list values and generates the requested variants.

How it works

The plugin runs during Satteri's HAST phase, parses a balanced attribute suffix immediately following an <img>, records the resulting properties through the visitor context, and removes the suffix from the rendered output. HAST is used because it preserves list values needed by Astro's widths option.

Direct Satteri usage

pnpm add satteri-imgattr satteri
import { markdownToHtml } from "satteri";
import imgAttr from "satteri-imgattr";

const { html } = markdownToHtml(
  "![alt](photo.jpg)(width: 640)",
  { hastPlugins: [imgAttr()] },
);

Plugin ordering

Satteri runs HAST plugins in array order. Put this plugin before plugins that need to inspect the added image properties.