Skip to content

script-utils/linters/markdownlint-content

Lints markdown that is still in memory, with the repository’s own lint:md configuration.

lint:md can only answer for what is already on disk, which leaves every document composed during a run unchecked until the next gate — the release’s changelog being the one that costs a red main. This module is the same check one step earlier: the text is linted as the path it is destined for, and a caller that does not like the answer can stop before writing anything.

It goes through markdownlint-cli2 rather than markdownlint’s own string API, and that is the whole point of the module. The question a caller is asking is “would lint:md have failed on this text?”, and only the markdownlint-cli2 layer knows: it is what finds .markdownlint-cli2.mjs (through jiti, for the TypeScript configuration this workspace writes), merges the repository’s own overrides over the shared defaults, and loads the custom rules. Reaching for the string API means hand-rolling that resolution over five configuration file formats, which is a copy of markdownlint-cli2 that can only ever drift from it.

Interface Description
LintMarkdownContentParams Parameters for lintMarkdownContent.
Function Description
lintMarkdownContent Lints markdown content that is not on disk, with the configuration lint:md would have used for it.