{"_id":"remark-custom-header-id","_rev":"1-74c680891d1cadf2f9e75a1b26d371da","name":"remark-custom-header-id","dist-tags":{"latest":"1.0.0"},"versions":{"0.1.0":{"name":"remark-custom-header-id","version":"0.1.0","description":"Remark plugin for adding custom ID attribute to Markdown headers","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/remark-custom-header-id.git"},"funding":"https://github.com/sponsors/sindresorhus","author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"https://sindresorhus.com"},"type":"module","exports":{"types":"./index.d.ts","default":"./index.js"},"sideEffects":false,"engines":{"node":">=18"},"scripts":{"test":"xo && ava && tsc index.d.ts"},"keywords":["remark","remark-plugin","markdown","header","heading","unified","plugin","html","id","attribute","astro"],"dependencies":{"@types/unist":"^3.0.2","unist-util-visit":"^5.0.0"},"devDependencies":{"ava":"^6.1.2","rehype-stringify":"^10.0.0","remark-parse":"^11.0.0","remark-rehype":"^11.1.0","typescript":"^5.4.2","unified":"^11.0.4","xo":"^0.58.0"},"types":"./index.d.ts","gitHead":"50906973283a473d45e2b3e31aeef1170e507d1a","bugs":{"url":"https://github.com/sindresorhus/remark-custom-header-id/issues"},"homepage":"https://github.com/sindresorhus/remark-custom-header-id#readme","_id":"remark-custom-header-id@0.1.0","_nodeVersion":"18.19.0","_npmVersion":"9.2.0","dist":{"integrity":"sha512-7RspfkCpuMGsKSsbV5uX7KqLeN0Fx/La3IpUWLb7scewVSKGUoSl+BghT+o04qih9tgDSItpo31nIS5f5Y4a4Q==","shasum":"f7804b6a1baacb4aa6ad938fe9e004e6eed114c6","tarball":"https://registry.npmjs.org/remark-custom-header-id/-/remark-custom-header-id-0.1.0.tgz","fileCount":5,"unpackedSize":3967,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIBaiVVGZq84prTSXCWcKU0lFwSOYmeKPEaAhYn/oiZvCAiEAm0LD2y+NmEXuCcv/vBPHjOzIO4SM1j8+j6z0IvFQAVM="}]},"_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"directories":{},"maintainers":[{"name":"sindresorhus","email":"sindresorhus@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/remark-custom-header-id_0.1.0_1710139018161_0.8768836500403518"},"_hasShrinkwrap":false},"1.0.0":{"name":"remark-custom-header-id","version":"1.0.0","description":"Remark plugin for adding a custom ID attribute to Markdown headers","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/remark-custom-header-id.git"},"funding":"https://github.com/sponsors/sindresorhus","author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"https://sindresorhus.com"},"type":"module","exports":{"types":"./index.d.ts","default":"./index.js"},"sideEffects":false,"engines":{"node":">=18"},"scripts":{"test":"xo && ava && tsc index.d.ts"},"keywords":["remark","remark-plugin","markdown","header","heading","unified","plugin","html","id","attribute","astro"],"dependencies":{"@types/unist":"^3.0.2","unist-util-visit":"^5.0.0"},"devDependencies":{"ava":"^6.1.3","rehype-stringify":"^10.0.0","remark-parse":"^11.0.0","remark-rehype":"^11.1.0","typescript":"^5.4.5","unified":"^11.0.4","xo":"^0.58.0"},"_id":"remark-custom-header-id@1.0.0","gitHead":"4bd527187f42a3d13672a04b041f6d00fcbdcee0","types":"./index.d.ts","bugs":{"url":"https://github.com/sindresorhus/remark-custom-header-id/issues"},"homepage":"https://github.com/sindresorhus/remark-custom-header-id#readme","_nodeVersion":"18.20.2","_npmVersion":"10.6.0","dist":{"integrity":"sha512-xs1MAgCg1HoiIfqSVV5BPydB4/sc1tT8OHDoqt8Lnf1JHPMUDVumY2Szm/P9MIxIzOT9+tu4IYJTql0vCzldoA==","shasum":"7da9d6ffbea700e3361e8ec3c11d54bb17f4f8ab","tarball":"https://registry.npmjs.org/remark-custom-header-id/-/remark-custom-header-id-1.0.0.tgz","fileCount":5,"unpackedSize":4531,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCw/both5cgm8x4Ygc3QacvdOp4ndsYt/n8J+a7p1A4/gIhAOmNWCWSmhWrxJdp1x1ztRN9EmxotNFFB/Kbf9SnGWbk"}]},"_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"directories":{},"maintainers":[{"name":"sindresorhus","email":"sindresorhus@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/remark-custom-header-id_1.0.0_1716918334426_0.2993617595704887"},"_hasShrinkwrap":false}},"time":{"created":"2024-03-11T06:36:58.160Z","0.1.0":"2024-03-11T06:36:58.327Z","modified":"2024-05-28T17:45:34.901Z","1.0.0":"2024-05-28T17:45:34.556Z"},"maintainers":[{"name":"sindresorhus","email":"sindresorhus@gmail.com"}],"description":"Remark plugin for adding a custom ID attribute to Markdown headers","homepage":"https://github.com/sindresorhus/remark-custom-header-id#readme","keywords":["remark","remark-plugin","markdown","header","heading","unified","plugin","html","id","attribute","astro"],"repository":{"type":"git","url":"git+https://github.com/sindresorhus/remark-custom-header-id.git"},"author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"https://sindresorhus.com"},"bugs":{"url":"https://github.com/sindresorhus/remark-custom-header-id/issues"},"license":"MIT","readme":"# remark-custom-header-id\n\n> [Remark](https://github.com/remarkjs/remark) plugin for adding a custom ID attribute to Markdown headers\n\nThis allows for stable and more meaningful anchor links in your generated HTML.\n\n## Install\n\n```sh\nnpm install remark-custom-header-id\n```\n\n## Usage\n\n### Remark\n\n```js\nimport {remark} from 'remark';\nimport remarkRehype from 'remark-rehype';\nimport rehypeStringify from 'rehype-stringify';\nimport remarkCustomHeaderId from 'remark-custom-header-id';\n\nconst file = await remark()\n\t.use(remarkCustomHeaderId)\n\t.use(remarkRehype) // Markdown to HTML\n\t.use(rehypeStringify) // Stringify the HTML\n\t.process('# Foo {#custom-id}');\n\nconsole.log(String(file));\n//=> '<h1 id=\"custom-id\">Foo</h1>'\n```\n\n### Astro\n\n```js\n// astro.config.js\nimport remarkCustomHeaderId from 'remark-custom-header-id';\n\nexport default defineConfig({\n\t// …\n\tmarkdown: {\n\t\tremarkPlugins: [\n\t\t\tremarkCustomHeaderId,\n\t\t],\n\t},\n\t// …\n});\n```\n\n### Alternative syntax for MDX files\n\nThe `{#custom-id}` notation does not work in [MDX](https://mdxjs.com) files because MDX treats `{}` as JSX syntax, causing a parsing error. \n\nYou can use one of these alternatives:\n\n- Escape curly braces: `\\{#custom-id\\}`\n- Use this syntax: `||custom-id||`\n\nExamples:\n\n- `## Some header \\{#custom-id\\}`\n- `## Some header ||custom-id||`\n\n## API\n\n### remarkCustomHeaderId()\n\nReturns a transformer function to be used with Remark.\n","readmeFilename":"readme.md"}