unist-util-add is a utility for the unified ecosystem that simplifies adding and managing extensions for toMarkdown, micromark, and fromMarkdown to data objects. Version 1.2.0, released in 2023, is the current stable version. It provides a single add() function that handles appending extensions to arrays, and it ships with TypeScript types. Unlike manually pushing to arrays, it handles initialization and validation. It requires Node.js >=18 and works with unified, mdast-util-to-markdown, micromark-util-types, and mdast-util-from-markdown.
npm install unist-util-addNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates adding toMarkdown and micromark extensions to a unified data object using the add function.
Upgrade Node.js to version 18 or later.
Ensure you are not relying on immutability; pass a new object if needed.
Use add(data, 'fromMarkdownExtensions', [ext1, ext2]) to add multiple at once for fromMarkdownExtensions.
Use import { add } from 'unist-util-add' or ensure your project is configured for ESM.Run npm install unist-util-add and ensure tsconfig.json includes 'node_modules/unist-util-add' or has 'moduleResolution': 'node'.
Ensure the extension object matches the expected type for the field: toMarkdownExtensions, micromarkExtensions, or fromMarkdownExtensions.
No dependency data recorded yet.