commonmark.json provides the complete suite of examples and test cases specified by the CommonMark standard, formatted as a readily consumable JSON array. Each entry in the array represents a single test case, including the input Markdown, the expected HTML output, and the section of the CommonMark specification it pertains to. This package is currently on stable version 0.31.0 and is updated periodically, typically when the official CommonMark specification is revised or regenerated, ensuring alignment with the latest standard. Its primary utility lies in serving as a robust dataset for developers building or validating Markdown parsers, allowing them to systematically test their implementations against the authoritative CommonMark examples rather than providing parsing functionality itself. It is designed to be a lightweight, data-only dependency.
npm install commonmark.jsonVerified import paths — ran on the pinned version, not inferred.
Loads and logs various CommonMark test cases, demonstrating how to access, filter, and iterate through the specification data for testing purposes.
Update your project to use ECMAScript Modules (`import`) or configure your build system/Node.js environment (`"type": "module"` in `package.json`) to handle ESM. For older CommonJS projects, dynamic `import()` might be an option.
Access the `commonmark` export as an array to iterate over the test cases (`commonmark.map(...)`, `commonmark[0].markdown`). Do not attempt to call `commonmark` as a function.
If bundle size is a critical concern, consider using dynamic `import()` to load the data only when strictly necessary. For most testing scenarios, direct import is acceptable.
Ensure your Node.js project or build configuration is set up for ESM. This typically involves adding `"type": "module"` to your `package.json` file or renaming your file to `.mjs`.
Ensure you are using a named import `import { commonmark } from 'commonmark.json'` and interacting with `commonmark` as an array (e.g., `commonmark.length`, `commonmark[0]`, `commonmark.forEach(...)`).No dependency data recorded yet.