micromark-util-decode-string is a low-level utility within the unifiedjs `micromark` ecosystem, specifically designed to process and decode character escapes and character references found in Markdown strings. It provides a single, focused function, `decodeString`, which is crucial for correctly interpreting content in areas like fenced code info strings, link destinations, labels, and titles according to the CommonMark specification. The current stable version for this utility is `2.0.1`, which is compatible with `micromark@3` and Node.js 16 and higher. While part of a larger monorepo, this package maintains its own versioning tied to its API stability. Its release cadence generally aligns with major `micromark` releases, often involving updates to drop support for unmaintained Node.js versions. As an ESM-only package, it adheres to modern JavaScript module standards. Its key differentiator is its precise adherence to Markdown specification for string decoding, making it an essential building block for custom `micromark` extensions or other Markdown processing tools.
npm install micromark-util-decode-stringVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates the `decodeString` function's capability to correctly interpret and resolve various character escapes and references found within Markdown strings, including HTML entities, numeric references, and backslash escapes. It covers common use cases for this low-level utility, which is fundamental to `micromark`'s parsing process.
Ensure your Node.js environment is updated to a currently maintained LTS version (e.g., Node.js 16+, 18+, 20+). Refer to the Node.js release schedule for support timelines.
Migrate your project to use ECMAScript Modules (`import` / `export`) or use dynamic `import()` if you need to load ESM from a CommonJS context. Ensure your `package.json` specifies `"type": "module"` if running in Node.js.
Change your import statement from `const { decodeString } = require('micromark-util-decode-string');` to `import { decodeString } from 'micromark-util-decode-string';`. Ensure your `package.json` is configured for ESM, or use a bundler.Verify that you are using a named import: `import { decodeString } from 'micromark-util-decode-string';`. Avoid default imports or incorrect destructuring.No dependency data recorded yet.