{"_id":"@elrond25/eleventy-plugin-toc","_rev":"5-116a6e8e62582638d00fdad35c807bb5","name":"@elrond25/eleventy-plugin-toc","dist-tags":{"latest":"1.0.4"},"versions":{"1.0.0":{"name":"@elrond25/eleventy-plugin-toc","version":"1.0.0","keywords":["11ty","eleventy","plugin","toc","table of contents"],"author":{"name":"elrond25"},"license":"MIT","_id":"@elrond25/eleventy-plugin-toc@1.0.0","maintainers":[{"name":"elrond25","email":"carlos.araya@gmail.com"}],"homepage":"https://github.com/elrond25/eleventy-plugin-toc#readme","bugs":{"url":"https://github.com/elrond25/eleventy-plugin-toc/issues"},"dist":{"shasum":"17abff5b8c5d3f755b4ffb4cc42a3fc341c5f489","tarball":"https://registry.npmjs.org/@elrond25/eleventy-plugin-toc/-/eleventy-plugin-toc-1.0.0.tgz","fileCount":11,"integrity":"sha512-raWoSJwnc2XfwRur8+eUoVqmx4pEfW2V14pVlV42N3yi/7p1eN85Mxww4GFJGzkVt6qWFkOWQ+8TnTRV8A83Yg==","signatures":[{"sig":"MEQCICR8D4GuXjzOlLRVkB/pfXBbClLxWzbwVfoK/yYEsqerAiBIU9tGWUm+IveVd35fV7T0phC2RY0rpWTwZYd/7l56Ow==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":14014},"main":".eleventy.js","type":"module","scripts":{"lint":"eslint src/**","test":"echo \"Error: no test specified\" && exit 1","lint:fix":"eslint src/** --fix"},"_npmUser":{"name":"elrond25","email":"carlos.araya@gmail.com"},"repository":{"url":"git+https://github.com/elrond25/eleventy-plugin-toc.git","type":"git"},"_npmVersion":"11.8.0","description":"Eleventy filter to generate a Table of Contents in a template","directories":{},"_nodeVersion":"24.13.0","dependencies":{"cheerio":"^1.2.0"},"_hasShrinkwrap":false,"devDependencies":{"eslint":"^9.39.2","globals":"^17.3.0","prettier":"^3.8.1","@eslint/js":"^9.39.2","eslint-plugin-n":"^17.23.2","@eslint/eslintrc":"^3.3.3","eslint-config-prettier":"^10.1.8","eslint-plugin-prettier":"^5.5.5"},"_npmOperationalInternal":{"tmp":"tmp/eleventy-plugin-toc_1.0.0_1770426358030_0.02898671724933255","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"@elrond25/eleventy-plugin-toc","version":"1.0.1","keywords":["11ty","eleventy","plugin","toc","table of contents"],"author":{"name":"elrond25"},"license":"MIT","_id":"@elrond25/eleventy-plugin-toc@1.0.1","maintainers":[{"name":"elrond25","email":"carlos.araya@gmail.com"}],"homepage":"https://github.com/elrond25/eleventy-plugin-toc#readme","bugs":{"url":"https://github.com/elrond25/eleventy-plugin-toc/issues"},"dist":{"shasum":"49e8acc4fce9adb0dc534149e714e29f5282a154","tarball":"https://registry.npmjs.org/@elrond25/eleventy-plugin-toc/-/eleventy-plugin-toc-1.0.1.tgz","fileCount":11,"integrity":"sha512-JqkdXNDqqy87hYpLlJNrTs9TVpYtY7md9Ksd/tTeoYEuBAoJnL1J9Z9nBVdKMpYgyfEaBfzQcr+okUmqShBAWg==","signatures":[{"sig":"MEUCIQDDHDgNlI09ZNI2jhAwZKtSaiuDEqn/rglvjXN9OrzzuQIgRe550lLFN1+HXe+yP5QVJRyVGPUUrwGL1nrfG8yW+VI=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":14028},"main":".eleventy.js","type":"module","scripts":{"lint":"eslint src/**","test":"echo \"Error: no test specified\" && exit 1","lint:fix":"eslint src/** --fix"},"_npmUser":{"name":"elrond25","email":"carlos.araya@gmail.com"},"repository":{"url":"git+https://github.com/elrond25/eleventy-plugin-toc.git","type":"git"},"_npmVersion":"11.8.0","description":"Eleventy filter to generate a Table of Contents in a template","directories":{},"_nodeVersion":"24.13.0","dependencies":{"cheerio":"^1.2.0"},"_hasShrinkwrap":false,"devDependencies":{"eslint":"^9.39.2","globals":"^17.3.0","prettier":"^3.8.1","@eslint/js":"^9.39.2","eslint-plugin-n":"^17.23.2","@eslint/eslintrc":"^3.3.3","eslint-config-prettier":"^10.1.8","eslint-plugin-prettier":"^5.5.5"},"_npmOperationalInternal":{"tmp":"tmp/eleventy-plugin-toc_1.0.1_1770429797346_0.26902818103632065","host":"s3://npm-registry-packages-npm-production"}},"1.0.2":{"name":"@elrond25/eleventy-plugin-toc","version":"1.0.2","keywords":["11ty","eleventy","plugin","toc","table of contents"],"author":{"name":"elrond25"},"license":"MIT","_id":"@elrond25/eleventy-plugin-toc@1.0.2","maintainers":[{"name":"elrond25","email":"carlos.araya@gmail.com"}],"homepage":"https://github.com/elrond25/eleventy-plugin-toc#readme","bugs":{"url":"https://github.com/elrond25/eleventy-plugin-toc/issues"},"dist":{"shasum":"68a3d6a8f4f3d37a1eb5a0c81d62a6da84909deb","tarball":"https://registry.npmjs.org/@elrond25/eleventy-plugin-toc/-/eleventy-plugin-toc-1.0.2.tgz","fileCount":12,"integrity":"sha512-0rTEVD6VLsKHGBT3yRXGpM3Nul51Q1UF+q1Rpx6iFsENwgSJk89illZjl1FM7urOXO/fmhtN7ZwyQQzLkLnlMw==","signatures":[{"sig":"MEUCIAGP8lsSvGAnc/pk3GXo0inV+2EUa0VeXgzXO5xDPaXEAiEAr9o3ga4V6gzIdqMAHh/EOXgwsf4pVGURB1s5NhXudNo=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":16958},"main":".eleventy.js","type":"module","scripts":{"lint":"eslint .","test":"npx playwright test","lint:fix":"eslint . --fix"},"_npmUser":{"name":"elrond25","email":"carlos.araya@gmail.com"},"repository":{"url":"git+https://github.com/elrond25/eleventy-plugin-toc.git","type":"git"},"_npmVersion":"11.8.0","description":"Eleventy filter to generate a Table of Contents in a template","directories":{},"_nodeVersion":"24.13.0","dependencies":{"cheerio":"^1.2.0"},"_hasShrinkwrap":false,"devDependencies":{"eslint":"^9.39.2","globals":"^17.3.0","@eslint/js":"^9.39.2","eslint-plugin-n":"^17.23.2","@eslint/eslintrc":"^3.3.3","@playwright/test":"^1.58.2"},"_npmOperationalInternal":{"tmp":"tmp/eleventy-plugin-toc_1.0.2_1770430634443_0.6909373795455216","host":"s3://npm-registry-packages-npm-production"}},"1.0.3":{"name":"@elrond25/eleventy-plugin-toc","version":"1.0.3","keywords":["11ty","eleventy","plugin","toc","table of contents"],"author":{"name":"elrond25"},"license":"MIT","_id":"@elrond25/eleventy-plugin-toc@1.0.3","maintainers":[{"name":"elrond25","email":"carlos.araya@gmail.com"}],"homepage":"https://github.com/elrond25/eleventy-plugin-toc#readme","bugs":{"url":"https://github.com/elrond25/eleventy-plugin-toc/issues"},"dist":{"shasum":"a5641e145795b2d550dcc165d43247491ec2bc87","tarball":"https://registry.npmjs.org/@elrond25/eleventy-plugin-toc/-/eleventy-plugin-toc-1.0.3.tgz","fileCount":13,"integrity":"sha512-scRDvQ2LMk3c0Ym3LErjF2EKW9e2W+IjSylZxaUpE8k2NxFXBUSsy31320ny/lOnL8SM85vRMQ0i5dPlL6P7Fg==","signatures":[{"sig":"MEUCIQD0mY2QMpkaGCchJO74WaYDoc8xanY/XBk8tkhxQHNZjAIgK3D8AC1gMfIF9t65xuZqkuGCc2T3ZeFjjhh8lMpEV74=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":17114},"main":".eleventy.js","type":"module","scripts":{"lint":"eslint .","test":"npx playwright test","lint:fix":"eslint . --fix"},"_npmUser":{"name":"elrond25","email":"carlos.araya@gmail.com"},"repository":{"url":"git+https://github.com/elrond25/eleventy-plugin-toc.git","type":"git"},"_npmVersion":"11.8.0","description":"Eleventy filter to generate a Table of Contents in a template","directories":{},"_nodeVersion":"24.13.0","dependencies":{"cheerio":"^1.2.0"},"_hasShrinkwrap":false,"devDependencies":{"eslint":"^9.39.2","globals":"^17.3.0","@eslint/js":"^9.39.2","eslint-plugin-n":"^17.23.2","@eslint/eslintrc":"^3.3.3","@playwright/test":"^1.58.2"},"_npmOperationalInternal":{"tmp":"tmp/eleventy-plugin-toc_1.0.3_1770439390256_0.37956674152645853","host":"s3://npm-registry-packages-npm-production"}},"1.0.4":{"name":"@elrond25/eleventy-plugin-toc","version":"1.0.4","type":"module","description":"Eleventy filter to generate a Table of Contents in a template","main":".eleventy.js","scripts":{"test":"npx playwright test","lint":"eslint .","lint:fix":"eslint . --fix"},"repository":{"type":"git","url":"git+https://github.com/elrond25/eleventy-plugin-toc.git"},"keywords":["11ty","eleventy","plugin","toc","table of contents"],"author":{"name":"elrond25"},"license":"MIT","bugs":{"url":"https://github.com/elrond25/eleventy-plugin-toc/issues"},"homepage":"https://github.com/elrond25/eleventy-plugin-toc#readme","dependencies":{"cheerio":"^1.2.0"},"devDependencies":{"@eslint/eslintrc":"^3.3.3","@eslint/js":"^9.39.2","@playwright/test":"^1.58.2","eslint":"^9.39.2","eslint-plugin-n":"^17.23.2","globals":"^17.3.0"},"gitHead":"a9eab919b71c019f4e0a49a564985e9f00026056","_id":"@elrond25/eleventy-plugin-toc@1.0.4","_nodeVersion":"24.13.0","_npmVersion":"11.8.0","dist":{"integrity":"sha512-EXeSEmyb/CRNOD6oBwcmZroY92L7IXilANJJJ32TzjjBWF+atECnYDafrYS06SVo3ZPv+9vL+fQe9T2iaR4D2Q==","shasum":"6dfe6ffd88ee5c6c6efec01583b047c0f6e8b3b2","tarball":"https://registry.npmjs.org/@elrond25/eleventy-plugin-toc/-/eleventy-plugin-toc-1.0.4.tgz","fileCount":13,"unpackedSize":17562,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIB690hHvVw4FxhOI+GxDVng7uiBYZPaQlnMri1PjcGy2AiEA9ckUqGM+DSjfESWvwGR/wxzbc++wIbZ46WBTaoL5cig="}]},"_npmUser":{"name":"elrond25","email":"carlos.araya@gmail.com"},"directories":{},"maintainers":[{"name":"elrond25","email":"carlos.araya@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/eleventy-plugin-toc_1.0.4_1770992662669_0.4694089719113739"},"_hasShrinkwrap":false}},"time":{"created":"2026-02-07T01:05:57.933Z","modified":"2026-02-13T14:24:22.953Z","1.0.0":"2026-02-07T01:05:58.194Z","1.0.1":"2026-02-07T02:03:17.519Z","1.0.2":"2026-02-07T02:17:14.575Z","1.0.3":"2026-02-07T04:43:10.417Z","1.0.4":"2026-02-13T14:24:22.844Z"},"bugs":{"url":"https://github.com/elrond25/eleventy-plugin-toc/issues"},"author":{"name":"elrond25"},"license":"MIT","homepage":"https://github.com/elrond25/eleventy-plugin-toc#readme","keywords":["11ty","eleventy","plugin","toc","table of contents"],"repository":{"type":"git","url":"git+https://github.com/elrond25/eleventy-plugin-toc.git"},"description":"Eleventy filter to generate a Table of Contents in a template","maintainers":[{"name":"elrond25","email":"carlos.araya@gmail.com"}],"readme":"# eleventy-plugin-toc\n\nThis Eleventy plugin will generate a TOC from page content using an Eleventy filter.\n\nThis is a fork of <https://github.com/jdsteinbach/eleventy-plugin-toc>.\n\n## Default Options\n\n```js\n{\n  tags: ['h2', 'h3', 'h4'], // which heading tags are selected headings must each have an ID attribute\n  wrapper: 'details',       // element to put around the root `ol`/`ul`\n  wrapperClass: 'toc',      // class for the element around the root `ol`/`ul`\n  wrapperLabel: 'In this page', // text for the `summary` element\n  ul: false,                // if to use `ul` instead of `ol`\n  flat: false,              // if subheadings should appear as child of parent or as a sibling\n}\n```\n\n## Usage\n\n### 1. Install the plugin\n\n```sh\nnpm i --save @elrond25/eleventy-plugin-toc\n```\n\n### 2. Make sure your headings have anchor IDs\n\n**Your heading elements must have `id`s before this plugin will create a TOC.** If there aren't `id`s on your headings, there will be no anchors for this plugin to link to.\n\nI use [`markdown-it-anchor`](https://www.npmjs.com/package/markdown-it-anchor) to add those `id`s to the headings: [Eleventy config example](https://github.com/jdsteinbach/jdsteinbach.github.io/blob/blog/.eleventy.js)\n\n```js\n// .eleventy.js\n\nimport markdownIt from 'markdown-it'\nimport markdownItAnchor from 'markdown-it-anchor'\n\nexport default function (eleventyConfig) {\n  // Markdown\n  eleventyConfig.setLibrary(\n    'md',\n    markdownIt().use(markdownItAnchor)\n  )\n  // ... your other Eleventy config options\n}\n```\n\n### 3. Add this plugin to your Eleventy config\n\n```js\n// .eleventy.js\n\nimport pluginTOC from 'eleventy-plugin-toc'\n\nexport default function (eleventyConfig) {\n  eleventyConfig.addPlugin(pluginTOC)\n}\n```\n\n#### 3.1 You can override the default plugin options\n\n```js\nexport default function (eleventyConfig) {\n  eleventyConfig.addPlugin(pluginTOC, {\n    tags: ['h2', 'h3'],\n    wrapper: 'div'\n  })\n}\n```\n\n### 4. Use the filter in your layout template(s)\n\nBecause Eleventy only provides the `content` variable to layout templates (not to content files), you'll need to put this markup in a layout template:\n\n```liquid\n<article>\n  {{ content }}\n</article>\n<aside>\n  {{ content | toc }}\n</aside>\n```\n\nIf you're using Nunjucks, include the `safe` filter:\n\n```njk\n<article>\n  {{ content | safe }}\n</article>\n<aside>\n  {{ content | toc | safe }}\n</aside>\n```\n\nIf you want to conditionally render a wrapper element, the filter will return `undefined` when no markup is generated:\n\n```liquid\n{% if content | toc %}\n  <aside>\n    {{ content | toc }}\n  </aside>\n{% endif %}\n```\n\n### 5. Override default options if necessary\n\nPass a stringified JSON object (must be `JSON.parse()`-able) as an option for in your template. Because this is an object, you only need to include the key-value pairs you need to override; [defaults](#default-options) will be preserved.\n\n```liquid\n<aside>\n  {{ content | toc: '{\"tags\":[\"h2\",\"h3\"],\"wrapper\":\"div\",\"wrapperClass\":\"content-tableau\"}' }}\n</aside>\n```\n\n## Options\n\n| Name | Default Value | Type | Purpose |\n| --- | --- | --- | --- |\n| tags | `['h2', 'h3', 'h4']` | array of strings | which heading tags are used to generate the table of contents |\n| wrapper | `'details'` | string | tag of element wrapping toc lists; `''` removes wrapper element |\n| wrapperClass | `'toc'` | string | `class` on element wrapping toc lists |\n| wrapperLabel | `'In this page'` | string | text content of the `summary` element if wrapper is `details`, otherwise `aria-label` on element wrapping toc lists |\n| ul | `false` | boolean | lists are `ul` if true, `ol` if `false` |\n| flat | `false` | boolean | use flat list if `true`; use nested lists if false |\n","readmeFilename":"README.md"}