{"_id":"unist-util-add","_rev":"3-4a0b2c18dcdcc384bae07c05c0d0b34d","name":"unist-util-add","dist-tags":{"latest":"1.2.0"},"versions":{"1.0.1":{"name":"unist-util-add","version":"1.0.1","keywords":["unist","unist-util","util","utility","remark","retext","rehype","remark-plugin","unified","add","markdown","html","xml","tree","ast"],"author":{"name":"shlroland","email":"shlroland1995@gmail.com"},"license":"MIT","_id":"unist-util-add@1.0.1","maintainers":[{"name":"shlroland","email":"shlroland1995@gmail.com"}],"homepage":"https://github.com/shlroland/unist-util-add#readme","bugs":{"url":"https://github.com/shlroland/unist-util-add/issues"},"dist":{"shasum":"4e20d31e32c7ef2b4b8fbcad5065aa9a7fa4bf94","tarball":"https://registry.npmjs.org/unist-util-add/-/unist-util-add-1.0.1.tgz","fileCount":5,"integrity":"sha512-vQlbb0ptcvCqgmF11gsPfY82PlAdRChhSKra8sDwZmcfq1uStX6ZWcVSL6CZoA8J6zYSKAvYKcnBP1HUx7flHQ==","signatures":[{"sig":"MEQCIFUDPDNrOPwWORLeI37JCU/8bdjweyXQQakq/Sw1Hfc+AiAkKFlRtI724w0Wt/CCShsOo+jmmf6Xhbe3m6NJ03GJfA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":3928},"type":"module","_from":"file:unist-util-add-1.0.1.tgz","types":"./index.d.ts","engines":{"node":">=18"},"exports":"./index.js","scripts":{"build":"tsup","ci:publish":"pnpm build && pnpm publish --no-git-checks --tag latest","ci:version":"pnpm changeset version"},"_npmUser":{"name":"shlroland","email":"shlroland1995@gmail.com"},"_resolved":"/tmp/e626a2646cca4f0abb6b0fe5541fd475/unist-util-add-1.0.1.tgz","_integrity":"sha512-vQlbb0ptcvCqgmF11gsPfY82PlAdRChhSKra8sDwZmcfq1uStX6ZWcVSL6CZoA8J6zYSKAvYKcnBP1HUx7flHQ==","repository":{"url":"git+https://github.com/shlroland/unist-util-add.git","type":"git"},"_npmVersion":"10.7.0","description":"remark plugin to support highlight mark","directories":{},"sideEffects":false,"_nodeVersion":"20.15.1","_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.2.3","unified":"^11.0.5","typescript":"^5.5.4","remark-parse":"^11.0.0","@changesets/cli":"^2.27.7","remark-stringify":"^11.0.0","@tsconfig/node-lts":"^20.1.3","micromark-util-types":"^2.0.0","mdast-util-to-markdown":"^2.1.0","mdast-util-from-markdown":"^2.0.1"},"_npmOperationalInternal":{"tmp":"tmp/unist-util-add_1.0.1_1722319553016_0.19293970423256446","host":"s3://npm-registry-packages"}},"1.0.2":{"name":"unist-util-add","version":"1.0.2","keywords":["unist","unist-util","util","utility","remark","retext","rehype","remark-plugin","unified","add","markdown","html","xml","tree","ast"],"author":{"name":"shlroland","email":"shlroland1995@gmail.com"},"license":"MIT","_id":"unist-util-add@1.0.2","maintainers":[{"name":"shlroland","email":"shlroland1995@gmail.com"}],"homepage":"https://github.com/shlroland/unist-util-add#readme","bugs":{"url":"https://github.com/shlroland/unist-util-add/issues"},"dist":{"shasum":"86e68a40235075b90df02ad0a226ccaef049c42e","tarball":"https://registry.npmjs.org/unist-util-add/-/unist-util-add-1.0.2.tgz","fileCount":5,"integrity":"sha512-aAv0gak90IX3mAyltVFMD920AotNiKGZlg6AEvy0GXle1aWqrU4B70DejChnL4aa6FLcElAGKcdQZppyssvweg==","signatures":[{"sig":"MEYCIQDif9XTafffdWpJmBO0BXoibm0Qn4o4eLc/lrNfiCKUqAIhAPUt1frkNz9tj7O5uTqX15gTHFGwC5ehOJN9X2il9g2f","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":4344},"type":"module","_from":"file:unist-util-add-1.0.2.tgz","types":"./index.d.ts","engines":{"node":">=18"},"exports":"./index.js","scripts":{"build":"tsup","ci:publish":"pnpm build && pnpm publish --no-git-checks --tag latest","ci:version":"pnpm changeset version"},"_npmUser":{"name":"shlroland","email":"shlroland1995@gmail.com"},"_resolved":"/tmp/0b49056f635261da9988ac90e9db4022/unist-util-add-1.0.2.tgz","_integrity":"sha512-aAv0gak90IX3mAyltVFMD920AotNiKGZlg6AEvy0GXle1aWqrU4B70DejChnL4aa6FLcElAGKcdQZppyssvweg==","repository":{"url":"git+https://github.com/shlroland/unist-util-add.git","type":"git"},"_npmVersion":"10.8.1","description":"remark plugin to support highlight mark","directories":{},"sideEffects":false,"_nodeVersion":"20.16.0","_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.2.3","unified":"^11.0.5","typescript":"^5.5.4","remark-parse":"^11.0.0","@changesets/cli":"^2.27.7","remark-stringify":"^11.0.0","@tsconfig/node-lts":"^20.1.3","micromark-util-types":"^2.0.0","mdast-util-to-markdown":"^2.1.0","mdast-util-from-markdown":"^2.0.1"},"_npmOperationalInternal":{"tmp":"tmp/unist-util-add_1.0.2_1723082157721_0.6291345448691064","host":"s3://npm-registry-packages"}},"1.1.0":{"name":"unist-util-add","version":"1.1.0","keywords":["unist","unist-util","util","utility","remark","retext","rehype","remark-plugin","unified","add","markdown","html","xml","tree","ast"],"author":{"name":"shlroland","email":"shlroland1995@gmail.com"},"license":"MIT","_id":"unist-util-add@1.1.0","maintainers":[{"name":"shlroland","email":"shlroland1995@gmail.com"}],"homepage":"https://github.com/shlroland/unist-util-add#readme","bugs":{"url":"https://github.com/shlroland/unist-util-add/issues"},"dist":{"shasum":"f2a7a41521a891a7efc6b11102d2965a99c7a3ad","tarball":"https://registry.npmjs.org/unist-util-add/-/unist-util-add-1.1.0.tgz","fileCount":6,"integrity":"sha512-vicq5ky0KJGbkQBKYUJQcuunrTf1BHRXJfcLtJovbT8dr0uBbZI0o2OgfaEUzj75z0Cvij8K+QxJvZgO97e0zA==","signatures":[{"sig":"MEUCIQCOMJQeOvwZj7IV3XF7S7sE3q4ZIkreS7w+zoi9/ByAjwIgBE3R4hO1gU0KO6Zq85kcL+iV+1rvsZCyJamVLsWx6Zg=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":7819},"type":"module","_from":"file:unist-util-add-1.1.0.tgz","types":"./index.d.ts","engines":{"node":">=18"},"exports":"./index.js","scripts":{"build":"tsup","ci:publish":"pnpm build && pnpm publish --no-git-checks --tag latest","ci:version":"pnpm changeset version"},"_npmUser":{"name":"shlroland","email":"shlroland1995@gmail.com"},"_resolved":"/tmp/f4a56f06772126e21bc32dc76e525c94/unist-util-add-1.1.0.tgz","_integrity":"sha512-vicq5ky0KJGbkQBKYUJQcuunrTf1BHRXJfcLtJovbT8dr0uBbZI0o2OgfaEUzj75z0Cvij8K+QxJvZgO97e0zA==","repository":{"url":"git+https://github.com/shlroland/unist-util-add.git","type":"git"},"_npmVersion":"10.8.1","description":"unist utility to add extension","directories":{},"sideEffects":false,"_nodeVersion":"20.16.0","_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.2.3","unified":"^11.0.5","typescript":"^5.5.4","remark-parse":"^11.0.0","@changesets/cli":"^2.27.7","remark-stringify":"^11.0.0","@tsconfig/node-lts":"^20.1.3","micromark-util-types":"^2.0.0","mdast-util-to-markdown":"^2.1.0","mdast-util-from-markdown":"^2.0.1"},"_npmOperationalInternal":{"tmp":"tmp/unist-util-add_1.1.0_1723083828770_0.7607857483838696","host":"s3://npm-registry-packages"}},"1.2.0":{"name":"unist-util-add","version":"1.2.0","description":"unist utility to add extension","license":"MIT","engines":{"node":">=18"},"keywords":["unist","unist-util","util","utility","remark","retext","rehype","remark-plugin","unified","add","markdown","html","xml","tree","ast"],"repository":{"type":"git","url":"git+https://github.com/shlroland/unist-util-add.git"},"bugs":{"url":"https://github.com/shlroland/unist-util-add/issues"},"author":{"name":"shlroland","email":"shlroland1995@gmail.com"},"sideEffects":false,"type":"module","types":"./index.d.ts","exports":"./index.js","devDependencies":{"@changesets/cli":"^2.27.7","@tsconfig/node-lts":"^20.1.3","mdast-util-from-markdown":"^2.0.1","mdast-util-to-markdown":"^2.1.0","micromark-util-types":"^2.0.0","remark-parse":"^11.0.0","remark-stringify":"^11.0.0","tsup":"^8.2.3","typescript":"^5.5.4","unified":"^11.0.5"},"scripts":{"build":"tsup","ci:publish":"pnpm build && pnpm publish --no-git-checks --tag latest","ci:version":"pnpm changeset version"},"_id":"unist-util-add@1.2.0","homepage":"https://github.com/shlroland/unist-util-add#readme","_integrity":"sha512-2dEJEtrp+n7qu56D46q1tXRC0HQBk7QuQ2I8oLq/0IynTvbNI5vIu4H5otxhXXvUuISmfiRbXcEsuan+JTzZAg==","_resolved":"/tmp/04bbe0f1f36a2f1142eae346701ccdfa/unist-util-add-1.2.0.tgz","_from":"file:unist-util-add-1.2.0.tgz","_nodeVersion":"20.16.0","_npmVersion":"10.8.1","dist":{"integrity":"sha512-2dEJEtrp+n7qu56D46q1tXRC0HQBk7QuQ2I8oLq/0IynTvbNI5vIu4H5otxhXXvUuISmfiRbXcEsuan+JTzZAg==","shasum":"71715b94295310ee91719d46ad459731077f1902","tarball":"https://registry.npmjs.org/unist-util-add/-/unist-util-add-1.2.0.tgz","fileCount":6,"unpackedSize":7809,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIBfIFZx6Oq6uGvWS0XiEdIuja3tm4XIFLUZnKr3I+QIHAiEAsZJY/fttt0lCS4W2CYi2GdRlsAnz5Q7QYHrqZtY8N3c="}]},"_npmUser":{"name":"shlroland","email":"shlroland1995@gmail.com"},"directories":{},"maintainers":[{"name":"shlroland","email":"shlroland1995@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/unist-util-add_1.2.0_1723517090595_0.9562351711202812"},"_hasShrinkwrap":false}},"time":{"created":"2024-07-30T06:05:53.015Z","modified":"2024-08-13T02:44:50.929Z","1.0.1":"2024-07-30T06:05:53.145Z","1.0.2":"2024-08-08T01:55:57.920Z","1.1.0":"2024-08-08T02:23:48.929Z","1.2.0":"2024-08-13T02:44:50.733Z"},"bugs":{"url":"https://github.com/shlroland/unist-util-add/issues"},"author":{"name":"shlroland","email":"shlroland1995@gmail.com"},"license":"MIT","homepage":"https://github.com/shlroland/unist-util-add#readme","keywords":["unist","unist-util","util","utility","remark","retext","rehype","remark-plugin","unified","add","markdown","html","xml","tree","ast"],"repository":{"type":"git","url":"git+https://github.com/shlroland/unist-util-add.git"},"description":"unist utility to add extension","maintainers":[{"name":"shlroland","email":"shlroland1995@gmail.com"}],"readme":"> This document is created by ChatGPT.\n\n# unist-util-add\n\n`unist-util-add` is a utility for enhancing the [unist](https://github.com/syntax-tree/unist) ecosystem by providing an easy way to add extensions for `toMarkdown`, `micromark`, and `fromMarkdown` to unified data objects. It simplifies working with markdown processing libraries like [remark](https://github.com/remarkjs/remark) and [micromark](https://github.com/micromark/micromark) by offering a straightforward API to add plugins.\n\n## Installation\n\nYou can install `unist-util-add` using npm or yarn:\n\n```bash\nnpm install unist-util-add\n\nyarn add unist-util-add\n\npnpm add unist-util-add\n```\n\n## Usage\n\nHere's how you can use the `add` function provided by `unist-util-add` to augment your unist data with extensions:\n\n```js\nimport { add } from 'unist-util-add'\nimport type { Data } from 'unified'\nimport type { Options as ToMarkdownExtension } from 'mdast-util-to-markdown'\nimport type { Extension as MicromarkExtension } from 'micromark-util-types'\nimport type { Extension as FromMarkdownExtension } from 'mdast-util-from-markdown'\n\n// Example data object\nconst data: Data = {}\n\n// Example extensions\nconst toMarkdownExt: ToMarkdownExtension = {/* your toMarkdown extension */}\nconst micromarkExt: MicromarkExtension = {/* your micromark extension */}\nconst fromMarkdownExt: FromMarkdownExtension = {/* your fromMarkdown extension */}\n\n// Add extensions to data\nadd(data, 'toMarkdownExtensions', toMarkdownExt)\nadd(data, 'micromarkExtensions', micromarkExt)\nadd(data, 'fromMarkdownExtensions', fromMarkdownExt)\n```\n\n## API\n\n### `add(data: Data, field: string, value: Extension): void`\n\nThe `add` function allows you to add extensions to a unist data object.\n\n#### Parameters\n\n- **`data`**: The unist data object where the extension should be added.\n- **`field`**: A string representing the field name, which can be one of `'toMarkdownExtensions'`, `'micromarkExtensions'`, or `'fromMarkdownExtensions'`.\n- **`value`**: The extension to add, which can be a `ToMarkdownExtension`, `MicromarkExtension`, `FromMarkdownExtension`, or an array of `FromMarkdownExtension`.\n\n#### Supported Fields\n\n- **`toMarkdownExtensions`**: Extensions that modify the markdown-to-markdown transformation process.\n- **`micromarkExtensions`**: Extensions that modify the micromark parsing process.\n- **`fromMarkdownExtensions`**: Extensions that modify the markdown-to-unist tree transformation process.\n\n## How It Works\n\nThe `add` function checks if the provided `field` already exists in the `data` object. If it does, it pushes the new `value` onto the existing array. If the `field` does not exist, it creates a new array with the `value` as its first item.\n\nFor the `fromMarkdownExtensions`, if an array of extensions is provided, it appends the entire array to the existing list of extensions.\n\n## Why Use unist-util-add?\n\n- **Simplifies Plugin Management**: Easily manage extensions by providing a unified API for different types of extensions.\n- **Improves Readability**: Makes your codebase cleaner by reducing the boilerplate required to manage unist data fields.\n- **Flexible**: Supports adding multiple types of extensions in a consistent manner.\n\n## Contributing\n\nContributions are welcome! Please open an issue or submit a pull request on the [GitHub repository](https://github.com/yourusername/unist-util-add).\n\n## License\n\n`unist-util-add` is licensed under the MIT License. See the [LICENSE](LICENSE) file for more information.","readmeFilename":"README.md"}