{"_id":"@atomictech/rehype-toc","_rev":"4-c9e2b250f95c3e9a1b85ce89d0293117","name":"@atomictech/rehype-toc","dist-tags":{"latest":"3.1.3"},"versions":{"3.1.0":{"name":"@atomictech/rehype-toc","version":"3.1.0","description":"A rehype plugin that adds a table of contents (TOC) to the page","keywords":["unified","rehype","plugin","rehype-plugin","table-of-contents","toc","html"],"author":{"name":"James Messinger","url":"https://jamesmessinger.com"},"license":"MIT","homepage":"https://jstools.dev/rehype-toc","repository":{"type":"git","url":"git+https://github.com/JS-DevTools/rehype-toc.git"},"main":"lib/index.js","types":"lib/index.d.ts","scripts":{"clean":"shx rm -rf .nyc_output coverage lib","lint":"eslint src test","build":"tsc","watch":"tsc --watch","test":"mocha && npm run lint","coverage":"nyc node_modules/mocha/bin/mocha","upgrade":"npm-check -u && npm audit fix","bump":"bump --tag --push --all","release":"npm run upgrade && npm run clean && npm run build && npm test && npm run bump"},"engines":{"node":">=10"},"devDependencies":{"@jsdevtools/eslint-config":"^1.1.4","@jsdevtools/version-bump-prompt":"^6.1.0","@types/chai":"^4.2.14","@types/hast":"^2.3.1","@types/mocha":"^8.2.0","@types/node":"^14.14.20","@types/unist":"^2.0.3","chai":"^4.2.0","eslint":"^7.4.0","mocha":"^8.2.1","npm-check":"^5.9.2","nyc":"^15.1.0","rehype-parse":"^7.0.1","rehype-slug":"^4.0.1","rehype-stringify":"^8.0.0","shx":"^0.3.3","typescript":"^3.9.7","unified":"^9.2.0"},"gitHead":"1e90aaf8492a6c9fb2acaf6383b576154938268c","bugs":{"url":"https://github.com/JS-DevTools/rehype-toc/issues"},"_id":"@atomictech/rehype-toc@3.1.0","_nodeVersion":"14.15.1","_npmVersion":"6.14.8","dist":{"integrity":"sha512-kOP6nWxnhgrgfM9fShT1ySLPUdOYqV0OsrQP2RxfH39iItAwA5NorIVK0gni88/otseEPDTWwP8YWkTJmSi5ow==","shasum":"2e52be415a81e74f49e9c7c0a401cb41caeaa516","tarball":"https://registry.npmjs.org/@atomictech/rehype-toc/-/rehype-toc-3.1.0.tgz","fileCount":43,"unpackedSize":58159,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJf951mCRA9TVsSAnZWagAA8kkP/2Rn6/u4MjznhWlML/OL\nKCtGyzMES+k4UpT6upJBsaFenzpkgf7SEruP6HceNxrPEMSuOVhUEq+5fQ3X\npRkSjvKb1Hs5RcWhRFdMZ5temSHaG1QM1ISpy2YWdgthWGlP172AN6NVDbWs\n5xjXoVN3HRDsufO5iaRtGIf8jWyXTZH9xiFypY6f7l/WfHQ3qPUwNm/WsO+e\nn6CLEIKnBJaFZUrV0uWyE/pVNb7zvKXR1Zla1uOBsvjcTkrX7l+SBTwSYILz\n2HezDm689bhlzt9GUNbzQ0IHECV369aAVuAgCDCpwXjeZID8/YGKP60kvXps\nZkEOL9gXdumh65oLeFBFQwDHVM4/lRnEhXy5ndba4NI5p3YZxbRPp8/7AaEa\n/n2klLFOMjBdXSZfx4xt06CuwqYrMe0cTdsxkldf+7WSwUho2+BmskivaPVw\nSepOwhDM7fO+MOhUc0Ofks4Ll887cAhvi6TBqh+ekm3T/0lY6UYS87zk++C4\nRaN9KiAqCBKgZibmPCnXQLhxlNu8N0j4jeHFbJvTWq7CBomVjrhdliOxfg4J\nkU6LjZMqYvVUgNwi3Y+XYAx8PdMCi5sSjuNAwXRVOSYoVQlHxhrR1Um8SRPY\nyTifGpsDE+qJ+4lFwWcLGX6C7aopqi51SnkGOYxsKeD//tda1HeZ7dTPq62e\nj3fN\r\n=mbSx\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQC1zr2LvBBYeUfDVmuwDqp7AAY+8jbZ4iob3WjRw5WbSQIgIi+vHIk59k5AxioKfvGkuWG2nuvM9FnMaW7RdSOAP9E="}]},"_npmUser":{"name":"jule-","email":"jule@createrocks.com"},"directories":{},"maintainers":[{"name":"chabou-san","email":"chabou@live.com"},{"name":"jule-","email":"jule@createrocks.com"},{"name":"typedef","email":"yann.torres@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/rehype-toc_3.1.0_1610063205681_0.8335227840153996"},"_hasShrinkwrap":false},"3.1.1":{"name":"@atomictech/rehype-toc","version":"3.1.1","description":"A rehype plugin that adds a table of contents (TOC) to the page","keywords":["unified","rehype","plugin","rehype-plugin","table-of-contents","toc","html"],"author":{"name":"James Messinger","url":"https://jamesmessinger.com"},"license":"MIT","homepage":"https://jstools.dev/rehype-toc","repository":{"type":"git","url":"git+https://github.com/JS-DevTools/rehype-toc.git"},"main":"lib/index.js","types":"lib/index.d.ts","scripts":{"clean":"shx rm -rf .nyc_output coverage lib","lint":"eslint src test","build":"tsc","watch":"tsc --watch","test":"mocha && npm run lint","coverage":"nyc node_modules/mocha/bin/mocha","upgrade":"npm-check -u && npm audit fix","bump":"bump --tag --push --all","release":"npm run upgrade && npm run clean && npm run build && npm test && npm run bump"},"engines":{"node":">=10"},"devDependencies":{"@jsdevtools/eslint-config":"^1.1.4","@jsdevtools/version-bump-prompt":"^6.1.0","@types/chai":"^4.2.14","@types/hast":"^2.3.1","@types/mocha":"^8.2.0","@types/node":"^14.14.20","@types/unist":"^2.0.3","chai":"^4.2.0","eslint":"^7.4.0","mocha":"^8.2.1","npm-check":"^5.9.2","nyc":"^15.1.0","rehype-parse":"^7.0.1","rehype-slug":"^4.0.1","rehype-stringify":"^8.0.0","shx":"^0.3.3","typescript":"^3.9.7","unified":"^9.2.0"},"gitHead":"04aef46fc38e051f11d011c54bdaad1baee892f5","bugs":{"url":"https://github.com/JS-DevTools/rehype-toc/issues"},"_id":"@atomictech/rehype-toc@3.1.1","_nodeVersion":"14.15.1","_npmVersion":"6.14.8","dist":{"integrity":"sha512-kv5aeQvZqVC3L6uhfSxdMWRxG2I1q1fJpJ5a4AIFs+wDrWqcfM1BgO7eXC4gYPIpIKVbvZKZRBQvnfCPxnB7kQ==","shasum":"f0e087672ab360d1c2d4fc4a4e7c794123ed1080","tarball":"https://registry.npmjs.org/@atomictech/rehype-toc/-/rehype-toc-3.1.1.tgz","fileCount":43,"unpackedSize":58317,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJf/i4XCRA9TVsSAnZWagAAvh4QAJnOfEKj7QU9NrLDy6/F\nzwv7hHeJmI82HTaGRjeFxBlHR+Et/Fh7jbM0xIuZ60HfPOi0s0vOVLZzxxq2\nz8p+XTUcc2JA+M6RR2T5kfAgLGFo11HAdcuExz6FXhBaXHOf2pZ2qGdL9qBU\nI6ZpiExTvh8MNsfJHgf/eYYN1CuR6fTqd45rNKEfjX9u6Gaz11S+4PvNk1qL\ncXmHjMY0NEw92L0B5k7XR1Aa7kPdGXFoW0GZXTqkDt3SCL0eD9LHZybcpKN1\ncYl85CpaNnSfyXv1r4ydmK4Kw2jB4AyLu+9d+UB2AJ/w/mPISxMcjvKGIPDE\nS75fqoRQIgOk1uG+lapC0Kom62vvKYBVxwZ3kQLYhQiCEHJ5oM7UOsg3Fsha\nog6q8t64jnJ7msyO1iSRQQ1wKEBRroqXbYFfc7EqiUhhb5FjFoX8hLDa99St\nfN18cvSEN8kDkoX6OGicA39wFHLI45uWSZtPpndcpSzIJx7YCKn2QHcBfdRb\njf4WXrPJHie6L1lDt/W3nISycrEzmfyAz4jGCpC0PxnfU7jr7Oqa+TjYkCj6\n+9SkKPDCYwSEuYgeRxWyFRaXOS3bH0yBhTbFLpRrruMlGBV1b2pQGVujmJi+\nm9AAIoJrtluZiphX7+3MxfTJt35eCfMK+YuBDfc/otB7pq1xYUybxwwhwqOR\nGEBN\r\n=q/aK\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQD1N+UVDYXFooCGDrcr17Pb236OCmFTOUGKp0drEFR+dAIhAPm+y1F1A8Pr/l23YPJT1qUH4njzgmJkVPvBKwNYDUco"}]},"_npmUser":{"name":"jule-","email":"jule@createrocks.com"},"directories":{},"maintainers":[{"name":"chabou-san","email":"chabou@live.com"},{"name":"jule-","email":"jule@createrocks.com"},{"name":"typedef","email":"yann.torres@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/rehype-toc_3.1.1_1610493463022_0.5124702578588507"},"_hasShrinkwrap":false},"3.1.2":{"name":"@atomictech/rehype-toc","version":"3.1.2","description":"A rehype plugin that adds a table of contents (TOC) to the page","keywords":["unified","rehype","plugin","rehype-plugin","table-of-contents","toc","html"],"author":{"name":"James Messinger","url":"https://jamesmessinger.com"},"license":"MIT","homepage":"https://jstools.dev/rehype-toc","repository":{"type":"git","url":"git+https://github.com/JS-DevTools/rehype-toc.git"},"main":"lib/index.js","types":"lib/index.d.ts","scripts":{"clean":"shx rm -rf .nyc_output coverage lib","lint":"eslint src test","build":"tsc","watch":"tsc --watch","test":"mocha && npm run lint","coverage":"nyc node_modules/mocha/bin/mocha","upgrade":"npm-check -u && npm audit fix","bump":"bump --tag --push --all","release":"npm run upgrade && npm run clean && npm run build && npm test && npm run bump"},"engines":{"node":">=10"},"devDependencies":{"@jsdevtools/eslint-config":"^1.1.4","@jsdevtools/version-bump-prompt":"^6.1.0","@types/chai":"^4.2.14","@types/hast":"^2.3.1","@types/mocha":"^8.2.0","@types/node":"^14.14.20","@types/unist":"^2.0.3","chai":"^4.2.0","eslint":"^7.4.0","mocha":"^8.2.1","npm-check":"^5.9.2","nyc":"^15.1.0","rehype-parse":"^7.0.1","rehype-slug":"^4.0.1","rehype-stringify":"^8.0.0","shx":"^0.3.3","typescript":"^3.9.7","unified":"^9.2.0"},"gitHead":"6c3c24c195fa1b52137f0c6664fab92ccdf70efe","bugs":{"url":"https://github.com/JS-DevTools/rehype-toc/issues"},"_id":"@atomictech/rehype-toc@3.1.2","_nodeVersion":"14.15.1","_npmVersion":"6.14.8","dist":{"integrity":"sha512-ZLqzgBo9WUgXmLpCF8e2rYeHZjJbvWk/3R+mmpKBMDmjYRTb6/Fk6SSGFv0x1aorPwg0OLfg6ZvjAaRbndRPcA==","shasum":"62ec993528be26dbf304e1ec0db75ae074d459df","tarball":"https://registry.npmjs.org/@atomictech/rehype-toc/-/rehype-toc-3.1.2.tgz","fileCount":40,"unpackedSize":56675,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgDsrTCRA9TVsSAnZWagAAlg0P/2OOaIBednObUFW/iYlX\nS19HVSwOmOaNcZEWJkAYYTE54yfDb+uruSrSUey05U/Z8vbREwJxZ+x7r2f/\neGshc0rS+0sQjDL6pGZp9ZQdkJcqunGyYm1MvllPSFeNjz+yo4NXEVlfwnQh\nBPGWXe+ck18zHKZhvSHYbuG/QdLa5G3XJclw/Gpwe2UUcc4oBLibfQQPv893\nbFyHFGXdo9Tt3xMHwATcbGBev4KHSIziNNkVvXsOEhgyXRcTmCGqDuO6rOBi\nluYBuBHVK4REltrUJz57aQf25GPOmPjfXnmiVNMs2OKJhxM5RaQD0+0uCdTU\nrp3b4LTgaqXZLekc36BC08YM2nPH3wVpPYmg1Z8aKtsy1eInMqs/ryatJzOd\nttjbwePQdpqNv3zd2TjDR7ADevhrj6D32v1dwWr0JYGeGktTyYPuw7PBMl5Y\n0Xsgn34JFjkAAy0R6/+FF5+b3aIKO/05FCN3jqCLNDQopPdNAOrW1BfuU2+4\nclVsWhvwELse2wZb5f3wMkBVRLE0Zn1G4L26xeO9EI+XzTWeaZ0TPuhj+HC2\n5dZAMFWMti4tqxyy0Vryfg41ykvh7L2m+2rJmWnQ0YzgNINOBMDTHpLky+RG\nvW99U8P58x36QOTU1bbCq11JevcSPGB+SNhvAO4fCPDEQGXv45PglN4vb9TO\nA2ga\r\n=HiAW\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIGIQ1UYPP6x88P0wGeJfzKg5URmyXy3LWwzgyc+9dJMuAiBD6j+XuwAkrWRokTBHsW0ihi7stP+Ed2fIEwQgagHb7A=="}]},"_npmUser":{"name":"jule-","email":"jule@createrocks.com"},"directories":{},"maintainers":[{"name":"chabou-san","email":"chabou@live.com"},{"name":"jule-","email":"jule@createrocks.com"},{"name":"typedef","email":"yann.torres@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/rehype-toc_3.1.2_1611582163066_0.9180985370715682"},"_hasShrinkwrap":false},"3.1.3":{"name":"@atomictech/rehype-toc","version":"3.1.3","description":"A rehype plugin that adds a table of contents (TOC) to the page","keywords":["unified","rehype","plugin","rehype-plugin","table-of-contents","toc","html"],"author":{"name":"James Messinger","url":"https://jamesmessinger.com"},"license":"MIT","homepage":"https://jstools.dev/rehype-toc","repository":{"type":"git","url":"git+https://github.com/JS-DevTools/rehype-toc.git"},"main":"lib/index.js","types":"lib/index.d.ts","scripts":{"clean":"shx rm -rf .nyc_output coverage lib","lint":"eslint src test","build":"tsc","watch":"tsc --watch","test":"mocha && npm run lint","coverage":"nyc node_modules/mocha/bin/mocha","upgrade":"npm-check -u && npm audit fix","bump":"bump --tag --push --all","release":"npm run upgrade && npm run clean && npm run build && npm test && npm run bump"},"engines":{"node":">=10"},"devDependencies":{"@jsdevtools/eslint-config":"^1.1.4","@jsdevtools/version-bump-prompt":"^6.1.0","@types/chai":"^4.2.15","@types/hast":"^2.3.1","@types/mocha":"^8.2.2","@types/node":"^14.14.37","@types/unist":"^2.0.3","chai":"^4.3.4","eslint":"^7.23.0","mocha":"^8.3.2","npm-check":"^5.9.2","nyc":"^15.1.0","rehype-parse":"^7.0.1","rehype-slug":"^4.0.1","rehype-stringify":"^8.0.0","shx":"^0.3.3","typescript":"^3.9.7","unified":"^9.2.1"},"gitHead":"f07bad9e7cd7aed815ee9b6df6d87df6c86bc424","bugs":{"url":"https://github.com/JS-DevTools/rehype-toc/issues"},"_id":"@atomictech/rehype-toc@3.1.3","_nodeVersion":"14.15.1","_npmVersion":"6.14.8","dist":{"integrity":"sha512-qiNUJgdORp8RctdULIVm15KwePHFCGJdY3NsrMUbIhKt/oyVXyB30Z6qPFhmZrNVluoDw5TPiFrr4j0yUxofdA==","shasum":"3b3f88a69319cadc36e7d33ddae71dacfa5fe9a2","tarball":"https://registry.npmjs.org/@atomictech/rehype-toc/-/rehype-toc-3.1.3.tgz","fileCount":40,"unpackedSize":56763,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgY2HSCRA9TVsSAnZWagAAZugP+gKYWvylQMK57LW+hMeC\nFv5YRuQHoVoLAQ/z2WFz/NROgMLBcv4aTGIuODPXbSHMs3mHSAFN10QZPWbo\nBqeITNgDd3BmNMFgrRWuJhFLELgQ8gLfplC5W5pN61V6ufczG4YEwOrgOzMO\nInAsMeYASCJiatSlZeqrBM+fQjIZRnjCioUmxKaFJb3OvGlk3UeK2Gwku7Xz\nU5g9pEQd2JJJjbVRhJH0oKbGVjHrA9MHipHBuQHCOdAUgfqXPBxpxTAfVWWP\nJHK6lvai1AZllPx2xtl5tv/Kvpiq1DwfSYKQcZ1rxqGq9SH9mqEwHuakDFVs\ng4dcfckxWd/Tz0A4C40Tnoe19EjbsT/FupjVYjZMe3geEo+ujwvEAJFddxmF\n1ds1HRx28RnPV6TZXwMXH40L4AQbmFyu06apGbxA1vvaXTvOL89eZ7mQnSkl\nwmkovJ2C06K8d5A/fV1QBl2AzKzWVf1L5ypJJFhD0S8781qCV4SlRnjQ5mCj\nGYJBbuRycVP64pTjzO+7rfIDoSGP74XbKH5wJmeOsLdZ2xuYXD5F7ya/HJef\nixQipiUGOLqaltf0RZiwKzxx4LJFBV/r0EvJMP/oewG1SHvlaImNv988KHOy\nFv1IIWZzS0SpO1sMYwejaqV8g5/EqmxT25mo2s1CZ9eMRWzPNTXsLgMMlyWX\nO8wI\r\n=7AIS\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIBg/momJa7d+iv+LQz2+9ACUUnINQkXWwcL2e6tqP3uIAiAxlXLwjZ9mn6AJc+aHyBY1BBvhuBW3ou6tsw5jm5LI3g=="}]},"_npmUser":{"name":"jule-","email":"jule@createrocks.com"},"directories":{},"maintainers":[{"name":"chabou-san","email":"chabou@live.com"},{"name":"jule-","email":"jule@createrocks.com"},{"name":"typedef","email":"yann.torres@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/rehype-toc_3.1.3_1617125842170_0.17367137454237147"},"_hasShrinkwrap":false}},"time":{"created":"2021-01-07T23:46:45.518Z","3.1.0":"2021-01-07T23:46:45.777Z","modified":"2022-04-04T16:15:17.557Z","3.1.1":"2021-01-12T23:17:43.205Z","3.1.2":"2021-01-25T13:42:43.175Z","3.1.3":"2021-03-30T17:37:22.359Z"},"maintainers":[{"name":"chabou-san","email":"chabou@live.com"},{"name":"jule-","email":"jule@createrocks.com"},{"name":"typedef","email":"yann.torres@gmail.com"}],"description":"A rehype plugin that adds a table of contents (TOC) to the page","homepage":"https://jstools.dev/rehype-toc","keywords":["unified","rehype","plugin","rehype-plugin","table-of-contents","toc","html"],"repository":{"type":"git","url":"git+https://github.com/JS-DevTools/rehype-toc.git"},"author":{"name":"James Messinger","url":"https://jamesmessinger.com"},"bugs":{"url":"https://github.com/JS-DevTools/rehype-toc/issues"},"license":"MIT","readme":"# Table of Contents plugin for Rehype\nA [rehype](https://github.com/rehypejs/rehype) plugin that adds a table of contents (TOC) to the page\n\n[![Cross-Platform Compatibility](https://jstools.dev/img/badges/os-badges.svg)](https://github.com/JS-DevTools/rehype-toc/actions)\n[![Build Status](https://github.com/JS-DevTools/rehype-toc/workflows/CI-CD/badge.svg)](https://github.com/JS-DevTools/rehype-toc/actions)\n\n[![Coverage Status](https://coveralls.io/repos/github/JS-DevTools/rehype-toc/badge.svg?branch=master)](https://coveralls.io/github/JS-DevTools/rehype-toc)\n[![Dependencies](https://david-dm.org/JS-DevTools/rehype-toc.svg)](https://david-dm.org/JS-DevTools/rehype-toc)\n\n[![npm](https://img.shields.io/npm/v/@jsdevtools/rehype-toc.svg)](https://www.npmjs.com/package/@jsdevtools/rehype-toc)\n[![License](https://img.shields.io/npm/l/@jsdevtools/rehype-toc.svg)](LICENSE)\n[![Buy us a tree](https://img.shields.io/badge/Treeware-%F0%9F%8C%B3-lightgreen)](https://plant.treeware.earth/JS-DevTools/rehype-toc)\n\n\n\nFeatures\n--------------------------\n- Adds a `<nav>` and `<ol>` list outlining all headings on the page\n- Combine with [rehype-slug](https://github.com/rehypejs/rehype-slug) to create links to each heading\n- Ignores headings outside of `<main>` if it exists\n- You can customize which headings are included (defaults to `<h1>` - `<h6>`)\n- You can customize the CSS classes on every TOC element\n- Hooks give you complete customization of the generated HTML\n\n\n\nExample\n--------------------------\n\n**input.html**<br>\nHere's the original HTML file. There are three levels of headings (`<h1>` - `<h3>`), and none of them have IDs.\n\n```html\n<html>\n  <body>\n    <h1>Apple Pie Recipe</h1>\n    <p>This is the world's best apple pie recipe...</p>\n\n    <div>\n      <h2>Filling</h2>\n      <p>The filling is the best part...</p>\n\n      <h3>Preparing the apples</h3>\n      <p>Cut the apples into 1/4 inch slices...</p>\n\n      <h3>Preparing the spice mix</h3>\n      <p>In a mixing bowl, combine sugar, cinnamon...</p>\n    </div>\n\n    <div>\n      <h2>Crust</h2>\n      <p>How to make the perfect flaky crust...</p>\n\n      <h3>Preparing the dough</h3>\n      <p>Combine flour, sugar, salt...</p>\n\n      <h3>The criss-cross top</h3>\n      <p>Cut the top crust into 1/2 inch strips...</p>\n    </div>\n  </body>\n</html>\n```\n\n**example.js**<br>\nThis script reads the `input.html` file above writes the results to `output.html` (shown below). The script uses [unified](https://unifiedjs.com/), [rehype-parse](https://github.com/rehypejs/rehype/tree/master/packages/rehype-parse), [rehype-slug](https://github.com/rehypejs/rehype-slug), and [rehype-stringify](https://github.com/rehypejs/rehype/tree/master/packages/rehype-stringify).\n\n\n```javascript\nconst unified = require(\"unified\");\nconst parse = require(\"rehype-parse\");\nconst slug = require(\"rehype-slug\");\nconst toc = require(\"@jsdevtools/rehype-toc\");\nconst stringify = require(\"rehype-stringify\");\nconst fs = require(\"fs\");\n\nasync function example() {\n  // Create a Rehype processor with the TOC plugin\n  const processor = unified()\n    .use(parse)\n    .use(slug)\n    .use(toc)\n    .use(stringify);\n\n  // Read the original HTML file\n  let inputHTML = await fs.promises.readFile(\"input.html\");\n\n  // Process the HTML, adding heading IDs and Table of Contents\n  let outputHTML = await processor.process(inputHTML);\n\n  // Save the new HTML\n  await fs.promises.writeFile(\"output.html\", outputHTML);\n}\n```\n\n**output.html**<br>\nHere's the HTML that gets created by the above script. Notice that a table of contents has been added at the top of the `<body>`, with links to each of the headings on the page. The headings also now have IDs, thanks to [rehype-slug](https://github.com/rehypejs/rehype-slug).\n\n```html\n<html>\n  <body>\n    <nav class=\"toc\">\n      <ol class=\"toc-level toc-level-1\">\n        <li class=\"toc-item toc-item-h1\">\n          <a class=\"toc-link toc-link-h1\" href=\"#apple-pie-recipe\">\n            Apple Pie Recipe\n          </a>\n\n          <ol class=\"toc-level toc-level-2\">\n            <li class=\"toc-item toc-item-h2\">\n              <a class=\"toc-link toc-link-h2\" href=\"#filling\">\n                Filling\n              </a>\n\n              <ol class=\"toc-level toc-level-3\">\n                <li class=\"toc-item toc-item-h3\">\n                  <a class=\"toc-link toc-link-h3\" href=\"#preparing-the-apples\">\n                    Preparing the apples\n                  </a>\n                </li>\n                <li class=\"toc-item toc-item-h3\">\n                  <a class=\"toc-link toc-link-h3\" href=\"#preparing-the-spice-mix\">\n                    Preparing the spice mix\n                  </a>\n                </li>\n              </ol>\n            </li>\n\n            <li class=\"toc-item toc-item-h2\">\n              <a class=\"toc-link toc-link-h2\" href=\"#crust\">\n                Crust\n              </a>\n\n              <ol class=\"toc-level toc-level-3\">\n                <li class=\"toc-item toc-item-h3\">\n                  <a class=\"toc-link toc-link-h3\" href=\"#preparing-the-dough\">\n                    Preparing the dough\n                  </a>\n                </li>\n                <li class=\"toc-item toc-item-h3\">\n                  <a class=\"toc-link toc-link-h3\" href=\"#the-criss-cross-top\">\n                    The criss-cross top\n                  </a>\n                </li>\n              </ol>\n            </li>\n          </ol>\n        </li>\n      </ol>\n    </nav>\n\n    <h1 id=\"apple-pie-recipe\">Apple Pie Recipe</h1>\n    <p>This is the world's best apple pie recipe...</p>\n\n    <div>\n      <h2 id=\"filling\">Filling</h2>\n      <p>The filling is the best part...</p>\n\n      <h3 id=\"preparing-the-apples\">Preparing the apples</h3>\n      <p>Cut the apples into 1/4 inch slices...</p>\n\n      <h3 id=\"preparing-the-spice-mix\">Preparing the spice mix</h3>\n      <p>In a mixing bowl, combine sugar, cinnamon...</p>\n    </div>\n\n    <div>\n      <h2 id=\"crust\">Crust</h2>\n      <p>How to make the perfect flaky crust...</p>\n\n      <h3 id=\"preparing-the-dough\">Preparing the dough</h3>\n      <p>Combine flour, sugar, salt...</p>\n\n      <h3 id=\"the-criss-cross-top\">The criss-cross top</h3>\n      <p>Cut the top crust into 1/2 inch strips...</p>\n    </div>\n  </body>\n</html>\n```\n\n\n\nInstallation\n--------------------------\nYou can install Rehype TOC via [npm](https://docs.npmjs.com/about-npm/).\n\n```bash\nnpm install @jsdevtools/rehype-toc\n```\n\nYou'll probably want to install [unified](https://unifiedjs.com/), [rehype-parse](https://github.com/rehypejs/rehype/tree/master/packages/rehype-parse), [rehype-stringify](https://github.com/rehypejs/rehype/tree/master/packages/rehype-stringify), and [rehype-slug](https://github.com/rehypejs/rehype-slug) as well.\n\n```bash\nnpm install unified rehype-parse rehype-stringify rehype-slug\n```\n\n\n\nUsage\n--------------------------\nUsing the Rehype TOC plugin requires an understanding of how to use Unified and Rehype. [Here is an excelleng guide](https://unifiedjs.com/using-unified.html) to learn the basics.\n\nThe Rehype TOC plugin works just like any other Rehype plugin. Pass it to [the `.use()` method](https://github.com/unifiedjs/unified#processoruseplugin-options), optionally with an [options object](#options).\n\n```javascript\nconst unified = require(\"unified\");\nconst toc = require(\"@jsdevtools/rehype-toc\");\n\n// Use the Rehype TOC plugin with its default options\nunified().use(toc);\n\n// Use the Rehype TOC plugin with custom options\nunified().use(toc, {\n  headings: [\"h1\", \"h2\"],     // Only include <h1> and <h2> headings in the TOC\n  cssClasses: {\n    toc: \"page-outline\",      // Change the CSS class for the TOC\n    link: \"page-link\",        // Change the CSS class for links in the TOC\n  }\n});\n```\n\n\n\nOptions\n--------------------------\nThe Rehype TOC plugin supports the following options:\n\n|Option                |Type                |Default                |Description\n|:---------------------|:-------------------|:----------------------|:-----------------------------------------\n|`nav`                 |boolean             |true                   |Determines whether the table of contents is wrapped in a `<nav>` element.\n|`position`            |string              |\"afterbegin\"           |The position at which the table of contents should be inserted, relative to the `<main>` or `<body>` element. Can be \"beforebegin\", \"afterbegin\", \"beforeend\", or \"afterend\". See [the `insertAdjacentElement()` docs](https://developer.mozilla.org/en-US/docs/Web/API/Element/insertAdjacentElement) for an explanation of each value.\n|`placeholder`         |string              |                       |The optional placeholder string to replace with the table of contents.\n|`headings`            |array of strings    |h1, h2, h3, h4, h5, h6 |The HTML heading tags to include in the table of contents\n|`cssClasses.toc`      |string              |toc                    |The CSS class name for the top-level `<nav>` or `<ol>` element that contains the whole table of contents.\n|`cssClasses.list`     |string              |toc-level              |The CSS class name for all `<ol>` elements in the table of contents, including the top-level one.\n|`cssClasses.listItem` |string              |toc-item               |The CSS class name for all `<li>` elements in the table of contents.\n|`cssClasses.link`     |string              |toc-link               |The CSS class name for all `<a>` elements in the table of contents.\n|`customizeTOC`        |function(toc)       |                       |Allows you to customize the table of contents before it is added to the page.<br><br>The function receives the TOC node tree and can modify it in any way you want. Or you can return a new node tree to use instead. Or return `false` to prevent the the TOC from being added to the page.\n|`customizeTOCItem`    |function(toc, heading)|                     |Allows you to customize each item in the table of contents before it is added to the page.<br><br>The function receives the TOC item's node tree and the heading node that it refers to. You can modify the nodes in any way you want. Or you can return a new node tree to use instead. Or return `false` to prevent the the TOC from being added to the page.\n\n\n\nContributing\n--------------------------\nContributions, enhancements, and bug-fixes are welcome!  [Open an issue](https://github.com/JS-DevTools/rehype-toc/issues) on GitHub and [submit a pull request](https://github.com/JS-DevTools/rehype-toc/pulls).\n\n#### Building\nTo build the project locally on your computer:\n\n1. __Clone this repo__<br>\n`git clone https://github.com/JS-DevTools/rehype-toc.git`\n\n2. __Install dependencies__<br>\n`npm install`\n\n3. __Build the code__<br>\n`npm run build`\n\n4. __Run the tests__<br>\n`npm test`\n\n\n\nLicense\n--------------------------\nRehype TOC is 100% free and open-source, under the [MIT license](LICENSE). Use it however you want.\n\nThis package is [Treeware](http://treeware.earth). If you use it in production, then we ask that you [**buy the world a tree**](https://plant.treeware.earth/JS-DevTools/rehype-toc) to thank us for our work. By contributing to the Treeware forest you’ll be creating employment for local families and restoring wildlife habitats.\n\n\n\nBig Thanks To\n--------------------------\nThanks to these awesome companies for their support of Open Source developers ❤\n\n[![Travis CI](https://jstools.dev/img/badges/travis-ci.svg)](https://travis-ci.com)\n[![SauceLabs](https://jstools.dev/img/badges/sauce-labs.svg)](https://saucelabs.com)\n[![Coveralls](https://jstools.dev/img/badges/coveralls.svg)](https://coveralls.io)\n","readmeFilename":"README.md"}