mdast-comment-marker is a utility for parsing structured markers from comments within an mdast (Markdown Abstract Syntax Tree) document. It's currently at version 3.0.0 and follows a release cadence tied to major ecosystem updates like Node.js versions and mdast/MDX specifications. This package differentiates itself by providing a robust way to extract 'processing instructions' or metadata embedded in HTML or MDX comments, such as `<!-- lint disable -->` or `/* zone foo */`. It handles various parameter types including booleans, numbers, and strings, making it suitable for tools like remark-lint or mdast-zone, which utilize these markers for configuration or content manipulation. It is ESM-only and requires Node.js 16 or later.
npm install mdast-comment-markerVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to use `commentMarker` to parse different types of comment nodes (HTML and MDX) into structured marker objects, including handling various parameter types.
Ensure your Node.js environment is at version 16 or newer. Update Node.js if necessary.
Migrate your codebase to use ES Module `import` syntax. If in a CommonJS environment, consider a bundler or `import()` dynamic imports.
Update your MDX tooling to MDX 2 or later, and ensure your comment syntax adheres to MDX 2 conventions.
Update your code to check for `undefined` instead of `null` when evaluating the return value of `commentMarker`.
Run `npm install @types/mdast@latest` or `yarn add @types/mdast@latest` to update your type definitions.
Always use the public API paths as documented. Avoid importing from deep paths within the package unless explicitly exported.
Change `const { commentMarker } = require('mdast-comment-marker');` to `import { commentMarker } from 'mdast-comment-marker';`.Ensure you are using a named import: `import { commentMarker } from 'mdast-comment-marker';`No dependency data recorded yet.