{"_id":"@plugdash/tocgen","_rev":"6-7fe57733fc7ae72666e3dc426d9d5c05","name":"@plugdash/tocgen","dist-tags":{"latest":"0.3.0"},"versions":{"0.1.0":{"name":"@plugdash/tocgen","version":"0.1.0","keywords":["emdash","emdash-plugin","tocgen","table-of-contents"],"license":"MIT","_id":"@plugdash/tocgen@0.1.0","maintainers":[{"name":"abhinav061","email":"abhinav061@gmail.com"}],"dist":{"shasum":"04a3308954194113e1bb2a12d8f437e7e3f20888","tarball":"https://registry.npmjs.org/@plugdash/tocgen/-/tocgen-0.1.0.tgz","fileCount":12,"integrity":"sha512-S6ZAuJEeIpz2sAZvPCSGM+8YPWLmuXTRMOhstC1zeu0skAJzSInNSCP1MVM2CH2lzZgPM8Mv+jddIvzcSyRWEw==","signatures":[{"sig":"MEQCIBOkECegijPNNF15uEP6nKi88s/0KxIGtZ68/e804ZmaAiAwS/IuWAdz3hYu7HWHosWbTcCPFyeSn5PQO9hP4Uq5cA==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":33011},"main":"./dist/index.mjs","type":"module","_from":"file:plugdash-tocgen-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"},"./TableOfContents.astro":"./src/TableOfContents.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/d5eb22462f27e465ce27930eb552b3c4/plugdash-tocgen-0.1.0.tgz","_integrity":"sha512-S6ZAuJEeIpz2sAZvPCSGM+8YPWLmuXTRMOhstC1zeu0skAJzSInNSCP1MVM2CH2lzZgPM8Mv+jddIvzcSyRWEw==","_npmVersion":"11.11.0","description":"Auto-generated table of contents 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/tocgen_0.1.0_1775374819814_0.9857406459788804","host":"s3://npm-registry-packages-npm-production"}},"0.2.0":{"name":"@plugdash/tocgen","version":"0.2.0","keywords":["emdash","emdash-plugin","tocgen","table-of-contents"],"license":"MIT","_id":"@plugdash/tocgen@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":"38d0e8115150e1309e656a78e4ae0fc121b6aad1","tarball":"https://registry.npmjs.org/@plugdash/tocgen/-/tocgen-0.2.0.tgz","fileCount":12,"integrity":"sha512-cvzuh4Nc10weusP9kRac8YshiyZDvesvTa242OX/H8eZeONp0GXmBcsjcodFUn+oE5qrotJAOfHehBgjTyXTWg==","signatures":[{"sig":"MEUCIAVrY6PKdLgy2+/3znkH6BHXiOAI+j+mQW6/59us/KYfAiEAoGQ8cS9wvfcSCZBFDrSQVifJdAvQharvjnIUuptQJig=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@plugdash%2ftocgen@0.2.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":43926},"main":"./dist/index.mjs","type":"module","_from":"file:plugdash-tocgen-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"},"./TableOfContents.astro":"./src/TableOfContents.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:a3ecdd95-ce67-41c3-9901-7404f7b353e7"}},"_resolved":"/tmp/0e19bf3cd0ae1c0a9771fc1bb86f5d41/plugdash-tocgen-0.2.0.tgz","_integrity":"sha512-cvzuh4Nc10weusP9kRac8YshiyZDvesvTa242OX/H8eZeONp0GXmBcsjcodFUn+oE5qrotJAOfHehBgjTyXTWg==","repository":{"url":"git+https://github.com/plugdash/plugdash.git","type":"git","directory":"packages/tocgen"},"_npmVersion":"11.5.1","description":"Auto-generated table of contents 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/tocgen_0.2.0_1775416193581_0.9249935330526577","host":"s3://npm-registry-packages-npm-production"}},"0.2.2":{"name":"@plugdash/tocgen","version":"0.2.2","keywords":["emdash","emdash-plugin","tocgen","table-of-contents"],"license":"MIT","_id":"@plugdash/tocgen@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":"248be216899e518bbf2f0d8316f7f5cdfc6b7704","tarball":"https://registry.npmjs.org/@plugdash/tocgen/-/tocgen-0.2.2.tgz","fileCount":15,"integrity":"sha512-8CM6BvzO44zQ2pvzCQawBH/uqOFQM8LLS4zNTdMYwkgyZdPmP0q/2ffcDYXjZhvEj6NcyjPCuYN+EQQWKBhmCA==","signatures":[{"sig":"MEYCIQCwc+a0xhdHkYjsSQHePN3G3CavZHqGxi3RVIEutjP95AIhAPit5yhROKrs0Sphn5jF+j5d1U2Ldi46ARh2m1POPA9i","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@plugdash%2ftocgen@0.2.2","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":44782},"main":"./dist/index.mjs","type":"module","_from":"file:plugdash-tocgen-0.2.2.tgz","types":"./dist/index.d.mts","exports":{".":{"types":"./dist/index.d.mts","import":"./dist/index.mjs"},"./utils":{"types":"./dist/utils.d.mts","import":"./dist/utils.mjs"},"./sandbox":{"import":"./dist/sandbox-entry.mjs"},"./TableOfContents.astro":"./src/TableOfContents.astro"},"scripts":{"test":"vitest run","build":"tsdown src/index.ts src/sandbox-entry.ts src/utils.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:a3ecdd95-ce67-41c3-9901-7404f7b353e7"}},"_resolved":"/tmp/6876d16ff29bdc92a2663a3bb816db46/plugdash-tocgen-0.2.2.tgz","_integrity":"sha512-8CM6BvzO44zQ2pvzCQawBH/uqOFQM8LLS4zNTdMYwkgyZdPmP0q/2ffcDYXjZhvEj6NcyjPCuYN+EQQWKBhmCA==","repository":{"url":"git+https://github.com/plugdash/plugdash.git","type":"git","directory":"packages/tocgen"},"_npmVersion":"11.5.1","description":"Auto-generated table of contents 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/tocgen_0.2.2_1775586100174_0.08703292814477526","host":"s3://npm-registry-packages-npm-production"}},"0.2.3":{"name":"@plugdash/tocgen","version":"0.2.3","keywords":["emdash","emdash-plugin","tocgen","table-of-contents"],"license":"MIT","_id":"@plugdash/tocgen@0.2.3","maintainers":[{"name":"abhinav061","email":"abhinav061@gmail.com"}],"homepage":"https://github.com/plugdash/plugdash#readme","bugs":{"url":"https://github.com/plugdash/plugdash/issues"},"dist":{"shasum":"8a95e7f4547bb4dd4d0264f2d06a1ae45b4ed313","tarball":"https://registry.npmjs.org/@plugdash/tocgen/-/tocgen-0.2.3.tgz","fileCount":16,"integrity":"sha512-6PU1mvpFq8glLaU/13kx2luyV14fqyQ9WWudyp+pgShdIinsXSV5qlCoMAKJpq93mSLiDhQ0GJzLS7u5SdlAKQ==","signatures":[{"sig":"MEYCIQCNPqQeqnvk2TnPkjMRvf9I4oOBjc6n1ZmXLWUnlgJnaAIhALxPP9UTqa7pJXMpFyZOI5S5qY5cX7WCeXuk32lsW+2s","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"sig":"MEUCIAT5Ea7Z0hi3nM4S6remVbsDeyC53E20ddOtyPGCJ/qOAiEAr5QjVhCbfbCDygs4IH7+VKzf3KedsCaHxjHtY671PSo=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@plugdash%2ftocgen@0.2.3","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":62278},"main":"./dist/index.mjs","type":"module","_from":"file:plugdash-tocgen-0.2.3.tgz","types":"./dist/index.d.mts","exports":{".":{"types":"./dist/index.d.mts","import":"./dist/index.mjs"},"./utils":{"types":"./dist/utils.d.mts","import":"./dist/utils.mjs"},"./sandbox":{"import":"./dist/sandbox-entry.mjs"},"./TableOfContents.astro":"./src/TableOfContents.astro"},"scripts":{"test":"vitest run","build":"tsdown src/index.ts --dts.eager --external @portabletext/types && tsdown src/sandbox-entry.ts --dts.eager --no-clean --external @portabletext/types && tsdown src/utils.ts --dts.eager --no-clean --external @portabletext/types","typecheck":"tsc --noEmit"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:a3ecdd95-ce67-41c3-9901-7404f7b353e7"}},"_resolved":"/tmp/b5255b26e7ba7642f52c81579948fd8a/plugdash-tocgen-0.2.3.tgz","_integrity":"sha512-6PU1mvpFq8glLaU/13kx2luyV14fqyQ9WWudyp+pgShdIinsXSV5qlCoMAKJpq93mSLiDhQ0GJzLS7u5SdlAKQ==","repository":{"url":"git+https://github.com/plugdash/plugdash.git","type":"git","directory":"packages/tocgen"},"_npmVersion":"11.5.1","description":"Auto-generated table of contents 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/tocgen_0.2.3_1790352227379_0.6242164896218252","host":"s3://npm-registry-packages-npm-production"}},"0.2.4":{"name":"@plugdash/tocgen","version":"0.2.4","keywords":["emdash","emdash-plugin","tocgen","table-of-contents"],"license":"MIT","_id":"@plugdash/tocgen@0.2.4","maintainers":[{"name":"abhinav061","email":"abhinav061@gmail.com"}],"homepage":"https://github.com/plugdash/plugdash#readme","bugs":{"url":"https://github.com/plugdash/plugdash/issues"},"dist":{"shasum":"d52bc6dcfa9f802dfaf782cfbcee9f351717c170","tarball":"https://registry.npmjs.org/@plugdash/tocgen/-/tocgen-0.2.4.tgz","fileCount":16,"integrity":"sha512-StUztFeZd8SqW1hziwnvWpSeSLuTLBpC0VHJG3qripxhPN4Xb65b1zY6WarSqcLuTNZbEWmsjF5l9LHBFX+ICg==","signatures":[{"sig":"MEUCIQDjZZc52/loLfBekWKDh2bJ5FFXYURpnv73glZ7hxb7gwIgREsiL+uBhuSPBu+LUaqjHc/VO0V8qp4WWQkM0BS+w7I=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"sig":"MEUCIEUyJjuKXP9vKkfoYuJuGs65VIzJXCmBpft4chr2DpxvAiEAsJO/mccugciKUW7nBfOiVh+xepaB7uVLTsrmtwd2W+o=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@plugdash%2ftocgen@0.2.4","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":62425},"main":"./dist/index.mjs","type":"module","_from":"file:plugdash-tocgen-0.2.4.tgz","types":"./dist/index.d.mts","exports":{".":{"types":"./dist/index.d.mts","import":"./dist/index.mjs"},"./utils":{"types":"./dist/utils.d.mts","import":"./dist/utils.mjs"},"./sandbox":{"import":"./dist/sandbox-entry.mjs"},"./TableOfContents.astro":"./src/TableOfContents.astro"},"scripts":{"test":"vitest run","build":"tsdown src/index.ts --dts.eager --external @portabletext/types && tsdown src/sandbox-entry.ts --dts.eager --no-clean --external @portabletext/types && tsdown src/utils.ts --dts.eager --no-clean --external @portabletext/types","typecheck":"tsc --noEmit"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:a3ecdd95-ce67-41c3-9901-7404f7b353e7"}},"_resolved":"/tmp/99af4e3dd588eb7adc59b4bad9c29ad7/plugdash-tocgen-0.2.4.tgz","_integrity":"sha512-StUztFeZd8SqW1hziwnvWpSeSLuTLBpC0VHJG3qripxhPN4Xb65b1zY6WarSqcLuTNZbEWmsjF5l9LHBFX+ICg==","repository":{"url":"git+https://github.com/plugdash/plugdash.git","type":"git","directory":"packages/tocgen"},"_npmVersion":"11.5.1","description":"Auto-generated table of contents 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/tocgen_0.2.4_1790409384206_0.3120218579798264","host":"s3://npm-registry-packages-npm-production"}},"0.3.0":{"_id":"@plugdash/tocgen@0.3.0","bugs":{"url":"https://github.com/plugdash/plugdash/issues"},"dist":{"shasum":"68132d4c138bb2392eabdbe0e3d9c7bb5116b2f5","tarball":"https://registry.npmjs.org/@plugdash/tocgen/-/tocgen-0.3.0.tgz","fileCount":15,"integrity":"sha512-B8G0F/S4Rje6L9Lcpa9EjoloC7g6hZmpa/0x3qdEQ9u1RWR6PdEffe/aVQk3/e3OmUa5BpIJZ+IGItbIj/1efA==","signatures":[{"sig":"MEQCIHaDg5BhB7lECy8JT1KETWU589mdgPi592ITgqudCECBAiAvvQ2qzk+nweM7Ym0qro6V5JC2SvTh4RsWfk2RM1h5ig==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQCJVpLxBxZpOLDvZDvs9v6lrlTjAEGZrWgcx4zfI55gtQIgFxtuzvUstnxV2bq2JZX8C/wGgKZjMclnZ18n40zJBjo="}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@plugdash%2ftocgen@0.3.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":36058},"main":"./dist/index.mjs","name":"@plugdash/tocgen","type":"module","_from":"file:plugdash-tocgen-0.3.0.tgz","types":"./dist/index.d.mts","exports":{".":{"types":"./dist/index.d.mts","import":"./dist/index.mjs"},"./utils":{"types":"./dist/toc.d.mts","import":"./dist/toc.mjs"},"./HeadingAnchors.astro":"./src/HeadingAnchors.astro","./TableOfContents.astro":"./src/TableOfContents.astro"},"license":"MIT","scripts":{"test":"vitest run","build":"tsdown src/index.ts src/toc.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":"a3ecdd95-ce67-41c3-9901-7404f7b353e7"}},"homepage":"https://github.com/plugdash/plugdash#readme","keywords":["emdash","emdash-plugin","table-of-contents","tocgen"],"_resolved":"/tmp/86e2cd99a9233200e8dc349ddf346462/plugdash-tocgen-0.3.0.tgz","_integrity":"sha512-B8G0F/S4Rje6L9Lcpa9EjoloC7g6hZmpa/0x3qdEQ9u1RWR6PdEffe/aVQk3/e3OmUa5BpIJZ+IGItbIj/1efA==","repository":{"url":"git+https://github.com/plugdash/plugdash.git","type":"git","directory":"packages/tocgen"},"_npmVersion":"11.5.1","description":"Table of contents 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","@plugdash/testing":"0.0.0","@portabletext/types":"^2.0.0"},"peerDependencies":{"emdash":">=0.13.0"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/tocgen_0.3.0_1790936771442_0.845658432891617"}}},"time":{"created":"2026-04-05T07:40:19.701Z","modified":"2026-10-02T10:26:12.013Z","0.1.0":"2026-04-05T07:40:19.955Z","0.2.0":"2026-04-05T19:09:53.738Z","0.2.2":"2026-04-07T18:21:40.340Z","0.2.3":"2026-09-25T16:03:47.502Z","0.2.4":"2026-09-26T07:56:24.277Z","0.3.0":"2026-10-02T10:26:11.539Z"},"bugs":{"url":"https://github.com/plugdash/plugdash/issues"},"license":"MIT","homepage":"https://github.com/plugdash/plugdash#readme","keywords":["emdash","emdash-plugin","table-of-contents","tocgen"],"repository":{"url":"git+https://github.com/plugdash/plugdash.git","type":"git","directory":"packages/tocgen"},"description":"Table of contents for EmDash posts, computed at render time with no hooks or stored data","maintainers":[{"name":"abhinav061","email":"abhinav061@gmail.com"}],"readme":"# @plugdash/tocgen\n\nLong posts need navigation, and EmDash's `PortableText` renders headings\nwithout ids, so a TOC has nothing to link to. `@plugdash/tocgen` builds the\ntable of contents from the post body at render time and gives the headings\nmatching ids. Ships `TableOfContents.astro` and `HeadingAnchors.astro`. No\nhooks, no stored data, no registration. The EmDash equivalent of\n[Table of Contents Plus](https://wordpress.org/plugins/table-of-contents-plus/).\n\n## Install\n\n```bash\npnpm add @plugdash/tocgen\n```\n\nNo entry in `astro.config.mjs` is needed. If you registered `tocgenPlugin()`\nin an older version it still loads, does nothing, and can be removed:\n\n```js\n// astro.config.mjs - optional, deprecated\nimport emdash from \"emdash/astro\";\nimport { tocgenPlugin } from \"@plugdash/tocgen\";\n```\n\n## Use\n\n```astro\n---\nimport { PortableText } from \"emdash/ui\";\nimport TableOfContents from \"@plugdash/tocgen/TableOfContents.astro\";\nimport HeadingAnchors from \"@plugdash/tocgen/HeadingAnchors.astro\";\n---\n\n<TableOfContents post={post} />\n<article>\n  <PortableText value={post.data.content} />\n  <HeadingAnchors />\n</article>\n```\n\n`HeadingAnchors` must come after the post body. It runs a tiny inline script\n(under 1 KB, no dependencies) that sets an `id` on every `h2`, `h3` and `h4`\nthat has none, using the same slugs and the same `-2`, `-3` duplicate suffixes\nas the TOC. Pass `selector` if your body is not inside an `<article>`.\n\nSlugs keep letters, vowel signs and digits from any script, so Hindi headings get\nreal ids (`हिंदी शीर्षक` becomes `हिंदी-शीर्षक`). Latin accents are stripped (`Émojis` becomes `emojis`). A heading with no letters or\ndigits becomes `section`.\n\n### Props: TableOfContents\n\n| Prop        | Type      | Default | Description                                                                              |\n| ----------- | --------- | ------- | ---------------------------------------------------------------------------------------- |\n| post        | `object`  | -       | The post (required)                                                                      |\n| maxDepth    | `2\\|3\\|4` | `3`     | Deepest heading level to include                                                         |\n| minHeadings | `number`  | `3`     | Headings needed before a TOC shows                                                       |\n| field       | `string`  | -       | Portable Text field. Default: `content`, then `body`, then the first Portable Text array |\n| sticky      | `boolean` | `false` | Stick to the top while scrolling                                                         |\n| class       | `string`  | `\"\"`    | Additional CSS class                                                                     |\n\n### Props: HeadingAnchors\n\n| Prop     | Type     | Default     | Description                      |\n| -------- | -------- | ----------- | -------------------------------- |\n| selector | `string` | `\"article\"` | CSS selector of the body element |\n\n### CSS custom properties\n\n| Property                     | Default              | Description                 |\n| ---------------------------- | -------------------- | --------------------------- |\n| `--plugdash-toc-size`        | `0.875rem`           | Font size                   |\n| `--plugdash-toc-line-height` | `1.6`                | Line height                 |\n| `--plugdash-toc-indent`      | `1rem`               | Nested list padding         |\n| `--plugdash-toc-color`       | `inherit`            | Link color                  |\n| `--plugdash-toc-hover`       | `#6366f1`            | Link hover color            |\n| `--plugdash-toc-top`         | `2rem`               | Sticky offset from top      |\n| `--plugdash-toc-max-height`  | `calc(100vh - 4rem)` | Sticky container max-height |\n\n## Blog template\n\nThe official blog template already builds an \"On this page\" TOC with a client\nscript, and sets its own `heading-0`, `heading-1` ids. To use tocgen instead,\nin `src/pages/posts/[slug].astro`:\n\n1. Replace the `<nav class=\"toc\">` block (the one containing `id=\"toc-content\"`) with `<TableOfContents post={post} />`.\n2. Put `<HeadingAnchors />` right after `<PortableText value={post.data.content} />`.\n3. Delete the `<script>` that fills `toc-content`.\n\nKeep the template's TOC and add tocgen and you will show two TOCs.\n\n## Utilities\n\n```ts\nimport { getToc, toAnchor } from \"@plugdash/tocgen/utils\";\n\ngetToc(post, { maxDepth: 3, minHeadings: 3 }); // nested entries, [] below minHeadings\n```\n\n`extractHeadings`, `deduplicateAnchors`, `nestHeadings` and `getBodyBlocks` are\nexported from the same path.\n\n## Upgrading from 0.2\n\n- The `afterSave` hook, the `metadata.tocgen` write, the admin settings page and the `@plugdash/tocgen/sandbox` export are gone. Delete `tocgenPlugin({...})` options: they are ignored. Pass `minHeadings` and `maxDepth` to the component instead.\n- Existing `metadata.tocgen.entries` are used only when a post has no Portable Text body.\n- `@portabletext/types` is no longer a peer dependency.\n\n## What it does not do\n\n- No hooks, stored data or `metadata` writes\n- Does not render the current-section highlight (add scroll-spy in your theme)\n- Does not include `h1`\n- Does not number headings or render a flat list\n- Does not set ids on headings outside the `selector` element\n","readmeFilename":"README.md"}