{"_id":"@acdzh/remark-sectionize","_rev":"1-cdf3821b2db28b04a758a09f701ee13f","name":"@acdzh/remark-sectionize","dist-tags":{"latest":"0.0.2"},"versions":{"0.0.1":{"name":"@acdzh/remark-sectionize","version":"0.0.1","description":"Wrap content below each heading in a <section> element","main":"index.js","repository":{"type":"git","url":"git+https://github.com/acdzh/remark-sectionize.git"},"author":{"name":"acdzh","email":"acdzh@outlook.com"},"license":"MIT","private":false,"type":"module","scripts":{"test":"node test.js"},"keywords":["remark","plugin","markdown","html","section"],"dependencies":{"unist-util-find-after":"^4.0.1","unist-util-visit":"^4.1.2"},"devDependencies":{"remark":"^14.0.2","tape":"^5.6.3","unist-builder":"^3.0.1","unist-util-remove-position":"^4.0.2"},"_id":"@acdzh/remark-sectionize@0.0.1","bugs":{"url":"https://github.com/acdzh/remark-sectionize/issues"},"homepage":"https://github.com/acdzh/remark-sectionize#readme","_nodeVersion":"20.10.0","_npmVersion":"10.2.3","dist":{"integrity":"sha512-5j+56O6045QxE7RBsgi7kulfDoFwrtAUk3YAT5VTn+6+bX8/sT88RB0ng3/a1U6BRToTuCNTnUpojZBFVtXcxw==","shasum":"00caba2c7f4a5d97fc0938984fde953bd8d2bffc","tarball":"https://registry.npmjs.org/@acdzh/remark-sectionize/-/remark-sectionize-0.0.1.tgz","fileCount":6,"unpackedSize":14576,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHcI84Crlir/vOeztFHaqbJ4oysuTd8OTJcN0l1vKPGzAiA4WEP4M7RwwW1adzLf/OPOLINcRVHKAx3qbAcRYBKixw=="}]},"_npmUser":{"name":"acdzh","email":"1069436872@qq.com"},"directories":{},"maintainers":[{"name":"acdzh","email":"1069436872@qq.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/remark-sectionize_0.0.1_1706013278203_0.9329803276658521"},"_hasShrinkwrap":false},"0.0.2":{"name":"@acdzh/remark-sectionize","version":"0.0.2","description":"Wrap content below each heading in a <section> element","main":"index.js","repository":{"type":"git","url":"git+https://github.com/acdzh/remark-sectionize.git"},"author":{"name":"acdzh","email":"acdzh@outlook.com"},"license":"MIT","private":false,"type":"module","scripts":{"test":"node test.js"},"keywords":["remark","plugin","markdown","html","section"],"dependencies":{"unist-util-find-after":"^4.0.1","unist-util-visit":"^4.1.2"},"devDependencies":{"remark":"^14.0.2","tape":"^5.6.3","unist-builder":"^3.0.1","unist-util-remove-position":"^4.0.2"},"_id":"@acdzh/remark-sectionize@0.0.2","gitHead":"d3cc600a4796ddc784361aadf2cd7ecca933f327","bugs":{"url":"https://github.com/acdzh/remark-sectionize/issues"},"homepage":"https://github.com/acdzh/remark-sectionize#readme","_nodeVersion":"20.10.0","_npmVersion":"10.2.3","dist":{"integrity":"sha512-jpS3CbD76Uj18AA1ggZKveV+r7FkaSwKbDF2wk21ro0RZrZWYDHRIgPOWFIvjaVb0emBeLqxETCz5fE3uUXK2A==","shasum":"6e03a0ff652378f3bad1894a6d1a50705c1d120b","tarball":"https://registry.npmjs.org/@acdzh/remark-sectionize/-/remark-sectionize-0.0.2.tgz","fileCount":5,"unpackedSize":14150,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIFAs3ffSkFjbkvwtUotR0vxXrVmM/M3xQ6Y+9UW1IgcmAiBdKTqtW9NOJAkuW9kpTVYujck5Z8fy4svKZBOiOPWJOw=="}]},"_npmUser":{"name":"acdzh","email":"1069436872@qq.com"},"directories":{},"maintainers":[{"name":"acdzh","email":"1069436872@qq.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/remark-sectionize_0.0.2_1706016456904_0.5932113846278888"},"_hasShrinkwrap":false}},"time":{"created":"2024-01-23T12:34:38.076Z","0.0.1":"2024-01-23T12:34:38.344Z","modified":"2024-01-23T13:27:37.222Z","0.0.2":"2024-01-23T13:27:37.083Z"},"maintainers":[{"name":"acdzh","email":"1069436872@qq.com"}],"description":"Wrap content below each heading in a <section> element","homepage":"https://github.com/acdzh/remark-sectionize#readme","keywords":["remark","plugin","markdown","html","section"],"repository":{"type":"git","url":"git+https://github.com/acdzh/remark-sectionize.git"},"author":{"name":"acdzh","email":"acdzh@outlook.com"},"bugs":{"url":"https://github.com/acdzh/remark-sectionize/issues"},"license":"MIT","readme":"# remark-sectionize\n\n**Forked from https://github.com/jake-low/remark-sectionize, add flatten option.**\n\nThis is a [remark](https://github.com/remarkjs/remark) plugin to wrap each\nheading and the content that follows it in a `<section>` tag, allowing you to\nstyle the document sections using CSS.\n\n## Example\n\nWhen using `remark-sectionize`, given the following markdown:\n\n```md\n# Forest elephants\n\n## Introduction\n\nIn this section, we discuss the lesser known forest elephants.\n\n## Habitat\n\nForest elephants do not live in trees but among them.\n```\n\n...remark will output the following HTML:\n\n```html\n<section>\n  <h1>Forest elephants</h1>\n  <section>\n    <h2>Introduction</h2>\n    <p>In this section, we discuss the lesser known forest elephants.</p>\n  </section>\n  <section>\n    <h2>Habitat</h2>\n    <p>Forest elephants do not live in trees but among them.</p>\n  </section>\n</section>\n```\n\nif flatten option is `true`, the output will be:\n\n```html\n<section>\n  <h1>Forest elephants</h1>\n</section>\n<section>\n  <h2>Introduction</h2>\n  <p>In this section, we discuss the lesser known forest elephants.</p>\n</section>\n<section>\n  <h2>Habitat</h2>\n  <p>Forest elephants do not live in trees but among them.</p>\n</section>\n```\n\nOne use case of this plugin is to permit the logical sections of a document to\nbe targeted and styled using CSS. For example, you could do something like\nthis:\n\n```css\nsection > section:nth-child(even) {\n  background-color: white;\n}\n\nsection > section:nth-child(odd) {\n  background-color: papayawhip;\n}\n```\n\nTo give the `h2`-level sections alternating background colors.\n\n## Installation\n\n```sh\nnpm install @acdzh/remark-sectionize\n```\n\n## Usage\n\nIf you are invoking `remark` (or `unified`) in JavaScript, you can add this\nplugin by calling `use()`:\n\n```js\nimport { remark } from 'remark'\nimport html from 'remark-html'\nimport sectionize from 'remark-sectionize'\n\nconst input = `\n# Hello world!\n\nThe above heading and this paragraph will be wrapped in a <section> tag.\n`\n\nremark()\n  .use(sectionize)\n  .use(html, { sanitize: false })\n  .process(input, (err, file) => {\n    if (err) {\n      console.error(err)\n    } else {\n      console.log(String(file))\n    }\n  })\n```\n\nIf you're using remark from the CLI, you can use sectionize via the `--use`\nargument:\n\n```\n$ remark --use sectionize example.md\n```\n\nNote that for the above to work, `remark-sectionize` needs to be installed\nsomewhere that `remark` can find.\n\nFinally, if you're using Webpack and\n[mdx-loader](https://www.npmjs.com/package/mdx-loader) to import markdown files\nfrom JS, you can modify the loader options in your webpack config file, adding\n`sectionize` to your `mdPlugins` list (something like the following):\n\n```js\nimport sectionize from 'remark-sectionize'\n\nmodule.exports = {\n  module: {\n    rules: [\n      {\n        test: /\\.(md|mdx|markdown)$/,\n        use: [\n          {\n            loader: \"babel-loader\",\n            options: {\n              presets: [\"@babel/preset-react\"]\n            }\n          },\n          {\n            loader: \"mdx-loader\",\n            options: {\n              mdPlugins: [sectionize]\n            }\n          }\n        ]\n      }\n    ]\n  }\n};\n```\n\n## License\n\nThis repository is licensed under the MIT license; see the LICENSE file for details.\n","readmeFilename":"README.md"}