{"library":"micromark-util-normalize-identifier","title":"Micromark Normalize Identifier Utility","description":"micromark-util-normalize-identifier is a dedicated utility package within the `micromark` ecosystem, designed to provide a robust algorithm for normalizing identifiers encountered in markdown, such as those in references and definitions. The current stable version is `2.0.1`, which is compatible with `micromark@3` and requires Node.js 16 or later. As part of the actively developed `micromark` monorepo, it follows a release cadence tied to the broader project's updates. Its key differentiator lies in its specific approach to canonicalizing identifiers: it collapses markdown whitespace, trims, and then performs a precise lower- and uppercase transformation. This two-step case conversion addresses edge cases with certain Unicode characters (e.g., U+03F4 vs. U+03B8 vs. U+0398) to ensure a truly canonical form, while also using uppercase last to prevent collisions with `Object.prototype` properties like `constructor`. It is an ESM-only package.","language":"javascript","status":"active","last_verified":"Sun Apr 19","install":{"commands":["npm install micromark-util-normalize-identifier"],"cli":null},"imports":["import { normalizeIdentifier } from 'micromark-util-normalize-identifier'"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import { normalizeIdentifier } from 'micromark-util-normalize-identifier';\n\n// Normalize identifiers with various whitespace and casing scenarios\nconsole.log(normalizeIdentifier(' a ')); // Expected: 'A'\nconsole.log(normalizeIdentifier('a\\t\\r\\nb')); // Expected: 'A B'\nconsole.log(normalizeIdentifier('ТОЛПОЙ')); // Expected: 'ТОЛПОЙ'\nconsole.log(normalizeIdentifier('Толпой')); // Expected: 'ТОЛПОЙ'\nconsole.log(normalizeIdentifier('First Last')); // Expected: 'FIRST LAST'\nconsole.log(normalizeIdentifier('  leading and trailing  ')); // Expected: 'LEADING AND TRAILING'\n","lang":"typescript","description":"Demonstrates how to import and use `normalizeIdentifier` with various input strings to show its whitespace collapsing, trimming, and casing behavior.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}