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

@plugdash/readtime

v0.3.0

Published

Reading time for EmDash posts, computed at render time with no hooks or stored data

Readme

@plugdash/readtime

Most sites either skip reading time or store it in a database field that goes stale. This package works it out from the post body each time the page renders, so there is nothing to store or keep in sync. Ships ReadingTime.astro, a drop-in label for "6 min read". The EmDash equivalent of Reading Time WP.

Install

pnpm add @plugdash/readtime

No plugin registration is needed. Import the component and pass the post:

---
import ReadingTime from "@plugdash/readtime/ReadingTime.astro";
---

<ReadingTime post={post} />

readtimePlugin() is still exported so old astro.config.mjs files keep working. It does nothing and is deprecated: remove it. Its wordsPerMinute and collections options are ignored; pass wordsPerMinute to the component instead.

Props

| Prop | Type | Default | Description | | ---------------- | -------------------------------------------- | ------------ | ---------------------------------------------------------------------------------------------------- | | post | EmDash entry | required | The entry from getEmDashEntry() | | wordsPerMinute | number | 238 | Reading speed for space-separated scripts | | field | string | auto | Portable Text field name. Auto: content, then body, then the first Portable Text array in data | | label | string | "min read" | Text after the number | | variant | "badge" \| "pill" \| "inline" \| "minimal" | "inline" | Look of the label | | size | "sm" \| "md" \| "lg" | "md" | Font size | | theme | "auto" \| "dark" \| "light" | "auto" | Colour scheme | | showWords | boolean | false | Also show the word count | | attribution | boolean | false | Show a small "plugdash" link | | class | string | - | Extra CSS class |

Style it with --plugdash-rt-color, --plugdash-rt-size, --plugdash-rt-font, --plugdash-rt-bg, --plugdash-rt-border, --plugdash-rt-radius and --plugdash-rt-padding.

The component renders nothing when the post has no body.

Use it in code

import { getReadingTime } from "@plugdash/readtime/utils";

const { minutes, wordCount } = getReadingTime(post, { wordsPerMinute: 200 });

getReadingTime also accepts a Portable Text array. Options: wordsPerMinute, cjkCharsPerMinute (default 500), field.

Replacing the blog template's reading time

The blog template computes its own reading time in src/pages/posts/[slug].astro with getReadingTime(post.data.content) and prints {readingTime} min read. To use this component instead, import it and swap the span:

<!-- before -->
<span>{readingTime} min read</span>
<!-- after -->
<ReadingTime post={post} />

How it counts

  • Words in text blocks, plus the title and body of callout nodes
  • Code blocks, images and embeds are not counted
  • Han, Hangul, Hiragana and Katakana characters are counted one by one at 500 per minute. Other scripts, including Devanagari, count as space-separated words
  • minutes = max(1, ceil(words / wordsPerMinute + cjkChars / 500))

What it does not do

  • No hooks, no stored data, no metadata writes
  • No per-post speed override
  • Posts written by an older readtime that have data.metadata.readingTimeMinutes and no body still show that stored value