unist-util-inspect is a utility for pretty-printing Abstract Syntax Trees (ASTs) that conform to the unist specification. It provides a human-readable, terser output format specifically tailored for unist nodes, making it easier to debug and understand tree structures compared to verbose JSON representations. The current stable version is 8.1.0, actively maintained with incremental updates. Major releases tend to align with Node.js LTS versions, requiring Node.js 16+ since version 8.0.0 and having transitioned to ESM-only in version 7.0.0. The library aims for a focused utility approach within the broader unified ecosystem, prioritizing clear and concise tree visualization and offering a custom format instead of generic object serialization.
npm install unist-util-inspectVerified import paths — ran on the pinned version, not inferred.
Demonstrates how to import and use the `inspect` function with a sample unist tree, showing both colored and uncolored output options.
Upgrade your Node.js environment to version 16 or a newer maintained release.
Ensure you are using `import` statements for all package imports. If your project is CommonJS, you may need to convert it to ESM or use a dynamic import `import('unist-util-inspect')`.Replace `inspectColor(tree)` with `inspect(tree, { color: true })` and `inspectNoColor(tree)` with `inspect(tree, { color: false })`.Review type declarations and ensure compatibility with your project's TypeScript configuration. Use `import type` for type-only imports where appropriate.
Change your import statement to `import { inspect } from 'unist-util-inspect'` and ensure your project is configured for ESM, or use dynamic import `import('unist-util-inspect')`.Update your Node.js environment to version 16 or newer. You can use `nvm` to manage Node.js versions easily.
Migrate to using the `color` option with the main `inspect` function: `inspect(tree, { color: true })` for colored output and `inspect(tree, { color: false })` for uncolored output.No dependency data recorded yet.