{"_id":"@plugdash/readtime","_rev":"5-6dec06b686b29904c8ed8198261a03a2","name":"@plugdash/readtime","dist-tags":{"latest":"0.3.0"},"versions":{"0.1.0":{"name":"@plugdash/readtime","version":"0.1.0","keywords":["emdash","emdash-plugin","readtime","reading-time","word-count"],"license":"MIT","_id":"@plugdash/readtime@0.1.0","maintainers":[{"name":"abhinav061","email":"abhinav061@gmail.com"}],"dist":{"shasum":"037de483bb82004e4528c017601a0ee9c73b24a0","tarball":"https://registry.npmjs.org/@plugdash/readtime/-/readtime-0.1.0.tgz","fileCount":12,"integrity":"sha512-kHsUACGvdnewyQEHZ2WuvS/C66KhFWK64tFalB2AxQsO4X8nK6NcgZNegu+LjtjqWvuQeWign16yZsov5QTHlg==","signatures":[{"sig":"MEYCIQDl61kvybtYxsvFuqCsxjHm2vXzNDPMexDtUlwCI/6+HAIhAO93A7MYTYff/PpoYTO0F0Yt0SBhMiuwP21R5CpyfOgp","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":30988},"main":"./dist/index.mjs","type":"module","_from":"file:plugdash-readtime-0.1.0.tgz","types":"./dist/index.d.mts","exports":{".":{"types":"./dist/index.d.mts","import":"./dist/index.mjs"},"./sandbox":{"import":"./dist/sandbox-entry.mjs"},"./ReadingTime.astro":"./src/ReadingTime.astro"},"scripts":{"test":"vitest run","build":"tsdown src/index.ts src/sandbox-entry.ts --dts.eager --external @portabletext/types","typecheck":"tsc --noEmit"},"_npmUser":{"name":"abhinav061","email":"abhinav061@gmail.com"},"_resolved":"/private/var/folders/6y/57bqcl410dl_xsbfbpkrgv500000gn/T/f396c4146a100921f7fd55c116b63b28/plugdash-readtime-0.1.0.tgz","_integrity":"sha512-kHsUACGvdnewyQEHZ2WuvS/C66KhFWK64tFalB2AxQsO4X8nK6NcgZNegu+LjtjqWvuQeWign16yZsov5QTHlg==","_npmVersion":"11.11.0","description":"Estimated reading time and word count for EmDash posts","directories":{},"_nodeVersion":"24.14.1","_hasShrinkwrap":false,"devDependencies":{"vitest":"^2.0.0","@plugdash/types":"0.0.0","@plugdash/testing":"0.0.0","@portabletext/types":"^2.0.0"},"peerDependencies":{"emdash":"^0.1.0","@portabletext/types":"^2.0.0"},"_npmOperationalInternal":{"tmp":"tmp/readtime_0.1.0_1775374822064_0.6477377125849371","host":"s3://npm-registry-packages-npm-production"}},"0.2.0":{"name":"@plugdash/readtime","version":"0.2.0","keywords":["emdash","emdash-plugin","readtime","reading-time","word-count"],"license":"MIT","_id":"@plugdash/readtime@0.2.0","maintainers":[{"name":"abhinav061","email":"abhinav061@gmail.com"}],"homepage":"https://github.com/plugdash/plugdash#readme","bugs":{"url":"https://github.com/plugdash/plugdash/issues"},"dist":{"shasum":"4bb9df08d7eac2b08ff507f430acd8082a7e0e3b","tarball":"https://registry.npmjs.org/@plugdash/readtime/-/readtime-0.2.0.tgz","fileCount":13,"integrity":"sha512-pCB/1YJKZ37c96p/OzYBIG1IWuPpX2DdGsPO1gZo4VUdATibPFhOm5VseOuWJ3AhRPF5KzL+VWN92MVJp/9YOw==","signatures":[{"sig":"MEUCIQDF5SevcVVlqejTweRmh9Wx/reidtluXsRK3dEC3ol+/QIgJ05kbj2Vo+cjfw+kZkv0UKFLHGYB5hQDzdRa4VHMgrc=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@plugdash%2freadtime@0.2.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":47821},"main":"./dist/index.mjs","type":"module","_from":"file:plugdash-readtime-0.2.0.tgz","types":"./dist/index.d.mts","exports":{".":{"types":"./dist/index.d.mts","import":"./dist/index.mjs"},"./sandbox":{"import":"./dist/sandbox-entry.mjs"},"./ReadingTime.astro":"./src/ReadingTime.astro"},"scripts":{"test":"vitest run","build":"tsdown src/index.ts src/sandbox-entry.ts --dts.eager --external @portabletext/types","typecheck":"tsc --noEmit"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:5cc62a40-13d3-42a4-91af-b545f1e3548d"}},"_resolved":"/tmp/facf524386189af5b1734effe68b1067/plugdash-readtime-0.2.0.tgz","_integrity":"sha512-pCB/1YJKZ37c96p/OzYBIG1IWuPpX2DdGsPO1gZo4VUdATibPFhOm5VseOuWJ3AhRPF5KzL+VWN92MVJp/9YOw==","repository":{"url":"git+https://github.com/plugdash/plugdash.git","type":"git","directory":"packages/readtime"},"_npmVersion":"11.5.1","description":"Estimated reading time and word count for EmDash posts","directories":{},"_nodeVersion":"22.22.2","_hasShrinkwrap":false,"devDependencies":{"vitest":"^2.0.0","@plugdash/types":"0.0.0","@plugdash/testing":"0.0.0","@portabletext/types":"^2.0.0"},"peerDependencies":{"emdash":"^0.1.0","@portabletext/types":"^2.0.0"},"_npmOperationalInternal":{"tmp":"tmp/readtime_0.2.0_1775416193436_0.014134772160043552","host":"s3://npm-registry-packages-npm-production"}},"0.2.1":{"name":"@plugdash/readtime","version":"0.2.1","keywords":["emdash","emdash-plugin","readtime","reading-time","word-count"],"license":"MIT","_id":"@plugdash/readtime@0.2.1","maintainers":[{"name":"abhinav061","email":"abhinav061@gmail.com"}],"homepage":"https://github.com/plugdash/plugdash#readme","bugs":{"url":"https://github.com/plugdash/plugdash/issues"},"dist":{"shasum":"cfba499caac1246e91016ddb0d4a4648e4311907","tarball":"https://registry.npmjs.org/@plugdash/readtime/-/readtime-0.2.1.tgz","fileCount":13,"integrity":"sha512-n3RtZaCj+atrfMsguPH02QsWc4CrKDrIFe1f5skwqNgEZ8RupLttsj78kdkuY7JfDnTxV0wUEI+/Vw109B1lFg==","signatures":[{"sig":"MEUCIQDH+vu/8AWqHJBj+Viujc+DSK0Iv5KnTTX/xunTC2MUMgIgB2X8fSGcBJw7w6VL8ze6LClzaSJPKBURmzGi0Fw6AAg=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"sig":"MEYCIQCXxEc7Dji0peiLQsS9CeD3xKsu9r7PAWS5uqMeGQctfAIhANXbMae2APbU/ACGL9S+RIc8GlJg9CuCW186H+4HlI3X","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@plugdash%2freadtime@0.2.1","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":50570},"main":"./dist/index.mjs","type":"module","_from":"file:plugdash-readtime-0.2.1.tgz","types":"./dist/index.d.mts","exports":{".":{"types":"./dist/index.d.mts","import":"./dist/index.mjs"},"./sandbox":{"import":"./dist/sandbox-entry.mjs"},"./ReadingTime.astro":"./src/ReadingTime.astro"},"scripts":{"test":"vitest run","build":"tsdown src/index.ts src/sandbox-entry.ts --dts.eager --external @portabletext/types","typecheck":"tsc --noEmit"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:5cc62a40-13d3-42a4-91af-b545f1e3548d"}},"_resolved":"/tmp/ad5f7b413f56e94b9966a53afacd0e57/plugdash-readtime-0.2.1.tgz","_integrity":"sha512-n3RtZaCj+atrfMsguPH02QsWc4CrKDrIFe1f5skwqNgEZ8RupLttsj78kdkuY7JfDnTxV0wUEI+/Vw109B1lFg==","repository":{"url":"git+https://github.com/plugdash/plugdash.git","type":"git","directory":"packages/readtime"},"_npmVersion":"11.5.1","description":"Estimated reading time and word count for EmDash posts","directories":{},"_nodeVersion":"22.23.2","_hasShrinkwrap":false,"devDependencies":{"vitest":"^2.0.0","@plugdash/types":"0.0.0","@plugdash/testing":"0.0.0","@portabletext/types":"^2.0.0"},"peerDependencies":{"emdash":">=0.13.0","@portabletext/types":"^2.0.0"},"_npmOperationalInternal":{"tmp":"tmp/readtime_0.2.1_1790352146943_0.7738337274140163","host":"s3://npm-registry-packages-npm-production"}},"0.2.2":{"name":"@plugdash/readtime","version":"0.2.2","keywords":["emdash","emdash-plugin","readtime","reading-time","word-count"],"license":"MIT","_id":"@plugdash/readtime@0.2.2","maintainers":[{"name":"abhinav061","email":"abhinav061@gmail.com"}],"homepage":"https://github.com/plugdash/plugdash#readme","bugs":{"url":"https://github.com/plugdash/plugdash/issues"},"dist":{"shasum":"a7f322d483af6c42a6a85319961e7bd5acced2b4","tarball":"https://registry.npmjs.org/@plugdash/readtime/-/readtime-0.2.2.tgz","fileCount":13,"integrity":"sha512-LZyY3zcnLrVX5RJdQLAYh+z5zK48LiBvYZ3aBXMnkRIxnqEAGlD36xmg0vzanTGK551CBgsRur4w58JcXJ77lA==","signatures":[{"sig":"MEUCIQDzNt8E5Lk9S7+yqEYXLQamyUZPfuAUqH7siHhL6gzQegIgWr8PQ5txR384yjf5xEB62lblvt9+dGP1RDRcOYIrOFI=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"sig":"MEUCIQCkp3gwMLaaRIiPDUKb58/Pdnjaub9ybwV3cfmg93KfJgIgV8utzcrhd52c0cwE95bpa514Q7je6UxfaIT9ev+3EZ0=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@plugdash%2freadtime@0.2.2","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":50717},"main":"./dist/index.mjs","type":"module","_from":"file:plugdash-readtime-0.2.2.tgz","types":"./dist/index.d.mts","exports":{".":{"types":"./dist/index.d.mts","import":"./dist/index.mjs"},"./sandbox":{"import":"./dist/sandbox-entry.mjs"},"./ReadingTime.astro":"./src/ReadingTime.astro"},"scripts":{"test":"vitest run","build":"tsdown src/index.ts src/sandbox-entry.ts --dts.eager --external @portabletext/types","typecheck":"tsc --noEmit"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:5cc62a40-13d3-42a4-91af-b545f1e3548d"}},"_resolved":"/tmp/774d2dc32e0b87ed2235beaa54bd5a33/plugdash-readtime-0.2.2.tgz","_integrity":"sha512-LZyY3zcnLrVX5RJdQLAYh+z5zK48LiBvYZ3aBXMnkRIxnqEAGlD36xmg0vzanTGK551CBgsRur4w58JcXJ77lA==","repository":{"url":"git+https://github.com/plugdash/plugdash.git","type":"git","directory":"packages/readtime"},"_npmVersion":"11.5.1","description":"Estimated reading time and word count for EmDash posts","directories":{},"_nodeVersion":"22.23.2","_hasShrinkwrap":false,"devDependencies":{"vitest":"^2.0.0","@plugdash/types":"0.0.0","@plugdash/testing":"0.0.0","@portabletext/types":"^2.0.0"},"peerDependencies":{"emdash":">=0.13.0","@portabletext/types":"^2.0.0"},"_npmOperationalInternal":{"tmp":"tmp/readtime_0.2.2_1790409401391_0.5351817768350706","host":"s3://npm-registry-packages-npm-production"}},"0.3.0":{"_id":"@plugdash/readtime@0.3.0","bugs":{"url":"https://github.com/plugdash/plugdash/issues"},"dist":{"shasum":"5a581e06dee04792707fc090f14da3d049c61dac","tarball":"https://registry.npmjs.org/@plugdash/readtime/-/readtime-0.3.0.tgz","fileCount":13,"integrity":"sha512-/Q88RC7N3dY5FtaQbr0ti3kcmblmiddfcAkKeYZWuopobfDncLk+m02xXdljQhUx7qjj3IvPvylxiuzehGs3Ag==","signatures":[{"sig":"MEUCIQC5xi+bE3Qq73Iq7PzuKkanMAQxqsd9oWtG60jtMpi8xwIgagKKk2/M1AIZgc6sBBxVilcam+rBffTJcxR+wQTylmQ=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIHzMyYiveJaQVvVBRlVJOHUlLcK4ENkQ7PWH304LKDEEAiBVd5XsTpPCZeksbOXUiADQ05sUwU/K2du0hrfdsCv7mg=="}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@plugdash%2freadtime@0.3.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":34910},"main":"./dist/index.mjs","name":"@plugdash/readtime","type":"module","_from":"file:plugdash-readtime-0.3.0.tgz","types":"./dist/index.d.mts","exports":{".":{"types":"./dist/index.d.mts","import":"./dist/index.mjs"},"./utils":{"types":"./dist/reading-time.d.mts","import":"./dist/reading-time.mjs"},"./ReadingTime.astro":"./src/ReadingTime.astro"},"license":"MIT","scripts":{"test":"vitest run","build":"tsdown src/index.ts src/reading-time.ts --dts.eager","typecheck":"tsc --noEmit"},"version":"0.3.0","_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"5cc62a40-13d3-42a4-91af-b545f1e3548d"}},"homepage":"https://github.com/plugdash/plugdash#readme","keywords":["emdash","emdash-plugin","reading-time","readtime","word-count"],"_resolved":"/tmp/4df13a1bb051968fa14771129efe9ab6/plugdash-readtime-0.3.0.tgz","_integrity":"sha512-/Q88RC7N3dY5FtaQbr0ti3kcmblmiddfcAkKeYZWuopobfDncLk+m02xXdljQhUx7qjj3IvPvylxiuzehGs3Ag==","repository":{"url":"git+https://github.com/plugdash/plugdash.git","type":"git","directory":"packages/readtime"},"_npmVersion":"11.5.1","description":"Reading time for EmDash posts, computed at render time with no hooks or stored data","directories":{},"maintainers":[{"name":"abhinav061","email":"abhinav061@gmail.com"}],"_nodeVersion":"22.23.3","_hasShrinkwrap":false,"devDependencies":{"vitest":"^2.0.0","@plugdash/types":"0.0.0"},"peerDependencies":{"emdash":">=0.13.0"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/readtime_0.3.0_1790936767209_0.8086002369972254"}}},"time":{"created":"2026-04-05T07:40:21.965Z","modified":"2026-10-02T10:26:07.609Z","0.1.0":"2026-04-05T07:40:22.236Z","0.2.0":"2026-04-05T19:09:53.607Z","0.2.1":"2026-09-25T16:02:27.037Z","0.2.2":"2026-09-26T07:56:41.474Z","0.3.0":"2026-10-02T10:26:07.284Z"},"bugs":{"url":"https://github.com/plugdash/plugdash/issues"},"license":"MIT","homepage":"https://github.com/plugdash/plugdash#readme","keywords":["emdash","emdash-plugin","reading-time","readtime","word-count"],"repository":{"url":"git+https://github.com/plugdash/plugdash.git","type":"git","directory":"packages/readtime"},"description":"Reading time for EmDash posts, computed at render time with no hooks or stored data","maintainers":[{"name":"abhinav061","email":"abhinav061@gmail.com"}],"readme":"# @plugdash/readtime\n\nMost sites either skip reading time or store it in a database field that goes stale.\nThis package works it out from the post body each time the page renders, so there is nothing to store or keep in sync.\nShips `ReadingTime.astro`, a drop-in label for \"6 min read\". The EmDash equivalent of [Reading Time WP](https://wordpress.org/plugins/reading-time-wp/).\n\n## Install\n\n```bash\npnpm add @plugdash/readtime\n```\n\nNo plugin registration is needed. Import the component and pass the post:\n\n```astro\n---\nimport ReadingTime from \"@plugdash/readtime/ReadingTime.astro\";\n---\n\n<ReadingTime post={post} />\n```\n\n`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.\n\n## Props\n\n| Prop             | Type                                         | Default      | Description                                                                                          |\n| ---------------- | -------------------------------------------- | ------------ | ---------------------------------------------------------------------------------------------------- |\n| `post`           | EmDash entry                                 | required     | The entry from `getEmDashEntry()`                                                                    |\n| `wordsPerMinute` | `number`                                     | `238`        | Reading speed for space-separated scripts                                                            |\n| `field`          | `string`                                     | auto         | Portable Text field name. Auto: `content`, then `body`, then the first Portable Text array in `data` |\n| `label`          | `string`                                     | `\"min read\"` | Text after the number                                                                                |\n| `variant`        | `\"badge\" \\| \"pill\" \\| \"inline\" \\| \"minimal\"` | `\"inline\"`   | Look of the label                                                                                    |\n| `size`           | `\"sm\" \\| \"md\" \\| \"lg\"`                       | `\"md\"`       | Font size                                                                                            |\n| `theme`          | `\"auto\" \\| \"dark\" \\| \"light\"`                | `\"auto\"`     | Colour scheme                                                                                        |\n| `showWords`      | `boolean`                                    | `false`      | Also show the word count                                                                             |\n| `attribution`    | `boolean`                                    | `false`      | Show a small \"plugdash\" link                                                                         |\n| `class`          | `string`                                     | -            | Extra CSS class                                                                                      |\n\nStyle it with `--plugdash-rt-color`, `--plugdash-rt-size`, `--plugdash-rt-font`, `--plugdash-rt-bg`, `--plugdash-rt-border`, `--plugdash-rt-radius` and `--plugdash-rt-padding`.\n\nThe component renders nothing when the post has no body.\n\n## Use it in code\n\n```ts\nimport { getReadingTime } from \"@plugdash/readtime/utils\";\n\nconst { minutes, wordCount } = getReadingTime(post, { wordsPerMinute: 200 });\n```\n\n`getReadingTime` also accepts a Portable Text array. Options: `wordsPerMinute`, `cjkCharsPerMinute` (default 500), `field`.\n\n## Replacing the blog template's reading time\n\nThe 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:\n\n```astro\n<!-- before -->\n<span>{readingTime} min read</span>\n<!-- after -->\n<ReadingTime post={post} />\n```\n\n## How it counts\n\n- Words in text blocks, plus the `title` and `body` of `callout` nodes\n- Code blocks, images and embeds are not counted\n- Han, Hangul, Hiragana and Katakana characters are counted one by one at 500 per minute. Other scripts, including Devanagari, count as space-separated words\n- `minutes = max(1, ceil(words / wordsPerMinute + cjkChars / 500))`\n\n## What it does not do\n\n- No hooks, no stored data, no `metadata` writes\n- No per-post speed override\n- Posts written by an older readtime that have `data.metadata.readingTimeMinutes` and no body still show that stored value\n","readmeFilename":"README.md"}