Registry / serialization / micromark-util-subtokenize

micromark-util-subtokenize

JSON →
library2.1.0jsnpmunverified

micromark-util-subtokenize is a low-level utility within the micromark ecosystem, designed to handle the internal process of tokenizing subtokens during markdown parsing. It provides the `subtokenize` function, which is crucial for extending micromark with custom parsing behaviors, particularly for nested content or specific markdown constructs. This package is currently at version 2.1.0 and is actively maintained as part of the unified collective's micromark project. Releases are typically coordinated with other micromark packages, following a frequent cadence in response to bug fixes, performance improvements, and new feature development within the core parser. Its primary differentiator is its specialized role in the micromark parsing pipeline, making it essential for advanced extension authors rather than direct end-user application.

npm install micromark-util-subtokenize
INSTALL
IMPORT
SIG · MICROMARK-UTIL-SUB
M
micromark-util-subtokenize
serializationjavascriptv2.1.0
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

subtokenize
import { subtokenize } from 'micromark-util-subtokenize'
const subtokenize = require('micromark-util-subtokenize')
This package is ESM-only and does not provide a CommonJS export. There is no default export, so curly braces are required.

This example demonstrates how `subtokenize` is typically used within a micromark resolver function to process nested token events.

import {subtokenize} from 'micromark-util-subtokenize' import type {Event, Resolver} from 'micromark-util-types' /** * A resolver function type from micromark-util-types. * For custom micromark extensions, resolvers process a list of events. * In this example, `subtokenize` is called on the events to parse subcontent. * * @type {Resolver} */ function resolveContent(events: Array<Event>): Array<Event> { // `subtokenize` processes the event stream to tokenize any nested content. // This makes sure that, for instance, definitions are parsed before // their references in paragraphs. subtokenize(events) return events }
Debug
Known issues
breakingThis package is ESM-only. Attempting to `require()` it in a CommonJS environment will result in an error.
fix
Ensure your project is configured for ESM (e.g., `"type": "module"` in `package.json`) or use dynamic `import()` if you must consume it from CommonJS.
affects: >=1.0.0
gotchaThis package is an internal utility for `micromark` and is generally not intended for direct use by consumers unless developing custom `micromark` extensions. Incorrect usage outside its intended context can lead to unexpected parsing behavior or errors.
fix
Consult the `micromark` extension development guide before using this utility directly. Most users should interact with `micromark` through its main API or higher-level utilities.
affects: >=1.0.0
breakingThe package is compatible with Node.js 16+ and `micromark@3`. Using it with older Node.js versions or incompatible `micromark` major versions may lead to runtime issues or unexpected behavior.
fix
Upgrade your Node.js environment to version 16 or newer and ensure your `micromark` dependency is version 3 or higher for full compatibility.
affects: <=1.x
gotchaVersion 2.0.3 included a refactor to omit a spread operator that was causing crashes. Earlier versions might exhibit stability issues related to this, particularly in specific environments or with complex markdown structures.
fix
Always use the latest patch release of `micromark-util-subtokenize` (currently 2.1.0) to ensure stability and benefit from bug fixes and performance improvements.
affects: <2.0.3
Errors
Common errors & fixes
Error [ERR_REQUIRE_ESM]: require() of ES Module .../node_modules/micromark-util-subtokenize/index.js from ... not supported.
Attempting to import an ESM-only package using CommonJS `require()`.
fix
Switch to `import` statements and ensure your project or file is treated as an ES module. For example, add `"type": "module"` to your `package.json` or use `.mjs` file extensions.
TypeError: subtokenize is not a function
This typically occurs if `micromark-util-subtokenize` was imported incorrectly, e.g., using `import subtokenize from '...'`, or if it's an environment issue.
fix
Ensure you are using named imports: `import { subtokenize } from 'micromark-util-subtokenize'`. This package has no default export.
Upgrade
Version history
2.1.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
2 hits · last 30 days
node
2
Resources
micromark-util-subtokenize — npm install micromark-util-subtokenize · libregistry