@redocly/recheck 0.4.1 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +359 -125
- package/dist/cli.js +59 -0
- package/dist/cli.js.map +1 -1
- package/dist/commands/baseline.d.ts +10 -0
- package/dist/commands/baseline.d.ts.map +1 -0
- package/dist/commands/baseline.js +59 -0
- package/dist/commands/baseline.js.map +1 -0
- package/dist/commands/readability.d.ts +10 -0
- package/dist/commands/readability.d.ts.map +1 -0
- package/dist/commands/readability.js +90 -0
- package/dist/commands/readability.js.map +1 -0
- package/dist/commands/run.d.ts.map +1 -1
- package/dist/commands/run.js +52 -8
- package/dist/commands/run.js.map +1 -1
- package/dist/config/load.d.ts +2 -0
- package/dist/config/load.d.ts.map +1 -1
- package/dist/config/load.js +3 -0
- package/dist/config/load.js.map +1 -1
- package/dist/config/schema.d.ts +4 -0
- package/dist/config/schema.d.ts.map +1 -1
- package/dist/config/schema.js +3 -0
- package/dist/config/schema.js.map +1 -1
- package/dist/config/validate.d.ts +2 -0
- package/dist/config/validate.d.ts.map +1 -1
- package/dist/config/validate.js +3 -1
- package/dist/config/validate.js.map +1 -1
- package/dist/core/baseline.d.ts +49 -0
- package/dist/core/baseline.d.ts.map +1 -0
- package/dist/core/baseline.js +0 -0
- package/dist/core/baseline.js.map +1 -0
- package/dist/core/prose-extract.d.ts +6 -0
- package/dist/core/prose-extract.d.ts.map +1 -0
- package/dist/core/prose-extract.js +79 -0
- package/dist/core/prose-extract.js.map +1 -0
- package/dist/core/readability.d.ts +17 -0
- package/dist/core/readability.d.ts.map +1 -0
- package/dist/core/readability.js +37 -0
- package/dist/core/readability.js.map +1 -0
- package/dist/core/runner.d.ts.map +1 -1
- package/dist/core/runner.js +1 -0
- package/dist/core/runner.js.map +1 -1
- package/dist/data/markdoc-realm-schema.d.ts.map +1 -1
- package/dist/data/markdoc-realm-schema.js +13 -0
- package/dist/data/markdoc-realm-schema.js.map +1 -1
- package/dist/reporter/formats/json.d.ts +5 -1
- package/dist/reporter/formats/json.d.ts.map +1 -1
- package/dist/reporter/formats/json.js +2 -1
- package/dist/reporter/formats/json.js.map +1 -1
- package/dist/reporter/index.js +2 -2
- package/dist/reporter/index.js.map +1 -1
- package/dist/reporter/summary.d.ts +1 -1
- package/dist/reporter/summary.d.ts.map +1 -1
- package/dist/reporter/summary.js +2 -1
- package/dist/reporter/summary.js.map +1 -1
- package/dist/rules/scope/metric.d.ts +2 -14
- package/dist/rules/scope/metric.d.ts.map +1 -1
- package/dist/rules/scope/metric.js +11 -187
- package/dist/rules/scope/metric.js.map +1 -1
- package/dist/rules/scope/semantic-line-breaks.d.ts.map +1 -1
- package/dist/rules/scope/semantic-line-breaks.js +58 -35
- package/dist/rules/scope/semantic-line-breaks.js.map +1 -1
- package/dist/rules/token/link-fragments.d.ts.map +1 -1
- package/dist/rules/token/link-fragments.js +221 -91
- package/dist/rules/token/link-fragments.js.map +1 -1
- package/dist/rules/types.d.ts +2 -0
- package/dist/rules/types.d.ts.map +1 -1
- package/dist/types/reporting.d.ts +9 -0
- package/dist/types/reporting.d.ts.map +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -133,7 +133,8 @@ git diff --name-only origin/main... | node dist/cli.js run . --changed-only
|
|
|
133
133
|
|
|
134
134
|
## Library API
|
|
135
135
|
|
|
136
|
-
The CLI is a thin wrapper around a public library API, published from `packages/recheck`'s `dist/index.js`.
|
|
136
|
+
The CLI is a thin wrapper around a public library API, published from `packages/recheck`'s `dist/index.js`.
|
|
137
|
+
This is the intended integration point for embedding Recheck in another tool (a build step, an editor extension, or another CLI like Redocly CLI's `lint`) rather than shelling out:
|
|
137
138
|
|
|
138
139
|
```ts
|
|
139
140
|
import { lintContent, lintFiles } from '@redocly/recheck';
|
|
@@ -162,17 +163,26 @@ const { problems: fileProblems, fixedFiles } = await lintFiles(['README.md'], co
|
|
|
162
163
|
|
|
163
164
|
Key exports:
|
|
164
165
|
|
|
165
|
-
- **`parseMarkdown(content, options?)`** — parses a markdown string into a micromark-based token tree, once.
|
|
166
|
+
- **`parseMarkdown(content, options?)`** — parses a markdown string into a micromark-based token tree, once.
|
|
167
|
+
Every other API in this list builds on this tree rather than re-parsing.
|
|
168
|
+
`options.markdoc` is a boolean here: `true` also tokenizes `{% ... %}` Markdoc tag spans into `markdocTag` tokens, and `false` or omitted gives you the same tree as passing no options at all.
|
|
169
|
+
The [object form](#markdoc-aware-linting-markdoc-true) (`{ schema, extend }`) is a config-file concept only — it resolves down to this boolean before any file is parsed, and `ParseOptions.markdoc` does not accept it.
|
|
166
170
|
- **`extractScopes(tree, content)`** — segments a parsed token tree into Vale-style scopes (`sentence`, `paragraph`, `heading`, `list-item`, `blockquote`, `table.cell`, etc.) for prose/style rules to run against.
|
|
167
|
-
- **`lintContent(content, config, opts?)`** — lints a single in-memory markdown string against a config; no disk access.
|
|
171
|
+
- **`lintContent(content, config, opts?)`** — lints a single in-memory markdown string against a config; no disk access.
|
|
172
|
+
Rules that need on-disk facts (e.g. `max-image-size`) require `opts.metadata` to be supplied by the caller.
|
|
168
173
|
- **`lintFiles(paths, config, opts?)`** — lints markdown files from disk; pass `{ fix: true }` to also write auto-fixes back, looping lint → fix → re-lint until the file converges.
|
|
169
174
|
Files that can't be read are skipped (with a console warning) and reported in the returned `skippedFiles` (`{ path, reason }[]`), so callers can detect incomplete coverage programmatically.
|
|
170
175
|
`opts.root` sets the lint root that image-metadata loading is confined to (default `process.cwd()`) — image refs resolving outside it are treated as missing without touching the disk.
|
|
171
176
|
`opts.maxProblems` caps the total problems collected: once a file's lint pushes the run to the cap, later files aren't linted at all and the returned `truncated` flag is set.
|
|
172
|
-
- **`runRules(files, rules)`** — the lower-level engine entry point for callers that already have a `NormalizedRule[]` (e.g. from `loadConfig`) and want to run against an explicit in-memory file list, bypassing `lintFiles`'s own config loading/validation.
|
|
173
|
-
|
|
174
|
-
- **`
|
|
175
|
-
|
|
177
|
+
- **`runRules(files, rules)`** — the lower-level engine entry point for callers that already have a `NormalizedRule[]` (e.g. from `loadConfig`) and want to run against an explicit in-memory file list, bypassing `lintFiles`'s own config loading/validation.
|
|
178
|
+
Under `{ fix: true }` its `RunResult` separates the fixes that genuinely landed (`fixes`) from proposals dropped by overlap resolution (`skippedFixes`).
|
|
179
|
+
- **`applyFixesToContent(content, fixes)`** — applies `Fix` edits to a string, preserving the file's own line endings (CRLF files stay CRLF).
|
|
180
|
+
Returns `{ content, applied, skipped }`: every input fix is classified as genuinely applied or skipped (overlapping edits, out-of-range lines), so callers can report what actually changed rather than every proposal.
|
|
181
|
+
- **`computeTextStatistics(prose)`** — computes word/sentence/syllable/character/complex-word counts for a plain prose string (not markdown — extract prose from a scope first).
|
|
182
|
+
Sentence counting reuses `splitSentences` internally, so it agrees with the rest of the engine on sentence boundaries.
|
|
183
|
+
Tokenization is ASCII-only by design (accented or non-Latin letters don't count as word characters), so readability scores are meaningful for English prose.
|
|
184
|
+
- **`computeReadability(formula, stats)`** — scores a `TextStatistics` object with one of six standard readability formulas: `flesch-reading-ease`, `flesch-kincaid-grade`, `gunning-fog`, `smog`, `coleman-liau`, `automated-readability`.
|
|
185
|
+
Returns `0` (rather than `NaN`/`Infinity`) when `stats.words` or `stats.sentences` is `0`.
|
|
176
186
|
- **`TECHNICAL_PROPER_NOUNS`** — the [built-in technical proper-noun vocabulary](#built-in-technical-proper-noun-vocabulary) `capitalization`/`spelling` consume by default; re-exported so you can read it or build your own tooling around the same list.
|
|
177
187
|
|
|
178
188
|
This is exactly the surface a host tool needs to add both markdown-structure linting and prose/style linting to content it already has in memory — for example, linting the markdown inside an OpenAPI `description` field without writing it to a temp file first.
|
|
@@ -246,6 +256,57 @@ recheck/ul-style-dash:
|
|
|
246
256
|
style: dash
|
|
247
257
|
```
|
|
248
258
|
|
|
259
|
+
## Baseline
|
|
260
|
+
|
|
261
|
+
A baseline lets a team adopt recheck on a large document set with no cleanup project first: record the findings that exist today, then fail only on new ones.
|
|
262
|
+
|
|
263
|
+
```bash
|
|
264
|
+
recheck baseline # writes recheck-baseline.yaml next to your config
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
Activate it with one config line:
|
|
268
|
+
|
|
269
|
+
```yaml
|
|
270
|
+
baseline: ./recheck-baseline.yaml
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
The file stores one count per file per rule, errors only, sorted for stable diffs:
|
|
274
|
+
|
|
275
|
+
```yaml
|
|
276
|
+
version: 1
|
|
277
|
+
files:
|
|
278
|
+
docs/index.md:
|
|
279
|
+
recheck/semantic-line-breaks: 3
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
With the baseline active, `recheck run`:
|
|
283
|
+
|
|
284
|
+
- **suppresses** findings whose (file, rule) count matches the baseline, and reports how many matched;
|
|
285
|
+
- **fails** when a count rises — the group's findings are printed with `(baseline 3, found 5)` context;
|
|
286
|
+
- **fails** when a count falls, because the baseline is stale — the message says to run `recheck baseline` and commit the result. Counts only step down, so the file equals reality at every green commit.
|
|
287
|
+
|
|
288
|
+
Warnings are never baselined; they do not affect exit codes.
|
|
289
|
+
Partial runs (`--rule`, `--changed-only`, a narrower path) compare only the files they scanned and the rules they ran, so they never false-alarm about what they did not see.
|
|
290
|
+
Line numbers are deliberately not stored: counts survive unrelated edits, and a baseline diff in review reads as "this PR pays down 4 findings."
|
|
291
|
+
A renamed file is a new path with no budget, so its pre-existing findings report as new until you regenerate — the baseline diff then shows the counts moving from the old path to the new one.
|
|
292
|
+
|
|
293
|
+
## Readability
|
|
294
|
+
|
|
295
|
+
`recheck readability` reports scores per file: Flesch reading ease, Flesch-Kincaid grade, Automated Readability Index (ARI), words, and sentences, plus medians.
|
|
296
|
+
ARI is a grade level computed from exact character counts, with no syllable heuristic, which makes it steadier on technical vocabulary.
|
|
297
|
+
It is score-shaped, not rule-shaped: it never gates and always exits 0 when it ran.
|
|
298
|
+
To gate on a bound, use the `metric` assertion — both read the same prose and the same formulas, so they can never disagree.
|
|
299
|
+
|
|
300
|
+
```bash
|
|
301
|
+
recheck readability docs
|
|
302
|
+
recheck readability docs --output json
|
|
303
|
+
recheck readability docs --changed-only < changed.txt # score only listed files
|
|
304
|
+
```
|
|
305
|
+
|
|
306
|
+
The score reads flowing prose the way standard readability tools do: headings, code, and Markdoc tags are excluded, and every block ends a sentence.
|
|
307
|
+
A file with no prose reports `—` (null in JSON) rather than a fake zero.
|
|
308
|
+
In CI, run it twice — once on the PR head and once on the merge-base worktree — and join on file to show each changed page's score change.
|
|
309
|
+
|
|
249
310
|
## Exceptions
|
|
250
311
|
|
|
251
312
|
Rules can be configured with exceptions to skip specific files or lines:
|
|
@@ -307,9 +368,11 @@ recheck/no-trailing-spaces:
|
|
|
307
368
|
## Inline Directives
|
|
308
369
|
|
|
309
370
|
Beyond config-level `exceptions`, individual Markdown files can silence rules
|
|
310
|
-
inline with HTML comments — the same mechanism ESLint/Vale users expect.
|
|
371
|
+
inline with HTML comments — the same mechanism ESLint/Vale users expect.
|
|
372
|
+
A
|
|
311
373
|
directive names rules by their **short name** (`oxford-comma`) or **full
|
|
312
|
-
name** (`recheck/oxford-comma`) — both work.
|
|
374
|
+
name** (`recheck/oxford-comma`) — both work.
|
|
375
|
+
A directive is inert inside a
|
|
313
376
|
fenced code block (it has to be real, parsed HTML, not just matching text).
|
|
314
377
|
|
|
315
378
|
```markdown
|
|
@@ -342,7 +405,8 @@ The five forms:
|
|
|
342
405
|
|
|
343
406
|
Rule naming: list one or more rules space-separated, by short name
|
|
344
407
|
(`oxford-comma`) or full name (`recheck/oxford-comma`) — both work on every
|
|
345
|
-
form that accepts names; omitting names targets every rule.
|
|
408
|
+
form that accepts names; omitting names targets every rule.
|
|
409
|
+
Naming a rule
|
|
346
410
|
that isn't configured produces a warning (`recheck-directive`, severity
|
|
347
411
|
`warn`) pointing at the directive's line — useful for catching a typo in
|
|
348
412
|
the disabled rule name — but disables nothing.
|
|
@@ -355,7 +419,9 @@ Rules are defined using `assertions` that specify their behavior:
|
|
|
355
419
|
|
|
356
420
|
#### Swap Assertions (`swap`)
|
|
357
421
|
Text replacement with configurable options.
|
|
358
|
-
**Fixable**: each match is replaced with its pair's value, with the matched text's own casing applied to the replacement -- an all-lowercase match inserts the replacement as configured, a Capitalized match capitalizes just the replacement's first word, and an ALL-CAPS match (2+ letters) uppercases the whole replacement; any other (mixed-case) casing is left as configured, since it carries no reliable intent to infer.
|
|
422
|
+
**Fixable**: each match is replaced with its pair's value, with the matched text's own casing applied to the replacement -- an all-lowercase match inserts the replacement as configured, a Capitalized match capitalizes just the replacement's first word, and an ALL-CAPS match (2+ letters) uppercases the whole replacement; any other (mixed-case) casing is left as configured, since it carries no reliable intent to infer.
|
|
423
|
+
This matters most with `ignoreCase: true`: without it, a sentence-initial `'Behaviour'` would be fixed to literal `'behavior'`, silently lowercasing the start of the sentence -- with it, it fixes to `'Behavior'`.
|
|
424
|
+
(With `keysAreRegex: true`, casing is inferred from the MATCHED text, not the regex key, so this applies uniformly to regex keys too.)
|
|
359
425
|
When two pairs' matches overlap in the source (a compound key together with the shorter keys it contains), the longest match wins and is reported and fixed as one span.
|
|
360
426
|
|
|
361
427
|
```yaml
|
|
@@ -397,7 +463,8 @@ assertions:
|
|
|
397
463
|
| `includeCode` | `boolean` | No | Matches inside inline code spans (`` `like this` ``) are skipped by default, so a token like `master` doesn't fire inside `` `git checkout master` ``. Set `true` to scan inline code too. Default `false`. |
|
|
398
464
|
|
|
399
465
|
#### Occurrence Assertions (`occurrence`)
|
|
400
|
-
Vale-parity `occurrence` check: counts regex matches within each scoped segment and flags the segment when the count falls outside `[min, max]`.
|
|
466
|
+
Vale-parity `occurrence` check: counts regex matches within each scoped segment and flags the segment when the count falls outside `[min, max]`.
|
|
467
|
+
`min: 1` with no `max` acts as an existence check — it flags a segment where the pattern is missing entirely.
|
|
401
468
|
|
|
402
469
|
```yaml
|
|
403
470
|
assertions:
|
|
@@ -413,9 +480,11 @@ assertions:
|
|
|
413
480
|
| `max` | `number` | At least one of `min`/`max` | Maximum allowed match count; more matches is a violation. |
|
|
414
481
|
| `ignoreCase` | `boolean` | No | Matches `pattern` case-insensitively. Default `false`. |
|
|
415
482
|
|
|
416
|
-
Omitting both `min` and `max` is a validation error — an occurrence assertion with no bound can never report anything.
|
|
483
|
+
Omitting both `min` and `max` is a validation error — an occurrence assertion with no bound can never report anything.
|
|
484
|
+
An unknown option key under `occurrence` is likewise a validation error.
|
|
417
485
|
|
|
418
|
-
The rule's `message` gets two positional `%s` substitutions, in this order: **1st = the actual match count, 2nd = the bound that was violated** (`min` or `max`, whichever applied), e.g. `'Too many sentences (%s found, max %s).'` → `'Too many sentences (4 found, max 3).'`.
|
|
486
|
+
The rule's `message` gets two positional `%s` substitutions, in this order: **1st = the actual match count, 2nd = the bound that was violated** (`min` or `max`, whichever applied), e.g. `'Too many sentences (%s found, max %s).'` → `'Too many sentences (4 found, max 3).'`.
|
|
487
|
+
Not fixable (detection-only): a count-based violation has no single match position to anchor an edit to.
|
|
419
488
|
|
|
420
489
|
#### Repetition Assertions (`repetition`)
|
|
421
490
|
Vale-parity `repetition` check: flags an adjacent repeated word — two tokens matching `pattern`, separated only by whitespace (which may include a single hard-wrap newline), so `'the theory'` is not flagged (different words) but `'the the'` and a hard-wrapped `'the\nthe rest'` are. **Fixable**: collapses the pair back to one occurrence, keeping the FIRST token's casing/text (so `'The the'` fixes to `'The'`, not `'the'`).
|
|
@@ -433,10 +502,12 @@ assertions:
|
|
|
433
502
|
|
|
434
503
|
An unknown option key under `repetition` is a validation error, as is a non-string `pattern` or a non-boolean `ignoreCase`; both options are optional, so an empty `repetition: {}` is valid.
|
|
435
504
|
|
|
436
|
-
The rule's `message` gets one positional `%s` substitution: the repeated word itself, e.g. `'Repeated word "%s".'` → `'Repeated word "the".'`.
|
|
505
|
+
The rule's `message` gets one positional `%s` substitution: the repeated word itself, e.g. `'Repeated word "%s".'` → `'Repeated word "the".'`.
|
|
506
|
+
Fix idempotency holds under repeated `--fix` passes: `'the the the'` converges to `'the'`.
|
|
437
507
|
|
|
438
508
|
#### Consistency Assertions (`consistency`)
|
|
439
|
-
Vale-parity `consistency` check: each `either` entry declares one alternative group — the key and the value are the two variants (both matched as literals with word boundaries, like `swap` keys).
|
|
509
|
+
Vale-parity `consistency` check: each `either` entry declares one alternative group — the key and the value are the two variants (both matched as literals with word boundaries, like `swap` keys).
|
|
510
|
+
Whichever variant appears **first in the file (by source order)** wins file-wide; every later occurrence of the other variant is flagged. **Fixable**: each later occurrence is replaced with the winning variant **literally as written in `either`** — unlike `swap`, the losing match's own casing is not preserved here (with `ignoreCase: true`, a later `'Behaviour'` in a `behavior`-first document fixes to `'behavior'`).
|
|
440
511
|
|
|
441
512
|
```yaml
|
|
442
513
|
assertions:
|
|
@@ -451,14 +522,16 @@ assertions:
|
|
|
451
522
|
| `either` | `object` | Yes | Map of variant pairs; key and value are the two alternatives of one group. Each pair gets its own independent first-seen winner. Must be non-empty. |
|
|
452
523
|
| `ignoreCase` | `boolean` | No | Matches variants case-insensitively (so `'Behaviour'` counts as an occurrence of `behaviour`). Default `false`. |
|
|
453
524
|
|
|
454
|
-
Omitting `either`, leaving it empty, or giving it non-string or empty-string keys or values is a validation error — a consistency assertion with no variant pairs can never report anything, and an empty-string key would otherwise reach the scan loop as a zero-width regex that never terminates.
|
|
525
|
+
Omitting `either`, leaving it empty, or giving it non-string or empty-string keys or values is a validation error — a consistency assertion with no variant pairs can never report anything, and an empty-string key would otherwise reach the scan loop as a zero-width regex that never terminates.
|
|
526
|
+
An unknown option key under `consistency` is likewise a validation error.
|
|
455
527
|
|
|
456
528
|
Matches from overlapping scopes (e.g. `scope: [paragraph, sentence]`, where every sentence segment sits inside its paragraph segment) are deduplicated by source position before the winner is decided, so each occurrence is counted — and fixed — exactly once.
|
|
457
529
|
|
|
458
530
|
The rule's `message` gets two positional `%s` substitutions, in this order: **1st = the offending (later) match, 2nd = the first-seen winner**, e.g. `'Inconsistent spelling: "%s" conflicts with first-seen "%s".'` → `'Inconsistent spelling: "behaviour" conflicts with first-seen "behavior".'`.
|
|
459
531
|
|
|
460
532
|
#### Conditional Assertions (`conditional`)
|
|
461
|
-
Vale-parity `conditional` check: if `first` (a regex pattern) matches anywhere within the rule's scoped segments, `second` (a regex pattern) must exist **somewhere in the whole file** — checked against the full raw file content, not just the rule's own scope, so a `second` match sitting inside a code block still satisfies a rule scoped to `paragraph`.
|
|
533
|
+
Vale-parity `conditional` check: if `first` (a regex pattern) matches anywhere within the rule's scoped segments, `second` (a regex pattern) must exist **somewhere in the whole file** — checked against the full raw file content, not just the rule's own scope, so a `second` match sitting inside a code block still satisfies a rule scoped to `paragraph`.
|
|
534
|
+
When `second` is absent file-wide, every `first` match becomes its own problem, at its exact source position. **Detection-only** (not fixable) — there is no single well-defined edit that would "introduce" `second`.
|
|
462
535
|
|
|
463
536
|
```yaml
|
|
464
537
|
assertions:
|
|
@@ -473,14 +546,16 @@ assertions:
|
|
|
473
546
|
| `second` | `string` | Yes | Regex; must match somewhere in the whole file content once `first` has matched. Non-empty. |
|
|
474
547
|
| `ignoreCase` | `boolean` | No | Matches both `first` and `second` case-insensitively. Default `false`. |
|
|
475
548
|
|
|
476
|
-
Unlike `swap`/`consistency`'s escaped-literal variants, `first` and `second` are raw user regex patterns (like `pattern`'s `tokens`).
|
|
549
|
+
Unlike `swap`/`consistency`'s escaped-literal variants, `first` and `second` are raw user regex patterns (like `pattern`'s `tokens`).
|
|
550
|
+
Missing, empty, or non-string `first`/`second` is a validation error, as is an unknown option key or a non-boolean `ignoreCase` — but `first`/`second` are **not** validated as compilable regexes at config-load time; an invalid regex in either one silently produces zero problems at runtime instead (same convention as `pattern`).
|
|
477
551
|
|
|
478
552
|
Matches from overlapping scopes (e.g. `scope: [paragraph, sentence]`) are deduplicated by source position, so each occurrence of `first` is reported exactly once.
|
|
479
553
|
|
|
480
554
|
The rule's `message` gets two positional `%s` substitutions, in this order: **1st = the offending `first` match, 2nd = the `second` pattern that was never introduced**, e.g. `'"%s" appears but "%s" was never introduced.'` → `'"TODO" appears but "DONE" was never introduced.'`.
|
|
481
555
|
|
|
482
556
|
#### Capitalization Assertions (`capitalization`)
|
|
483
|
-
Vale-parity `capitalization` check: flags (and — for four of its `match` values — fixes) a scoped segment whose text doesn't already match the required casing.
|
|
557
|
+
Vale-parity `capitalization` check: flags (and — for four of its `match` values — fixes) a scoped segment whose text doesn't already match the required casing.
|
|
558
|
+
`match` is one of `$title`, `$sentence`, `$lower`, `$upper`, or else a **custom regex** the whole segment text must satisfy.
|
|
484
559
|
|
|
485
560
|
```yaml
|
|
486
561
|
assertions:
|
|
@@ -503,24 +578,31 @@ Unknown option keys, a missing/empty `match`, an invalid `style`, a non-string-a
|
|
|
503
578
|
|
|
504
579
|
**`$title`** — AP or Chicago title case, implemented in `rules/scope/title-case.ts`'s `apTitleCase`/`chicagoTitleCase`:
|
|
505
580
|
- The first and last word are **always** capitalized, regardless of any stopword list.
|
|
506
|
-
- A hyphenated compound (e.g. `well-known`) runs **each hyphen part** through the same stopword test a standalone word gets for the active style — `well-known` → `Well-Known`, but `editor-in-chief` → `Editor-in-Chief` (`in` is a stopword in both styles).
|
|
581
|
+
- A hyphenated compound (e.g. `well-known`) runs **each hyphen part** through the same stopword test a standalone word gets for the active style — `well-known` → `Well-Known`, but `editor-in-chief` → `Editor-in-Chief` (`in` is a stopword in both styles).
|
|
582
|
+
The compound's first part always capitalizes when the compound opens the title, and its last part always capitalizes when the compound closes the title — e.g. `the new state-of-the-art` → `The New State-of-the-Art` (changed from the original simplification by product decision during execution, 2026-07-27).
|
|
507
583
|
- A word already in ALL-CAPS (2+ letters, e.g. an acronym like `API`) is left exactly as written.
|
|
508
584
|
- **AP** (default) lowercases articles (`a`, `an`, `the`), coordinating conjunctions (`and`, `but`, `or`, `nor`, `for`, `so`, `yet`), and prepositions of **3 letters or fewer** (`at`, `by`, `in`, `of`, `off`, `on`, `out`, `to`, `up`, `via`).
|
|
509
585
|
- **Chicago** lowercases the same articles/conjunctions, plus **every** preposition regardless of length (the short ones above, plus `about`, `above`, `across`, `after`, `against`, `along`, `among`, `around`, `before`, `behind`, `below`, `between`, `during`, `through`, `toward`, `under`, `until`, `with`, `within`, `without`) — e.g. Chicago lowercases `'...walking through the park'` → `'...walking through the Park'`, where AP capitalizes `Through`.
|
|
510
586
|
|
|
511
587
|
**`$sentence`** — only the first word is capitalized; every other word is lowercased unless it's an `exceptions` entry (as-written) or already ALL-CAPS (left alone).
|
|
512
588
|
|
|
513
|
-
**Word position counts a phrase exception as one word.** A *phrase* exception (one containing whitespace or a dot, like `Node.js` or `VS Code` — see the phrase-matching note above) is a single atomic token in the word sequence the `$`-styles case: it's emitted in its exact as-written form, and it **occupies a position**, so it never changes which word counts as first or last.
|
|
589
|
+
**Word position counts a phrase exception as one word.** A *phrase* exception (one containing whitespace or a dot, like `Node.js` or `VS Code` — see the phrase-matching note above) is a single atomic token in the word sequence the `$`-styles case: it's emitted in its exact as-written form, and it **occupies a position**, so it never changes which word counts as first or last.
|
|
590
|
+
With `exceptions: [VS Code]`, the already-correctly-cased heading `## VS Code actions for teams` produces no finding under `$sentence` (`actions` is the second word, not the first), and `## a guide to Node.js` becomes `## A Guide to Node.js` under `$title`/AP (`Node.js` is the last word, so `to` is a mid-title stopword and stays lowercase).
|
|
591
|
+
Single-word exceptions (e.g. `GitHub`) behave as they always have — resolved by lookup rather than position.
|
|
514
592
|
|
|
515
|
-
This used to be a bug, tracked as [Redocly/redocly#25610](https://github.com/Redocly/redocly/issues/25610) and fixed since: phrase exceptions were previously *masked out* of the text before word position was computed, which made a leading phrase promote the next word to sentence-initial under `$sentence` (`## VS Code actions for teams` was flagged, and under `fix: true` rewritten to `## VS Code Actions for teams`) and made a trailing phrase promote the preceding word to last-word position under `$title` (`a guide to Node.js` → `A Guide To Node.js`).
|
|
593
|
+
This used to be a bug, tracked as [Redocly/redocly#25610](https://github.com/Redocly/redocly/issues/25610) and fixed since: phrase exceptions were previously *masked out* of the text before word position was computed, which made a leading phrase promote the next word to sentence-initial under `$sentence` (`## VS Code actions for teams` was flagged, and under `fix: true` rewritten to `## VS Code Actions for teams`) and made a trailing phrase promote the preceding word to last-word position under `$title` (`a guide to Node.js` → `A Guide To Node.js`).
|
|
594
|
+
If you had worked around it by rephrasing headings or by swapping in a custom regex `match`, neither is needed any more.
|
|
595
|
+
See `rules/scope/title-case.ts`'s `recaseWords` for the tokenization that replaced the masking.
|
|
516
596
|
|
|
517
597
|
**`$lower`** / **`$upper`** — the whole segment must be all-lowercase / all-uppercase respectively; no exceptions/ALL-CAPS carve-out (unconditional, matching Vale's own `$lower`/`$upper`).
|
|
518
598
|
|
|
519
|
-
**Custom regex** — the whole segment text must satisfy the pattern. **Detection-only**: unlike the four `$`-styles, a failing regex is flagged but never auto-fixed, even though the rule itself is registered fixable.
|
|
599
|
+
**Custom regex** — the whole segment text must satisfy the pattern. **Detection-only**: unlike the four `$`-styles, a failing regex is flagged but never auto-fixed, even though the rule itself is registered fixable.
|
|
600
|
+
Like `pattern`'s `tokens`, an invalid regex is caught and silently produces zero problems rather than crashing the run.
|
|
520
601
|
|
|
521
602
|
**Inline code is frozen.** A backtick-delimited span in the segment text (e.g. a heading like `'the `configFile` option'`) is treated like an exception: its content is never flagged or rewritten by any of the four `$`-styles, even if it would otherwise land on the first/last word.
|
|
522
603
|
|
|
523
|
-
**Fixable** for `$title`/`$sentence`/`$lower`/`$upper` only, one segment-wide edit per flagged segment.
|
|
604
|
+
**Fixable** for `$title`/`$sentence`/`$lower`/`$upper` only, one segment-wide edit per flagged segment.
|
|
605
|
+
A **multi-line** segment (e.g. a soft-wrapped paragraph) is skipped entirely under these four styles — neither a problem nor a fix — since a `Fix` can only rewrite a single line; a custom regex `match` has no such restriction and still checks (and reports) multi-line segments, since it never produces a fix regardless of segment span.
|
|
524
606
|
|
|
525
607
|
The rule's `message` gets two positional `%s` substitutions, in this order: **1st = the segment's own text (first line only), 2nd = the `match` value itself** (e.g. `'$title'`, or the literal regex source for custom-regex mode), e.g. `'"%s" should use %s capitalization.'` → `'"the great escape" should use $title capitalization.'`.
|
|
526
608
|
|
|
@@ -542,15 +624,25 @@ assertions:
|
|
|
542
624
|
|
|
543
625
|
Omitting both `min` and `max`, an unrecognized `formula`, or an unknown option key are all validation errors — a metric assertion with no bound can never report anything, and an unrecognized formula would otherwise reach the scoring engine's own exhaustive-switch failure at lint time instead of at config validation.
|
|
544
626
|
|
|
545
|
-
**Always summary-scoped.** Unlike every other assertion above, `metric` does not honor a configurable `scope:` — readability is a property of the WHOLE document's prose, not something a selector could sensibly narrow (a readability score isn't meaningful for one paragraph in isolation the way an `occurrence` count is).
|
|
627
|
+
**Always summary-scoped.** Unlike every other assertion above, `metric` does not honor a configurable `scope:` — readability is a property of the WHOLE document's prose, not something a selector could sensibly narrow (a readability score isn't meaningful for one paragraph in isolation the way an `occurrence` count is).
|
|
628
|
+
Config validation forces every `metric` rule to `scope: summary`.
|
|
629
|
+
Omit `scope` on a `metric` rule (or write `scope: summary` explicitly); configuring any other scope prints a warning (`metric is always summary-scoped; ignoring configured scope ...`) and applies `summary` behavior anyway.
|
|
630
|
+
Text from overlapping segments (e.g. a list nested inside a blockquote) is deduplicated by source position, same as `consistency`/`conditional` above.
|
|
546
631
|
|
|
547
|
-
**What the score reads.** The metric scores flowing prose the way standard readability tools do: `paragraph`, `list-item`, `blockquote`, `table.cell`, and `table.header` text counts; **headings are excluded**, and `code`, `frontmatter`, `html`, `comment`, `alt`, and `link` content is never counted.
|
|
632
|
+
**What the score reads.** The metric scores flowing prose the way standard readability tools do: `paragraph`, `list-item`, `blockquote`, `table.cell`, and `table.header` text counts; **headings are excluded**, and `code`, `frontmatter`, `html`, `comment`, `alt`, and `link` content is never counted.
|
|
633
|
+
Every block that does not end in terminal punctuation ends a sentence — an unpunctuated list item is one sentence, not a fragment fused into its neighbors.
|
|
634
|
+
Without that rule, a run of bullets scored as one enormous "sentence" and pushed Flesch reading ease far below zero; with it, scores line up with other readability tools within syllable-heuristic differences.
|
|
548
635
|
|
|
549
|
-
**Non-prose stripping.** Before scoring, each segment's text also has Markdoc tag-marker spans (`{% tag attr="x" %}`, `{% /tag %}`, and the `{%- ... -%}` trim variant) and backtick-delimited inline code spans stripped out — neither is readable prose, and both otherwise skew word/syllable counts.
|
|
636
|
+
**Non-prose stripping.** Before scoring, each segment's text also has Markdoc tag-marker spans (`{% tag attr="x" %}`, `{% /tag %}`, and the `{%- ... -%}` trim variant) and backtick-delimited inline code spans stripped out — neither is readable prose, and both otherwise skew word/syllable counts.
|
|
637
|
+
Prose between two block-tag markers still counts (only the marker spans themselves are removed); a paragraph consisting only of tag markers contributes nothing.
|
|
638
|
+
Multi-backtick delimiters (`` ``like this`` ``) are handled conservatively as a simple open-run/close-run pair match, not a full CommonMark-correct implementation.
|
|
550
639
|
|
|
551
|
-
**Detection-only** (not fixable) — there is no single edit that would "fix" a readability score.
|
|
640
|
+
**Detection-only** (not fixable) — there is no single edit that would "fix" a readability score.
|
|
641
|
+
Reports at most **one** problem per file, always at `line: 1, column: 1` (there is no single source position a whole-document score belongs to) — never divided by zero: a file with no prose at all (empty, or only code/frontmatter) is never flagged, regardless of `min`/`max`.
|
|
552
642
|
|
|
553
|
-
The rule's `message` is substituted against up to **four** values, in this order: **1st = the formula name, 2nd = the computed score, 3rd = `min` (or `-∞` if unset), 4th = `max` (or `∞` if unset)** — e.g. the internal fallback `'Readability (%s) is %s; expected between %s and %s.'` → `'Readability (flesch-reading-ease) is 42.1; expected between 60 and ∞.'`.
|
|
643
|
+
The rule's `message` is substituted against up to **four** values, in this order: **1st = the formula name, 2nd = the computed score, 3rd = `min` (or `-∞` if unset), 4th = `max` (or `∞` if unset)** — e.g. the internal fallback `'Readability (%s) is %s; expected between %s and %s.'` → `'Readability (flesch-reading-ease) is 42.1; expected between 60 and ∞.'`.
|
|
644
|
+
The `message` validation cap is per-assertion: a `metric` rule's `message` may use up to **4** `%s` placeholders (one per value above), while every other assertion stays capped at 2.
|
|
645
|
+
Fewer placeholders than values is fine — substitution is positional, so a 2-slot message receives the leading values (formula name, then score).
|
|
554
646
|
|
|
555
647
|
<!-- recheck-disable-next-line no-gerund-headings -->
|
|
556
648
|
#### Spelling Assertions (`spelling`)
|
|
@@ -570,9 +662,11 @@ assertions:
|
|
|
570
662
|
| `ignore` | `string[]` | No | Regex patterns; a token matching ANY of them is never flagged, e.g. `['\bAcme\w*']` to allow every inflection of a brand name. An invalid pattern is silently ignored, same convention as `pattern`'s `tokens`. |
|
|
571
663
|
| `builtinVocabulary` | `boolean` | No | Default `true`. Whether [`TECHNICAL_PROPER_NOUNS`](#built-in-technical-proper-noun-vocabulary) is unioned into the accepted-word set alongside `vocab`. A multi-token entry (`Node.js`, `VS Code`) is split into its individual words, each accepted separately — correct for a per-word spell check, unlike `capitalization`'s whole-phrase matching. Set `false` for a closed vocabulary of only this rule's own `vocab`. |
|
|
572
664
|
|
|
573
|
-
All options are optional — an empty `spelling: {}` is valid (default dictionary, no extra vocabulary, no ignore patterns, built-in vocabulary on).
|
|
665
|
+
All options are optional — an empty `spelling: {}` is valid (default dictionary, no extra vocabulary, no ignore patterns, built-in vocabulary on).
|
|
666
|
+
Unknown option keys, a non-string/empty-string `dictionary`, a `vocab`/`ignore` entry that isn't a non-empty string, or a non-boolean `builtinVocabulary` are all validation errors.
|
|
574
667
|
|
|
575
|
-
**Optional peer dependencies — install to enable.** `nspell` and its default dictionary (`dictionary-en`) are **optional peer dependencies**: installing `@redocly/recheck` itself pulls in **neither**.
|
|
668
|
+
**Optional peer dependencies — install to enable.** `nspell` and its default dictionary (`dictionary-en`) are **optional peer dependencies**: installing `@redocly/recheck` itself pulls in **neither**.
|
|
669
|
+
Enable `spelling` with:
|
|
576
670
|
|
|
577
671
|
```bash
|
|
578
672
|
npm i nspell dictionary-en
|
|
@@ -586,34 +680,52 @@ npm i nspell
|
|
|
586
680
|
|
|
587
681
|
If a config enables `spelling` without the required peer(s) installed, `recheck validate` fails with an actionable error naming the exact command above — never a bare `Cannot find module 'nspell'` surfacing for the first time at lint time.
|
|
588
682
|
|
|
589
|
-
**Dictionaries load lazily.** Neither `nspell` nor `dictionary-en` is imported unless some rule in your config actually has a `spelling` assertion — a config without one never touches either package, at either `validate` or lint time.
|
|
683
|
+
**Dictionaries load lazily.** Neither `nspell` nor `dictionary-en` is imported unless some rule in your config actually has a `spelling` assertion — a config without one never touches either package, at either `validate` or lint time.
|
|
684
|
+
The loaded speller (including the ~500KB parsed dictionary) is cached per dictionary source for the process's lifetime, so every file/rule sharing the same `dictionary` (or the shared default) reuses one instance rather than reloading it per call.
|
|
590
685
|
|
|
591
|
-
**Word tokenization.** Words are matched with `/\p{L}+(?:['’]\p{L}+)?/gu` — Unicode letter runs, with an optional apostrophe-joined suffix so contractions (`don't`, `it's`) tokenize as one word.
|
|
686
|
+
**Word tokenization.** Words are matched with `/\p{L}+(?:['’]\p{L}+)?/gu` — Unicode letter runs, with an optional apostrophe-joined suffix so contractions (`don't`, `it's`) tokenize as one word.
|
|
687
|
+
A token is skipped (never checked) when it's in `vocab` (case-insensitively), matches any `ignore` pattern, is ALL-CAPS (2+ letters, e.g. an acronym) — matching the same ALL-CAPS carve-out `$title`/`$sentence` capitalization use — or is digit-adjacent (see below).
|
|
688
|
+
Because `\p{L}` can never match a digit, a token touching one is never captured WHOLE by the tokenizer in the first place: a digit-adjacent identifier like `config2` still splits into a letter-only fragment (`config`) as its own regex match.
|
|
689
|
+
Rather than checking that fragment like any other word, a digit-adjacency guard looks at the character immediately before and after each match and skips it when either neighbor is a digit — so common digit-bearing identifiers (`sha256` → `sha`, `utf8` → `utf`, `oauth2` → `oauth`, `es6` → `es`, `log4j` → both `log` and `j`, `2fast` → `fast`) are no longer flagged as false-positive misspellings.
|
|
690
|
+
This mitigates, but doesn't eliminate, every false positive from the tokenizer's inability to capture digits at all — a token entirely surrounded by non-digit characters is still checked normally, so a genuine misspelling elsewhere in the same sentence is still flagged.
|
|
592
691
|
|
|
593
|
-
**Code is never spell-checked, by construction of scope segmentation — not something this assertion special-cases.** A fenced or indented code block is its own `scope: 'code'` segment, entirely distinct from `paragraph`/`heading`/etc.; scoping `spelling` to prose (the common case, e.g. `scope: paragraph` or an array of prose scopes) means `ctx.segments` never contains one.
|
|
692
|
+
**Code is never spell-checked, by construction of scope segmentation — not something this assertion special-cases.** A fenced or indented code block is its own `scope: 'code'` segment, entirely distinct from `paragraph`/`heading`/etc.; scoping `spelling` to prose (the common case, e.g. `scope: paragraph` or an array of prose scopes) means `ctx.segments` never contains one.
|
|
693
|
+
A backtick-delimited **inline** code span, though, remains embedded as raw text inside a prose segment's own content (verified directly against the extractor) — those spans are masked out before tokenizing, the same length-preserving technique `capitalization`'s backtick-span freezing uses, so positions of any remaining flagged word stay exact.
|
|
694
|
+
Scoping `spelling` to `all`/`raw` (or leaving `scope` at its default) checks the whole raw file, literal code included — same default-scope behavior every other native assertion (`swap`, `pattern`, ...) has.
|
|
594
695
|
|
|
595
|
-
**Detection-only** — no `fix`.
|
|
696
|
+
**Detection-only** — no `fix`.
|
|
697
|
+
The rule's `message` gets two positional `%s` substitutions, in this order: **1st = the unrecognized word, 2nd = a suggestion suffix** — either `''` (zero suggestions) or `' — did you mean: a, b, c?'` (one to three, comma-joined) — e.g. the internal fallback `'Unknown word "%s"%s'` → `'Unknown word "wrold" — did you mean: wold, world?'`.
|
|
596
698
|
|
|
597
699
|
#### Built-in technical proper-noun vocabulary
|
|
598
700
|
|
|
599
|
-
`capitalization` and `spelling` both ship a built-in list of common technical/product proper nouns — `TECHNICAL_PROPER_NOUNS`, exported from `@redocly/recheck`'s public API (`import { TECHNICAL_PROPER_NOUNS } from '@redocly/recheck'`) so you can read or extend it yourself.
|
|
701
|
+
`capitalization` and `spelling` both ship a built-in list of common technical/product proper nouns — `TECHNICAL_PROPER_NOUNS`, exported from `@redocly/recheck`'s public API (`import { TECHNICAL_PROPER_NOUNS } from '@redocly/recheck'`) so you can read or extend it yourself.
|
|
702
|
+
It exists so a config that turns on sentence-case headings or spelling doesn't immediately need to hand-list the same 15+ mixed-case technology names every project already has to deal with (`OpenAPI`, `npm`, `Node.js`, `VS Code`, ...).
|
|
600
703
|
|
|
601
704
|
**On by default**, per rule:
|
|
602
705
|
- `capitalization` unions it into `exceptions` (so a listed name keeps its as-written casing under every `$`-style, including `$sentence`).
|
|
603
706
|
- `spelling` unions it into `vocab` (so those words are never reported as misspellings), splitting any multi-token entry into its individual words first — a per-word spell check has no way to accept a whole phrase atomically the way `capitalization`'s phrase matching does.
|
|
604
707
|
- Either union is opted out of independently with that rule's own `builtinVocabulary: false`, restoring strict pre-built-in behavior (a closed vocabulary of only what you list yourself).
|
|
605
|
-
- Your own `exceptions`/`vocab` on the same rule **compose** with the built-ins rather than replacing them — unlike a preset-shipped list on the same rule key, which a same-key override *would* replace entirely (see [`extends` presets](#extends-presets) above).
|
|
708
|
+
- Your own `exceptions`/`vocab` on the same rule **compose** with the built-ins rather than replacing them — unlike a preset-shipped list on the same rule key, which a same-key override *would* replace entirely (see [`extends` presets](#extends-presets) above).
|
|
709
|
+
This is exactly how [`recheck/prose`](#extends-presets)'s `capitalization` rule gets its protection for common technical nouns without shipping any `exceptions` of its own.
|
|
606
710
|
|
|
607
711
|
**Multi-token entries work.** An entry containing a dot or whitespace (`Node.js`, `VS Code`, `Visual Studio Code`, `GitHub Actions`, `Google Cloud`, `Azure DevOps`) is matched by `capitalization` as a whole phrase against the segment text (longest-match-first, case-insensitive but otherwise literal) and preserved verbatim — not looked up per word, which is what a single-token entry like `GitHub` still gets.
|
|
608
712
|
|
|
609
|
-
**Inclusion bar** (why an entry is — or isn't — in the list, and the bar to clear before proposing one): an entry qualifies if it's an unambiguous technology, product, or company name whose exception listing wouldn't *weaken* capitalization/spelling checks — concretely, its lowercase form must not be a legitimate English word in its own right.
|
|
610
|
-
|
|
611
|
-
|
|
713
|
+
**Inclusion bar** (why an entry is — or isn't — in the list, and the bar to clear before proposing one): an entry qualifies if it's an unambiguous technology, product, or company name whose exception listing wouldn't *weaken* capitalization/spelling checks — concretely, its lowercase form must not be a legitimate English word in its own right.
|
|
714
|
+
That covers ordinary Title-Case brand names (`Android`, `Kubernetes`, `Redocly`) just as much as entries with an internal capital (`OpenAPI`, `GraphQL`), a dot (`Node.js`), or forced lowercase (`npm`) — `$sentence` lowercases every non-first word regardless of how "ordinary" its casing looks, so plain Title-Case names need protection too.
|
|
715
|
+
Excluded, deliberately:
|
|
716
|
+
- **Pure ALL-CAPS acronyms** (`JWT`, `YAML`) — already handled structurally by the ALL-CAPS carve-out both `capitalization` and `spelling` apply, so listing them adds maintenance for no behavior change.
|
|
717
|
+
Note this is narrower than "looks like an acronym": `OAuth` and `AsyncAPI` are mixed-case, not pure ALL-CAPS, and are in the list.
|
|
718
|
+
- **Terms with legitimate lowercase prose usage** — generic English (`cloud`, `apps`), words that are ALSO ordinary English words even though they're Redocly product names too (`Realm`, `Replay`, `Respect` — listing them would force-capitalize ordinary usage like "we respect your privacy"; `Node` — the common technical noun, superseded by the `Node.js` phrase entry for the platform specifically), and — caught by a later audit, not the original pass — ordinary brand-shaped words with a real dictionary meaning (`Chrome`, `Markdown`, `Postman`, `Prettier`, `Safari`, `Swagger`, `Windows`; see `src/data/proper-nouns.ts`'s header for each one's disqualifying lowercase usage).
|
|
719
|
+
A few real dictionary words (`Android`, `Docker`, `TypeScript`) were judged rare enough in ordinary lowercase usage to keep anyway — a documented, deliberate risk-acceptance, not an oversight.
|
|
720
|
+
List your own such names in your rule's own `exceptions`/`vocab`, which compose with this list as described above.
|
|
612
721
|
|
|
613
|
-
Two automated tests in `src/data/__tests__/proper-nouns.test.ts` enforce this: one checks every entry's shape against the bar above — no pure ALL-CAPS, and, mechanically, no single-token entry whose lowercase form the REAL spelling dictionary (`dictionary-en`/`nspell`, the same pair `spelling` loads at runtime) accepts as a legitimate English word, unless it's named in an explicit accepted-risk allowlist — plus alphabetization and no duplicates.
|
|
722
|
+
Two automated tests in `src/data/__tests__/proper-nouns.test.ts` enforce this: one checks every entry's shape against the bar above — no pure ALL-CAPS, and, mechanically, no single-token entry whose lowercase form the REAL spelling dictionary (`dictionary-en`/`nspell`, the same pair `spelling` loads at runtime) accepts as a legitimate English word, unless it's named in an explicit accepted-risk allowlist — plus alphabetization and no duplicates.
|
|
723
|
+
A round-trip guard separately drives every entry through the real `capitalization` and `spelling` rules and fails the suite if any entry can't actually be protected — the list can't silently regress into decoration.
|
|
614
724
|
|
|
615
725
|
#### Length Assertions (`length`)
|
|
616
|
-
Recheck-original, detection-only check: measures each scoped segment's size — in characters, words, or sentences — and flags a segment whose measurement falls outside `[min, max]`.
|
|
726
|
+
Recheck-original, detection-only check: measures each scoped segment's size — in characters, words, or sentences — and flags a segment whose measurement falls outside `[min, max]`.
|
|
727
|
+
Unlike `metric` (always whole-document), `length` honors whatever `scope` the rule configures — e.g. `scope: alt` to cap image alt text, or `scope: sentence` to cap sentence length in words.
|
|
728
|
+
[`recheck/google`](#extends-presets) ships this for the guide's stated "fewer than 26 words per sentence" limit (`google/sentence-length`); Microsoft's 150-character alt-text cap is the other published example of this shape.
|
|
617
729
|
|
|
618
730
|
```yaml
|
|
619
731
|
assertions:
|
|
@@ -628,11 +740,14 @@ assertions:
|
|
|
628
740
|
| `min` | `number` | At least one of `min`/`max` | Minimum allowed size; a smaller segment is a violation. |
|
|
629
741
|
| `max` | `number` | At least one of `min`/`max` | Maximum allowed size; a larger segment is a violation. |
|
|
630
742
|
|
|
631
|
-
Omitting both `min` and `max`, a missing/unrecognized `unit`, or an unknown option key are all validation errors — same reasoning as `occurrence`/`metric` above.
|
|
743
|
+
Omitting both `min` and `max`, a missing/unrecognized `unit`, or an unknown option key are all validation errors — same reasoning as `occurrence`/`metric` above.
|
|
744
|
+
An inverted range (`min` > `max`) is also an error.
|
|
632
745
|
|
|
633
|
-
**Detection-only** (not fixable) — there is no single edit that would resize a segment to fit.
|
|
746
|
+
**Detection-only** (not fixable) — there is no single edit that would resize a segment to fit.
|
|
747
|
+
Reports at most one problem per flagged segment, at the segment's own `startLine`/`startColumn`.
|
|
634
748
|
|
|
635
|
-
The rule's `message` gets three positional `%s` substitutions, in this order: **1st = the segment's measured size, 2nd = the unit name, 3rd = the bound that was violated** (`min` or `max`, whichever applied), e.g. the internal fallback `'Segment is %s %s; at most %s allowed'` → `'Segment is 151 characters; at most 150 allowed'`.
|
|
749
|
+
The rule's `message` gets three positional `%s` substitutions, in this order: **1st = the segment's measured size, 2nd = the unit name, 3rd = the bound that was violated** (`min` or `max`, whichever applied), e.g. the internal fallback `'Segment is %s %s; at most %s allowed'` → `'Segment is 151 characters; at most 150 allowed'`.
|
|
750
|
+
The message validation cap for `length` is **3** placeholders (one per value above), same reasoning as `metric`'s 4-cap.
|
|
636
751
|
|
|
637
752
|
#### Built-in Prose Assertions
|
|
638
753
|
Beyond `swap`, `pattern`, `occurrence`, `repetition`, `consistency`, `conditional`, `capitalization`, `metric`, `spelling`, and `length` above, Recheck ships a small set of native prose/format checks:
|
|
@@ -644,10 +759,13 @@ Three of the assertions above (`repetition`, `consistency`, `capitalization`) ar
|
|
|
644
759
|
### Recheck-original structural rules
|
|
645
760
|
|
|
646
761
|
Seven rules have no markdownlint counterpart, so they sit outside the 53-rule parity set
|
|
647
|
-
(and outside the parity comparison).
|
|
762
|
+
(and outside the parity comparison).
|
|
763
|
+
All seven are **detection-only** (`fix: false`).
|
|
764
|
+
The
|
|
648
765
|
canonical list is `RECHECK_ORIGINAL_TOKEN_RULE_NAMES` in `src/rules/token/index.ts`.
|
|
649
766
|
|
|
650
|
-
The table below covers five of them.
|
|
767
|
+
The table below covers five of them.
|
|
768
|
+
The other two — `markdoc-unknown-tag` and
|
|
651
769
|
`markdoc-attributes` — need a tag schema to check anything, so they are documented with
|
|
652
770
|
the [`recheck/markdoc`](#extends-presets) preset instead.
|
|
653
771
|
|
|
@@ -664,10 +782,12 @@ individually as shown below.
|
|
|
664
782
|
|
|
665
783
|
`markdoc-syntax` and `markdoc-pairing` work the other way around: they ship only inside
|
|
666
784
|
the [`recheck/markdoc`](#extends-presets) preset, and both need `markdoc: true` (or the
|
|
667
|
-
object form) to ever see a Markdoc tag token.
|
|
785
|
+
object form) to ever see a Markdoc tag token.
|
|
786
|
+
Naming either rule key on its own, without
|
|
668
787
|
the flag, validates but can never report anything — and you get no warning about it,
|
|
669
788
|
because the stale-config warning fires on `extends` containing `"recheck/markdoc"`
|
|
670
|
-
(`warnStaleMarkdocPreset` in `config/validate.ts`), not on individual rule keys.
|
|
789
|
+
(`warnStaleMarkdocPreset` in `config/validate.ts`), not on individual rule keys.
|
|
790
|
+
The
|
|
671
791
|
preset bullet below covers both rules' full behavior with the flag on, plus a config
|
|
672
792
|
example.
|
|
673
793
|
|
|
@@ -691,7 +811,8 @@ recheck/list-length:
|
|
|
691
811
|
list-length: { min: 2, max: 10 }
|
|
692
812
|
```
|
|
693
813
|
|
|
694
|
-
For markdown structure/format rules (headings, lists, links, tables, whitespace, and 49 more), see [Markdownlint parity](#markdownlint-parity) below — `no-trailing-spaces`, `no-hard-tabs`, `line-length`, `ul-style` (bullet style), `no-duplicate-heading`, and `link-fragments` are all part of that 53-rule set, not this native list.
|
|
814
|
+
For markdown structure/format rules (headings, lists, links, tables, whitespace, and 49 more), see [Markdownlint parity](#markdownlint-parity) below — `no-trailing-spaces`, `no-hard-tabs`, `line-length`, `ul-style` (bullet style), `no-duplicate-heading`, and `link-fragments` are all part of that 53-rule set, not this native list.
|
|
815
|
+
(`max-line-length`, `bullet-style`, `no-duplicate-headings`, and `no-broken-fragment-links` were pre-parity native ids for those same rules; they were removed rather than kept as aliases — see [Migrate from markdownlint](#migrate-from-markdownlint).)
|
|
695
816
|
|
|
696
817
|
### Enhanced Scope Support
|
|
697
818
|
|
|
@@ -731,11 +852,14 @@ Opt-in — off by default, since Liquid/Jinja templates use the same `{% %}` del
|
|
|
731
852
|
markdoc: true # shorthand for `{ schema: 'realm' }`
|
|
732
853
|
```
|
|
733
854
|
|
|
734
|
-
Writing *about* Markdoc syntax rather than using it (docs like this one, a tutorial, a changelog entry)?
|
|
855
|
+
Writing *about* Markdoc syntax rather than using it (docs like this one, a tutorial, a changelog entry)?
|
|
856
|
+
Wrap the literal `{% ... %}` in a code span — `` `{% partial /%}` `` — instead of leaving it bare in prose.
|
|
857
|
+
Code spans never tokenize as Markdoc tags whether the flag is on or off, so that's the escape hatch.
|
|
735
858
|
|
|
736
859
|
#### Object form: choosing or extending the tag schema
|
|
737
860
|
|
|
738
|
-
`markdoc: true` is shorthand for the common case.
|
|
861
|
+
`markdoc: true` is shorthand for the common case.
|
|
862
|
+
The object form adds two things the
|
|
739
863
|
boolean can't express: turning the schema-aware checks off while keeping tag tokenization,
|
|
740
864
|
and layering a project's own custom tags over the built-in schema.
|
|
741
865
|
|
|
@@ -754,27 +878,35 @@ markdoc:
|
|
|
754
878
|
```
|
|
755
879
|
|
|
756
880
|
- **`schema: realm`** — the same built-in schema `markdoc: true` uses: `@markdoc/markdoc`'s
|
|
757
|
-
own built-in tags composed with `@redocly/theme`'s tag definitions.
|
|
881
|
+
own built-in tags composed with `@redocly/theme`'s tag definitions.
|
|
882
|
+
It's generated from a
|
|
758
883
|
theme build rather than hand-written, and a test fails if it drifts out of sync (see
|
|
759
|
-
[CONTRIBUTING.md](CONTRIBUTING.md) for the regeneration command).
|
|
884
|
+
[CONTRIBUTING.md](CONTRIBUTING.md) for the regeneration command).
|
|
885
|
+
This is what most
|
|
760
886
|
projects want, and what the four [`recheck/markdoc`](#extends-presets) rules validate
|
|
761
887
|
against by default.
|
|
762
888
|
- **`schema: false`** — tokenization and tag **pairing** still run, so `markdoc.tag` scope,
|
|
763
889
|
prose-scope exclusion, fix protection, and `markdoc-syntax`/`markdoc-pairing`'s
|
|
764
|
-
grammar-level checks all still work.
|
|
890
|
+
grammar-level checks all still work.
|
|
891
|
+
Only the two schema-dependent rules
|
|
765
892
|
(`markdoc-unknown-tag`, `markdoc-attributes`) go inert, since there's no schema left for
|
|
766
|
-
"unknown tag" or "missing required attribute" to mean anything against.
|
|
893
|
+
"unknown tag" or "missing required attribute" to mean anything against.
|
|
894
|
+
Use this if you
|
|
767
895
|
write Markdoc tags but don't have (or don't want) a schema to validate them against.
|
|
768
|
-
- **`extend.tags`** — merges your own tag definitions over the base schema.
|
|
896
|
+
- **`extend.tags`** — merges your own tag definitions over the base schema.
|
|
897
|
+
On a name
|
|
769
898
|
collision the merge is a **whole-tag replace**, matching how Markdoc's own config
|
|
770
|
-
composition works, not a per-attribute deep merge.
|
|
899
|
+
composition works, not a per-attribute deep merge.
|
|
900
|
+
Declare your project's custom tags
|
|
771
901
|
here (for example, a docs site's own `@theme/markdoc/schema.ts` overrides) so
|
|
772
902
|
`markdoc-unknown-tag` and `markdoc-attributes` validate against your real tag surface
|
|
773
|
-
instead of flagging every custom tag as unknown.
|
|
903
|
+
instead of flagging every custom tag as unknown.
|
|
904
|
+
Under `schema: false` there is no base
|
|
774
905
|
to merge over, so `extend` does nothing.
|
|
775
906
|
- **`extend.tagsFile`** — the same tag-definition surface as `extend.tags`, but sourced from
|
|
776
|
-
a separate YAML file instead of written inline into `recheck.yaml`.
|
|
777
|
-
|
|
907
|
+
a separate YAML file instead of written inline into `recheck.yaml`.
|
|
908
|
+
This is the shape
|
|
909
|
+
[`recheck markdoc-schema`](#generate-a-tagsfile-recheck-markdoc-schema) below generates,
|
|
778
910
|
so a project with tags defined in TypeScript (a `@theme/markdoc/schema.ts` module, say)
|
|
779
911
|
never hand-transcribes them into YAML.
|
|
780
912
|
```yaml
|
|
@@ -789,7 +921,8 @@ markdoc:
|
|
|
789
921
|
wherever `recheck` is invoked from.
|
|
790
922
|
- **Precedence**: tags merge in the order built-in schema → `tagsFile` → inline
|
|
791
923
|
`extend.tags`, each layer a whole-tag replace on a name collision (same rule as
|
|
792
|
-
`extend.tags` above).
|
|
924
|
+
`extend.tags` above).
|
|
925
|
+
`tags` and `tagsFile` can both be set on the same `extend` block;
|
|
793
926
|
`extend` with neither key is rejected by config validation as a likely no-op.
|
|
794
927
|
- **Errors are fatal to the whole run, not a silent markdoc downgrade.** A `tagsFile` that
|
|
795
928
|
doesn't exist, isn't valid YAML, isn't a YAML map, or contains a tag entry with an
|
|
@@ -800,15 +933,21 @@ markdoc:
|
|
|
800
933
|
|
|
801
934
|
Turning `markdoc` on (either form) changes how every prose rule sees a Markdoc tag, not just `markdoc.tag` (above):
|
|
802
935
|
|
|
803
|
-
- **Prose scopes exclude the tag itself.** `paragraph`, `heading`, `list-item`, `blockquote`, and `table.header`/`table.cell` all blank a tag's own `{% ... %}` span out of their content before any rule runs — a `swap`/`pattern`/`capitalization` match can't fire on the tag's syntax, and a `length`/`metric` count doesn't include it.
|
|
936
|
+
- **Prose scopes exclude the tag itself.** `paragraph`, `heading`, `list-item`, `blockquote`, and `table.header`/`table.cell` all blank a tag's own `{% ... %}` span out of their content before any rule runs — a `swap`/`pattern`/`capitalization` match can't fire on the tag's syntax, and a `length`/`metric` count doesn't include it.
|
|
937
|
+
The blanking is position-preserving (same-width spaces, never a deletion), so real text on either side of a tag keeps its exact line and column.
|
|
804
938
|
- **A segment with no prose left isn't emitted at all.** A heading or table cell whose entire text IS a tag (`# {% #anchor %}`) produces no `heading.h1`/`table.cell` segment — there's nothing for a heading or cell rule to check, so none fires on it.
|
|
805
939
|
- **`--fix` never rewrites a Markdoc tag's bytes.** Every proposed fix is checked against the document's tag spans before it's applied: one that doesn't touch a tag goes through untouched, one that fully covers a tag with a same-length replacement gets the tag spliced back in, and anything that would change a tag's length or split it in half is withheld instead — a withheld fix is reported (`skippedFixes` in the [Library API](#library-api)), not silently swallowed.
|
|
806
940
|
- **Two CommonMark constructs Markdoc doesn't have stop being recognized.** Markdoc's own tokenizer disables indented code blocks and setext headings (the `Title\n===\n` underline form) unconditionally, which is how Realm renders, so `markdoc: true` disables them too — and only while the flag is on:
|
|
807
|
-
- A 4+-space-indented block that would otherwise be an indented code block parses as ordinary content instead: a paragraph, list, or fence, whichever the un-indented text would have produced.
|
|
808
|
-
|
|
809
|
-
|
|
941
|
+
- A 4+-space-indented block that would otherwise be an indented code block parses as ordinary content instead: a paragraph, list, or fence, whichever the un-indented text would have produced.
|
|
942
|
+
This shows up most with a block-positioned tag followed immediately by more indented lines, and with genuinely indented example text.
|
|
943
|
+
Realm renders both as prose, so matching that is the intent.
|
|
944
|
+
- A text line immediately followed by a `---`/`===` line, with no blank line between, no longer forms a heading.
|
|
945
|
+
This also fixes a common false positive: a tag on its own line (`{% table %}`, say) directly followed by a `---` line is ordinary Markdoc table-row syntax, but without the flag it reads as a setext heading whose text is the tag itself.
|
|
946
|
+
With the flag on, the tag is its own token and can't merge into a paragraph that `---` would complete.
|
|
947
|
+
- Practical effect: on documents using either construct, expect `heading-style`, `blanks-around-headings`, `capitalization`, and `code-block-style` findings to shift when you first turn the flag on.
|
|
948
|
+
They are moving to match how Markdoc actually renders, not regressing.
|
|
810
949
|
|
|
811
|
-
###
|
|
950
|
+
### Generate a tagsFile: `recheck markdoc-schema`
|
|
812
951
|
|
|
813
952
|
Projects that define their own Markdoc tags in TypeScript — a `@theme/markdoc/schema.ts`
|
|
814
953
|
module exporting a `tags` map, the shape both `docs/realm` and `docs/intranet` use in this
|
|
@@ -820,20 +959,24 @@ recheck markdoc-schema --from path/to/schema.ts --out recheck-markdoc-tags.yaml
|
|
|
820
959
|
```
|
|
821
960
|
|
|
822
961
|
- **`--from <path>`** (repeatable) — a project schema module to extract tags from, resolved
|
|
823
|
-
relative to the current working directory.
|
|
962
|
+
relative to the current working directory.
|
|
963
|
+
The module must export `tags` (named or on a
|
|
824
964
|
`default` object) mapping tag name to a Markdoc tag config; only the statically-checkable
|
|
825
965
|
facets (`selfClosing`, and each attribute's `type`/`required`/`default`/`enum`) are
|
|
826
966
|
extracted — anything richer (a custom attribute class, a `validate()` function) is written
|
|
827
|
-
out as `dynamic: true`, the same reduction the built-in `realm` schema goes through.
|
|
967
|
+
out as `dynamic: true`, the same reduction the built-in `realm` schema goes through.
|
|
968
|
+
Pass
|
|
828
969
|
`--from` more than once to merge several modules; an identical tag definition repeated
|
|
829
970
|
across modules is fine, but two modules disagreeing about the same tag's shape fails the
|
|
830
971
|
command rather than letting flag order silently pick one.
|
|
831
972
|
- **`--out <path>`** — where to write the generated YAML, resolved relative to the current
|
|
832
|
-
working directory.
|
|
973
|
+
working directory.
|
|
974
|
+
The file opens with a generated-file header naming its source module(s)
|
|
833
975
|
and the exact command to regenerate it.
|
|
834
976
|
- **`--check`** — verifies the output file matches what a fresh generation would produce,
|
|
835
977
|
without writing it: exits `0` and prints `<path> is up to date.` when it matches, exits `1`
|
|
836
|
-
and prints a one-line diagnosis (file missing, or stale) otherwise.
|
|
978
|
+
and prints a one-line diagnosis (file missing, or stale) otherwise.
|
|
979
|
+
This is what a CI drift
|
|
837
980
|
check should call — see this repo's own wiring below.
|
|
838
981
|
|
|
839
982
|
**TypeScript sources need a loader.** `recheck markdoc-schema` dynamic-`import()`s each
|
|
@@ -846,7 +989,8 @@ node_modules/.bin/recheck markdoc-schema … (Cannot find module '<a module your
|
|
|
846
989
|
imports>' imported from '<path to your schema.ts>')
|
|
847
990
|
```
|
|
848
991
|
|
|
849
|
-
(wrapped above for line length; the real message is one line.
|
|
992
|
+
(wrapped above for line length; the real message is one line.
|
|
993
|
+
The parenthetical is Node's
|
|
850
994
|
own error and its shape varies: for a schema whose extensionless internal imports plain
|
|
851
995
|
`node` cannot resolve — the common case — the "imported from" path is your schema file
|
|
852
996
|
itself; for a `--from` path that doesn't exist at all it is recheck's own command module.)
|
|
@@ -859,7 +1003,8 @@ works under either.
|
|
|
859
1003
|
long-term source of truth: [issue #25666](https://github.com/Redocly/redocly/issues/25666)
|
|
860
1004
|
tracks Realm itself emitting one canonical, statics-only Markdoc tag/schema manifest, which
|
|
861
1005
|
would let this generator (and its drift check) retire in favor of reading that manifest
|
|
862
|
-
directly.
|
|
1006
|
+
directly.
|
|
1007
|
+
Until then, `recheck markdoc-schema` is the supported way to keep a project's
|
|
863
1008
|
`tagsFile` in sync with its real tag schema modules.
|
|
864
1009
|
|
|
865
1010
|
#### Worked example: this repo's own setup
|
|
@@ -896,7 +1041,8 @@ equivalent but isn't: the script itself already ends in `pnpm --filter @redocly/
|
|
|
896
1041
|
tsx dist/cli.js markdoc-schema …`, and pnpm's own `--` forwarding through that nested `exec`
|
|
897
1042
|
makes yargs read `--check` as a positional argument instead of the `--check` flag — the
|
|
898
1043
|
command then silently regenerates the file and always exits `0`, defeating the whole point
|
|
899
|
-
of a drift check.
|
|
1044
|
+
of a drift check.
|
|
1045
|
+
Always call it as `pnpm run recheck:markdoc-tags --check`, with no extra
|
|
900
1046
|
`--`.
|
|
901
1047
|
|
|
902
1048
|
CI runs exactly that check on every PR, as its own step in
|
|
@@ -921,10 +1067,12 @@ Rules can be configured with different severity levels:
|
|
|
921
1067
|
### Auto-Fix Safety
|
|
922
1068
|
|
|
923
1069
|
Fixability is declared by each assertion, not by config — a rule can be automatically corrected if and only if its assertion implements a `fix()`.
|
|
924
|
-
The `autoFixable` config key was removed — rules declare fixability; use `fix: false` to opt out.
|
|
1070
|
+
The `autoFixable` config key was removed — rules declare fixability; use `fix: false` to opt out.
|
|
1071
|
+
A config that still sets `autoFixable` now fails validation with an unknown-property error.
|
|
925
1072
|
To opt a rule out of auto-fixing, set `fix: false` on it instead.
|
|
926
1073
|
|
|
927
|
-
The `enabled` config key was likewise removed — it was schema-legal but never actually consulted by the engine (use `severity: off` to disable a rule).
|
|
1074
|
+
The `enabled` config key was likewise removed — it was schema-legal but never actually consulted by the engine (use `severity: off` to disable a rule).
|
|
1075
|
+
A config that still sets `enabled` now fails validation with an unknown-property error.
|
|
928
1076
|
|
|
929
1077
|
- ✅ **Fixable native assertions**: `swap`, `semantic-line-breaks`, `repetition`, `consistency`, `capitalization` (except its custom-regex `match` mode, which is always detection-only)
|
|
930
1078
|
- ❌ **Not fixable native assertions**: `pattern`, `max-image-size`, `occurrence`, `conditional`, `metric`, `spelling`
|
|
@@ -932,7 +1080,8 @@ The `enabled` config key was likewise removed — it was schema-legal but never
|
|
|
932
1080
|
|
|
933
1081
|
## Markdownlint parity
|
|
934
1082
|
|
|
935
|
-
Recheck ports all 53 of [markdownlint](https://github.com/DavidAnson/markdownlint)'s built-in rules (MD001-MD060, minus retired ids) as native `assertions`, verified against upstream by a differential parity harness (see [Parity with markdownlint](#parity-with-markdownlint) below).
|
|
1083
|
+
Recheck ports all 53 of [markdownlint](https://github.com/DavidAnson/markdownlint)'s built-in rules (MD001-MD060, minus retired ids) as native `assertions`, verified against upstream by a differential parity harness (see [Parity with markdownlint](#parity-with-markdownlint) below).
|
|
1084
|
+
Enable the full set with one line:
|
|
936
1085
|
|
|
937
1086
|
```yaml
|
|
938
1087
|
extends: [recheck/markdown]
|
|
@@ -1009,25 +1158,55 @@ Generated from the built rule registry — `dist/rules/token/index.js`'s `allTok
|
|
|
1009
1158
|
|
|
1010
1159
|
### `extends` presets
|
|
1011
1160
|
|
|
1012
|
-
Recheck ships nine built-in presets, referenced by id under `extends:`.
|
|
1161
|
+
Recheck ships nine built-in presets, referenced by id under `extends:`.
|
|
1162
|
+
Presets are applied in listed order, then your own rule keys are merged on top — **your config always wins**: a rule key you define overrides the same key from a preset, and per-assertion options you set override just that assertion's preset options (other preset options for the same rule are preserved).
|
|
1013
1163
|
|
|
1014
|
-
There is one exception.
|
|
1164
|
+
There is one exception.
|
|
1165
|
+
A rule may attach a milder severity to some of its own reports, and your config can't escalate those: `recheck/markdoc-attributes` reports unknown attributes at `warn` no matter what severity you give the rule (see the `recheck/markdoc` bullet below).
|
|
1166
|
+
`severity: 'off'` still works as expected — it disables the rule entirely, so no reports of any severity.
|
|
1015
1167
|
|
|
1016
|
-
- **`recheck/markdown`** — the full 53-rule set from the table above, all at `severity: error` with upstream-faithful default options.
|
|
1168
|
+
- **`recheck/markdown`** — the full 53-rule set from the table above, all at `severity: error` with upstream-faithful default options.
|
|
1169
|
+
Equivalent to markdownlint's `{ default: true }`.
|
|
1017
1170
|
- **`recheck/markdown-relaxed`** — mirrors markdownlint's own `style/relaxed.json`: the same 53 rules, with `no-trailing-spaces`, `no-hard-tabs`, `no-multiple-blanks`, `no-multiple-space-blockquote`, `no-blanks-blockquote`, `line-length`, `ul-indent`, `no-inline-html`, `no-bare-urls`, `fenced-code-language`, and `first-line-h1` turned off.
|
|
1018
1171
|
- **`recheck/minimal`** — a small, high-signal set: `no-trailing-spaces`, `no-hard-tabs`, `single-trailing-newline`, `no-reversed-links`, `no-empty-links`.
|
|
1019
|
-
- **`recheck/prose`** — Recheck's Vale-parity starter set, all at `severity: warn`: `repetition` (default options), `consistency` (one US spelling enforced file-wide for `behavior`/`color`/`license`/`organize` vs. their British spellings, matched with `ignoreCase: true` so a capitalized, sentence-initial variant like `Colour` still counts), and `capitalization` (`$sentence`, `scope: heading` only, `fix: false`, no preset-level `exceptions` — see below).
|
|
1020
|
-
|
|
1172
|
+
- **`recheck/prose`** — Recheck's Vale-parity starter set, all at `severity: warn`: `repetition` (default options), `consistency` (one US spelling enforced file-wide for `behavior`/`color`/`license`/`organize` vs. their British spellings, matched with `ignoreCase: true` so a capitalized, sentence-initial variant like `Colour` still counts), and `capitalization` (`$sentence`, `scope: heading` only, `fix: false`, no preset-level `exceptions` — see below).
|
|
1173
|
+
All three are scoped to prose segments — `repetition` and `consistency` to `summary` (the document's prose: paragraph, heading, list-item, blockquote, and table-cell text), `capitalization` to headings — so the preset never flags (and `--fix` never rewrites) code samples or frontmatter.
|
|
1174
|
+
`extends: [recheck/markdown, recheck/prose]` is the one-liner that replaces a markdownlint + Vale combo.
|
|
1175
|
+
See [Opt-in prose assertions](#opt-in-prose-assertions) below for three more prose assertions that exist but are deliberately **not** in this preset.
|
|
1176
|
+
- **`recheck/markdoc`** — four Recheck-original rules that check Markdoc tag syntax itself (`{% tag attr="value" %}`) rather than prose or markdownlint parity.
|
|
1177
|
+
All four are `fix: false`.
|
|
1021
1178
|
- `recheck/markdoc-syntax` (`error`) — malformed spans, unquoted "bareword" values, and close tags carrying attributes.
|
|
1022
1179
|
- `recheck/markdoc-pairing` (`error`) — unclosed, orphaned, or crossed tag pairs, and a self-closing tag written without a slash or given a close tag it shouldn't have.
|
|
1023
1180
|
- `recheck/markdoc-unknown-tag` (`warn`, because custom tags are common) — a tag name the schema doesn't declare.
|
|
1024
|
-
- `recheck/markdoc-attributes` (mixed) — a missing required attribute, an enum or type violation, and a duplicate attribute report at `error`; an unknown attribute name, whether named or a stray positional value, always reports at `warn`.
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1181
|
+
- `recheck/markdoc-attributes` (mixed) — a missing required attribute, an enum or type violation, and a duplicate attribute report at `error`; an unknown attribute name, whether named or a stray positional value, always reports at `warn`.
|
|
1182
|
+
That `warn` is set per report by the rule itself, so it wins over the rule's configured severity: setting the rule to `severity: error` does not escalate those reports.
|
|
1183
|
+
Only `severity: 'off'` removes them, by disabling the rule.
|
|
1184
|
+
|
|
1185
|
+
**These rules only fire when Markdoc tokenization is also on.** Set `markdoc: true` (or the object form, see below) alongside `extends: [recheck/markdoc]`.
|
|
1186
|
+
Extending the preset without the flag validates, but prints a console warning that the four rules can never report.
|
|
1187
|
+
The flag stays an explicit opt-in because Liquid and Jinja templates use the same `{% %}` delimiters for unrelated syntax, so Recheck never assumes it.
|
|
1188
|
+
- **`recheck/google`** — Google's developer documentation style guide (https://developers.google.com/style), CC BY 4.0, synced 2026-07-29. 99 rules covering heading/list/table/link structure, sentence-case headings, sentence length, voice and contractions, plain language, product naming, compound word forms, and inclusive/precise-language terminology — all derived from the *live* guide (see `packages/recheck/presets/google/PROVENANCE.md` for the rule -> source page -> quote -> verdict table, including everything considered and NOT shipped, and why).
|
|
1189
|
+
`extends: [recheck/google]` is a one-line adoption of Google's style; combine with `recheck/markdown` for full structural linting too.
|
|
1190
|
+
Rule ids are namespaced `google/<rule>` (not `recheck/<rule>`) so they never collide with the markdownlint-parity or other style-guide presets.
|
|
1191
|
+
Structural/mechanical rules (heading hierarchy, list mechanics, alt-text presence, sentence length) are `severity: error`; every word-choice, terminology, and punctuation-convention rule is `severity: warn`.
|
|
1192
|
+
See `packages/recheck/presets/google/sources.json` for the fetched-page hashes. **Adopting this preset has a real, measured performance cost — roughly 2.7× the standard `recheck/markdown`-only profile's lint time on a docs-sized document set** — see [Performance](#performance) below (Phase 4) before turning it on in CI.
|
|
1193
|
+
- **`recheck/microsoft`** — the Microsoft Writing Style Guide (https://learn.microsoft.com/en-us/style-guide/welcome/), CC BY 4.0 (via the guide's backing GitHub repository's LICENSE file — no `learn.microsoft.com` page states the licence itself, see `packages/recheck/presets/microsoft/PROVENANCE.md`), synced 2026-07-30. 93 rules covering heading/list/table/alt-text structure, the guide's own numeric thresholds (paragraph length, list length, comma density, alt-text length), its signature "use contractions" rule, US spelling, bias-free and people-first terminology, and a large A-Z terminology word list — all derived from the *live* guide and checked against four independent verification passes (~490 rules/entries across ~340 page fetches), with every Tier-1 pair anchored or demoted to detection-only wherever it was found capable of rewriting correct prose.
|
|
1194
|
+
Rule ids are namespaced `microsoft/<rule>`.
|
|
1195
|
+
Structural rules and the A-Z word list's three unconditional tiers are `severity: error`; voice, punctuation-convention, and UI-terminology rules are `severity: warn`.
|
|
1196
|
+
Audience-conditional and UI-conditional entries (Microsoft's own "Tier 4") are never enforced, and developer-audience carve-outs relevant to API documentation (`header`, `context menu`, `disk`, `directory`) are excluded rather than misfiring on Redocly's own docs — see `packages/recheck/presets/microsoft/PROVENANCE.md` for the full table, every excluded candidate, and why.
|
|
1197
|
+
Unlike `recheck/google` (which allows `click`), this preset bans all input-specific UI verbs (`click`, `press`, `hit`) in favor of `select` — the sharpest divergence between the two guides.
|
|
1198
|
+
See `packages/recheck/presets/microsoft/sources.json` for the fetched-page hashes.
|
|
1199
|
+
- **`recheck/inclusive-language`** — composable, guide-agnostic: the *intersection* of `recheck/google` and `recheck/microsoft`'s inclusive/bias-free/ableist/accessibility content — terminology both flagship guides independently state should be avoided (`slave`, `master/slave`, `blacklist`/`whitelist`, `DMZ`, `grayed-out`, `he/she`, `normal person`/`healthy person`, `suffering from`/`victim of`, `differently abled`, `crippled`, `nuke`).
|
|
1200
|
+
All `warn` severity, all detection-only.
|
|
1201
|
+
Needed no new web fetch — every term was already confirmed against a live page by five existing verification reports; see `packages/recheck/presets/inclusive-language/PROVENANCE.md` for the report → row → term table and every single-guide term left out on purpose.
|
|
1202
|
+
Layer it onto either flagship or onto `recheck/prose`: `extends: [recheck/google, recheck/inclusive-language]`. **Because it's built as an intersection, every one of its 11 rules is already shipped by at least one flagship's own preset** (measured: 7 of 11 duplicate a `google/*` finding on the same span when stacked onto `recheck/google` alone, 6 of 11 duplicate a `microsoft/*` finding when stacked onto `recheck/microsoft` alone — see `packages/recheck/presets/inclusive-language/PROVENANCE.md`'s "Duplicate-finding audit").
|
|
1203
|
+
Its full, zero-duplicate value is realized standalone, with `recheck/prose`, or on a project using neither flagship; stacked onto exactly one flagship it still fills that flagship's own gaps, but expect a majority of its findings to be reported twice.
|
|
1204
|
+
- **`recheck/plain-language`** — composable, derived from the *live* US federal plain-language guidance (`digital.gov/guides/plain-language`; public domain, no attribution constraint).
|
|
1205
|
+
Smaller than a first read of the old `plainlanguage.gov` site would suggest: that site is now dead and redirects to a much thinner overview, so there's no sentence-length or readability-`metric` rule (`metric` stays a documented [opt-in](#opt-in-prose-assertions), unchanged) — only paragraph length (the one family with real, quotable numbers), filler/wordy phrases, complex-word substitutes, redundant pairs, double negatives, and jargon-to-plain examples. **`shall` is never flagged** — it's a defined RFC 2119 normative keyword used throughout specs and API docs, exactly what Recheck lints; `implement` and `command` carry the identical technical-sense collision and are excluded the same way.
|
|
1206
|
+
All `warn`/`error` (paragraph-length ceiling only) severity, all detection-only.
|
|
1207
|
+
`in order to` and `utilize`/`utilization` are deliberately NOT shipped despite being live, verbatim guide content — both flagships already ship the identical pair, so keeping them here would only ever produce a duplicate finding, never new coverage (measured: this cut duplicate findings on the same fixture from 6 to 3 against `recheck/google`, and from 5 to 3 against `recheck/microsoft`).
|
|
1208
|
+
The 3 that remain are an accepted paragraph-length overlap with `recheck/microsoft` (two independently-sourced numbers, not the same fact restated) and a coincidental substring collision with `use-contractions`, not content duplication.
|
|
1209
|
+
See `packages/recheck/presets/plain-language/PROVENANCE.md` for every rule's source quote, every family considered and left out, and the full duplicate-finding audit.
|
|
1031
1210
|
|
|
1032
1211
|
**All four of the presets above — `recheck/google`, `recheck/microsoft`,
|
|
1033
1212
|
`recheck/inclusive-language`, and `recheck/plain-language` — are
|
|
@@ -1039,28 +1218,35 @@ There is one exception. A rule may attach a milder severity to some of its own r
|
|
|
1039
1218
|
makes one fixable again — see `preset-google.test.ts`'s and
|
|
1040
1219
|
`preset-microsoft.test.ts`'s "is detection-only" describe blocks, and
|
|
1041
1220
|
`preset-composition.test.ts`'s list-driven version covering all four.
|
|
1042
|
-
`recheck/google` and `recheck/microsoft` once had fixable rules.
|
|
1221
|
+
`recheck/google` and `recheck/microsoft` once had fixable rules.
|
|
1222
|
+
Every
|
|
1043
1223
|
attempt to define a safe subset of them found the fixes corrupting
|
|
1044
1224
|
genuinely correct prose, in every category previously believed safe:
|
|
1045
1225
|
spelling (Hemingway's correctly spelled *A Moveable Feast* → "A Movable
|
|
1046
1226
|
Feast"), hyphenation ("read only the introduction" → "read-only the
|
|
1047
1227
|
introduction"), and at least one outright inversion of meaning ("No SQL is
|
|
1048
|
-
used here" → "NoSQL is used here").
|
|
1228
|
+
used here" → "NoSQL is used here").
|
|
1229
|
+
A rule's *category* does not predict
|
|
1049
1230
|
fix safety at this scale: a style guide states intent while
|
|
1050
1231
|
`swap`/`consistency`/`pattern` match tokens, and narrowing which
|
|
1051
|
-
categories count as "safe" doesn't close that gap.
|
|
1232
|
+
categories count as "safe" doesn't close that gap.
|
|
1233
|
+
Detection is
|
|
1052
1234
|
unaffected — every rule still runs and reports, and you apply the fix
|
|
1053
|
-
yourself with the judgment style guidance has always required.
|
|
1235
|
+
yourself with the judgment style guidance has always required.
|
|
1236
|
+
This is the
|
|
1054
1237
|
same reason Vale, the tool these presets replace, never shipped this class
|
|
1055
|
-
of bug.
|
|
1238
|
+
of bug.
|
|
1239
|
+
See the "Detection-only" sections of
|
|
1056
1240
|
`packages/recheck/presets/google/PROVENANCE.md` and
|
|
1057
1241
|
`packages/recheck/presets/microsoft/PROVENANCE.md` for the full history.
|
|
1058
1242
|
|
|
1059
1243
|
The heading rule uses **sentence case** *(changed from AP title case by product decision 2026-07-29: Redocly's own guide, Google, and Microsoft all mandate sentence case)*.
|
|
1060
1244
|
Two details make that default safe out of the box:
|
|
1061
1245
|
|
|
1062
|
-
- **The [built-in technical proper-noun vocabulary](#built-in-technical-proper-noun-vocabulary)** — `TECHNICAL_PROPER_NOUNS` — is unioned into `exceptions` by `capitalization` itself (default `builtinVocabulary: true`), so this preset doesn't ship its own copy: `$sentence` still won't flag `OpenAPI`, `GitHub`, `macOS`, and the rest of that list out of the box.
|
|
1063
|
-
|
|
1246
|
+
- **The [built-in technical proper-noun vocabulary](#built-in-technical-proper-noun-vocabulary)** — `TECHNICAL_PROPER_NOUNS` — is unioned into `exceptions` by `capitalization` itself (default `builtinVocabulary: true`), so this preset doesn't ship its own copy: `$sentence` still won't flag `OpenAPI`, `GitHub`, `macOS`, and the rest of that list out of the box.
|
|
1247
|
+
It's a common-vocabulary floor, not a full brand list — extend it with your own product/company names via this rule's own `exceptions`, which **compose** with the built-ins rather than replacing them (unlike a preset-shipped list, which a same-key override would have replaced entirely).
|
|
1248
|
+
- **`fix: false`** — a sentence-case auto-fix would lowercase any proper noun the built-ins and your own `exceptions` don't cover, silently damaging content.
|
|
1249
|
+
Set `fix: true` on your own `recheck/capitalization` key (or drop the key) once your exceptions list covers your vocabulary.
|
|
1064
1250
|
|
|
1065
1251
|
```yaml
|
|
1066
1252
|
extends:
|
|
@@ -1076,9 +1262,10 @@ recheck/line-length:
|
|
|
1076
1262
|
|
|
1077
1263
|
Multiple presets can be listed; later presets in the list override earlier ones for the same rule key, before your own top-level rule keys are merged in last.
|
|
1078
1264
|
|
|
1079
|
-
###
|
|
1265
|
+
### Tune a preset
|
|
1080
1266
|
|
|
1081
|
-
Adopting a whole style-guide preset doesn't mean accepting every rule at its shipped severity.
|
|
1267
|
+
Adopting a whole style-guide preset doesn't mean accepting every rule at its shipped severity.
|
|
1268
|
+
Because your own config's rule keys always win over a preset's (see above), you can turn individual rules off, downgrade them, or silence single occurrences — all verified against a live build, not just read from source:
|
|
1082
1269
|
|
|
1083
1270
|
```yaml
|
|
1084
1271
|
extends: [recheck/markdown, recheck/microsoft]
|
|
@@ -1103,7 +1290,9 @@ Click the hot link to continue.
|
|
|
1103
1290
|
<!-- recheck-disable-file -->
|
|
1104
1291
|
```
|
|
1105
1292
|
|
|
1106
|
-
**The sharp edge:** merging a user override on top of a preset rule happens per *assertion id*, not per option inside it.
|
|
1293
|
+
**The sharp edge:** merging a user override on top of a preset rule happens per *assertion id*, not per option inside it.
|
|
1294
|
+
Setting a partial override on a bundled `swap` or `pattern` rule doesn't just change the one option you named — it **replaces that assertion object entirely**, silently discarding everything else it carried.
|
|
1295
|
+
For example:
|
|
1107
1296
|
|
|
1108
1297
|
```yaml
|
|
1109
1298
|
microsoft/spelling-hyphenation:
|
|
@@ -1118,7 +1307,9 @@ drops the preset's whole `pairs` map along with it, and the config then fails va
|
|
|
1118
1307
|
Rule "microsoft/spelling-hyphenation": swap requires a "pairs" object mapping find -> replace strings
|
|
1119
1308
|
```
|
|
1120
1309
|
|
|
1121
|
-
So today, to reject just one term out of a bundled `swap`/`pattern` rule, your options are: turn the whole rule off, restate its entire `pairs`/`tokens` yourself, or inline-disable each occurrence as shown above.
|
|
1310
|
+
So today, to reject just one term out of a bundled `swap`/`pattern` rule, your options are: turn the whole rule off, restate its entire `pairs`/`tokens` yourself, or inline-disable each occurrence as shown above.
|
|
1311
|
+
Two assertion types already have a real per-term escape hatch that doesn't hit this edge: `capitalization`'s `exceptions` (an array of allowed terms that **composes** with the built-in technical-proper-noun vocabulary and anything else you add, rather than replacing it) and `spelling`'s `ignore`.
|
|
1312
|
+
A per-term opt-out for `swap`/`pattern` is a known follow-up, not shipped yet.
|
|
1122
1313
|
|
|
1123
1314
|
### Example configs
|
|
1124
1315
|
|
|
@@ -1127,15 +1318,20 @@ So today, to reject just one term out of a bundled `swap`/`pattern` rule, your o
|
|
|
1127
1318
|
Each file has four parts, in this order:
|
|
1128
1319
|
|
|
1129
1320
|
1. **An attribution header** — source, license, and sync date, as YAML comments (mirrors that preset's `PROVENANCE.md`).
|
|
1130
|
-
2. **`# What to paste`** — the actual adoption cost: a two-to-four-line `extends` block.
|
|
1131
|
-
|
|
1132
|
-
|
|
1321
|
+
2. **`# What to paste`** — the actual adoption cost: a two-to-four-line `extends` block.
|
|
1322
|
+
This is the only part most readers need; everything below it is supporting material, not something to copy.
|
|
1323
|
+
3. **`# How to tune it`** — override patterns verified to work today (turn a rule off, downgrade its severity, inline-disable one occurrence with an HTML comment), plus a documented sharp edge: overriding one option on a bundled `swap`/`pattern` rule's `assertions` **replaces that assertion entirely**, silently discarding options like a `pairs` map you didn't restate (merging is per *assertion id*, not per option) — restate the whole map, turn the rule off, or use an inline directive instead.
|
|
1324
|
+
`capitalization`'s `exceptions` and `spelling`'s `ignore` are the two assertion types that already have a real per-term escape hatch; an equivalent for `swap`/`pattern` is a known follow-up, not shipped yet.
|
|
1325
|
+
4. **`# Full expansion (reference)`** — the preset's entire resolved rule set (alphabetized), so a reader can see exactly what they're adopting without running the tool.
|
|
1326
|
+
Every value here is identical to what the `extends` block above already resolves to, so copying this section too is redundant, not broken — it's for reading, not pasting.
|
|
1133
1327
|
|
|
1134
1328
|
A hand-maintained appendix is appended verbatim after part 4: NOISY candidates the guide states but the preset doesn't enforce (shown as the rule they'd be if shipped, commented out, with a one-line false-positive note each) and a checklist of guide content that needs a human, not a linter (NOT-ENFORCEABLE — active voice, missing-Oxford-comma detection, and similar).
|
|
1135
1329
|
|
|
1136
1330
|
### Opt-in prose assertions
|
|
1137
1331
|
|
|
1138
|
-
`recheck/prose` (above) intentionally ships only `repetition`, `consistency`, and `capitalization` — a small, broadly-applicable default.
|
|
1332
|
+
`recheck/prose` (above) intentionally ships only `repetition`, `consistency`, and `capitalization` — a small, broadly-applicable default.
|
|
1333
|
+
Three more Vale-parity/native assertions exist (see [Assertion Types](#assertion-types) above for full per-option tables) but are **not shipped in any preset**, because their thresholds, patterns, or dictionaries are inherently project-specific rather than having one right-for-everyone default: `conditional`, `metric`, `spelling`.
|
|
1334
|
+
(`length` and `occurrence` used to be entries here; neither is an opt-in any more — [`recheck/google`](#extends-presets) ships `length` directly for the guide's sentence-length limit, and [`recheck/microsoft`](#extends-presets) ships `occurrence` directly for the guide's comma-density rule, so neither one's default bounds are "no one right answer" any more.) Add any of the three by copying its rule below into your own config, alongside `extends: [recheck/prose]`:
|
|
1139
1335
|
|
|
1140
1336
|
```yaml
|
|
1141
1337
|
extends: [recheck/markdown, recheck/prose]
|
|
@@ -1171,7 +1367,7 @@ recheck/us-spelling-check:
|
|
|
1171
1367
|
|
|
1172
1368
|
Each snippet's `severity`, `message`, `scope`, and `exceptions` are yours to adjust — see [Rule Types and Assertions](#rule-types-and-assertions) for every option each assertion accepts, and [Inline Directives](#inline-directives) to silence any one of them on a specific line or file with an HTML comment instead of turning it off entirely.
|
|
1173
1369
|
|
|
1174
|
-
###
|
|
1370
|
+
### Migrate from markdownlint
|
|
1175
1371
|
|
|
1176
1372
|
A markdownlint config maps onto Recheck almost 1:1 — `extends` a preset, then override individual rules by their Recheck name (same short name markdownlint uses, e.g. `line-length` for MD013) under `assertions`:
|
|
1177
1373
|
|
|
@@ -1210,10 +1406,24 @@ Two other ids are **upstream markdownlint's own alternate rule names**, not a Re
|
|
|
1210
1406
|
|
|
1211
1407
|
**Two intentional behavior changes** vs. plain markdownlint defaults, both on rules that predate the parity port and kept their exact ids:
|
|
1212
1408
|
|
|
1213
|
-
- **`no-trailing-spaces` (MD009)** now exempts lines with *exactly 2* trailing spaces by default (a markdown hard line break), instead of flagging all trailing whitespace.
|
|
1214
|
-
|
|
1409
|
+
- **`no-trailing-spaces` (MD009)** now exempts lines with *exactly 2* trailing spaces by default (a markdown hard line break), instead of flagging all trailing whitespace.
|
|
1410
|
+
Set `strict: true` to restore the old flag-everything behavior (matches markdownlint's default).
|
|
1411
|
+
- **`no-hard-tabs` (MD010)**'s `spacesPerTab` option now defaults to `1` (matching markdownlint's own upstream default) — Recheck's earlier, pre-parity native rule had defaulted this to `2`.
|
|
1412
|
+
If you were relying on that old default, set `spacesPerTab: 2` explicitly.
|
|
1413
|
+
|
|
1414
|
+
Token-rule options aren't individually schema-validated, so an option name a rule doesn't recognize is silently ignored — it has no effect, and produces no warning or error.
|
|
1415
|
+
|
|
1416
|
+
### Cross-file link validation
|
|
1215
1417
|
|
|
1216
|
-
|
|
1418
|
+
`link-fragments` accepts `crossFile: true` to validate links across files, replacing external link checkers such as `mlc` for repo-internal links:
|
|
1419
|
+
|
|
1420
|
+
- A relative link or image target must exist on disk (`[x](./missing.md)` flags).
|
|
1421
|
+
- A `file.md#anchor` fragment must exist in the target file's headings and anchors.
|
|
1422
|
+
- Extensionless links resolve the way the Realm router does: `./page` tries `page.md`, and a directory link reads its `index.md`.
|
|
1423
|
+
- External URLs, `mailto:`, and site-root absolute paths (`/x/y`) are skipped.
|
|
1424
|
+
|
|
1425
|
+
Each target file is read once per run and cached by modification time.
|
|
1426
|
+
The option is off by default; in-document fragment checking is unchanged.
|
|
1217
1427
|
|
|
1218
1428
|
### Known differences from markdownlint
|
|
1219
1429
|
|
|
@@ -1223,19 +1433,26 @@ Token-rule options aren't individually schema-validated, so an option name a rul
|
|
|
1223
1433
|
<!-- markdownlint-disable -->
|
|
1224
1434
|
```
|
|
1225
1435
|
|
|
1226
|
-
(dash HTML-escaped above so this very README doesn't trip markdownlint's own directive scanner — markdownlint recognizes these directives even inside fenced code, so the literal syntax can't appear here unescaped).
|
|
1436
|
+
(dash HTML-escaped above so this very README doesn't trip markdownlint's own directive scanner — markdownlint recognizes these directives even inside fenced code, so the literal syntax can't appear here unescaped).
|
|
1437
|
+
Markdownlint's HTML-comment-based per-line/per-region rule toggles (`markdownlint-disable`, `markdownlint-disable-next-line`, `markdownlint-enable`, etc.) are a distinct engine feature, not a rule port, and Recheck doesn't parse them today.
|
|
1438
|
+
Use config-level `exceptions` (file/line patterns) or `excludes`/`appliesTo` to achieve the same effect.
|
|
1439
|
+
Native support is a possible future addition; no decision has been made yet.
|
|
1227
1440
|
|
|
1228
1441
|
### Parity with markdownlint
|
|
1229
1442
|
|
|
1230
|
-
The 53 ported rules are checked against upstream markdownlint by a differential harness (`pnpm parity`, `benchmarks/parity/run-parity.mjs`): the harness lints the same real-world document set with both Recheck (via a config translated from markdownlint's option surface) and markdownlint itself, then set-diffs the findings.
|
|
1443
|
+
The 53 ported rules are checked against upstream markdownlint by a differential harness (`pnpm parity`, `benchmarks/parity/run-parity.mjs`): the harness lints the same real-world document set with both Recheck (via a config translated from markdownlint's option surface) and markdownlint itself, then set-diffs the findings.
|
|
1444
|
+
As of this writing it reports **zero unexplained differences** across:
|
|
1231
1445
|
|
|
1232
1446
|
- `mdn-content` (MDN Web Docs, ~14.5k files)
|
|
1233
1447
|
- `electron` (Electron's docs + repo markdown)
|
|
1234
1448
|
- `monorepo-docs` (this monorepo's own `docs/` tree)
|
|
1235
1449
|
|
|
1236
|
-
on both the `default` profile (full `recheck/markdown` preset vs. markdownlint `{ default: true }`) and a `rebilly` profile (a real third-party `.markdownlint.yaml` translated to Recheck config).
|
|
1450
|
+
on both the `default` profile (full `recheck/markdown` preset vs. markdownlint `{ default: true }`) and a `rebilly` profile (a real third-party `.markdownlint.yaml` translated to Recheck config).
|
|
1451
|
+
A small, explicitly documented allowlist (`benchmarks/parity/allowlist.json`) covers the one known permanent engine-surface gap — inline `markdownlint-disable` directives (see [Known differences](#known-differences-from-markdownlint) above) — scoped to the exact rules it can affect (MD010, MD011, MD033, MD059).
|
|
1452
|
+
Everything else matches exactly.
|
|
1237
1453
|
|
|
1238
|
-
**`pnpm parity` requires `--corpus`** — running it bare exits `2` with a usage error (`Usage: node benchmarks/parity/run-parity.mjs --corpus <name> [--profile default|rebilly] [--rules MD001,MD013]`) rather than running against a default document set.
|
|
1454
|
+
**`pnpm parity` requires `--corpus`** — running it bare exits `2` with a usage error (`Usage: node benchmarks/parity/run-parity.mjs --corpus <name> [--profile default|rebilly] [--rules MD001,MD013]`) rather than running against a default document set.
|
|
1455
|
+
Always pass a document-set name, e.g. `pnpm parity --corpus monorepo-docs --profile default`.
|
|
1239
1456
|
|
|
1240
1457
|
## GitHub Actions Integration
|
|
1241
1458
|
|
|
@@ -1303,19 +1520,35 @@ Recheck trades a bit of the Phase 1 constant-factor lead for full rule-count par
|
|
|
1303
1520
|
|
|
1304
1521
|
- **Phase 3** (prose profile — the standard Phase 2 rule set vs. that same set plus the Vale-parity prose additions, `monorepo-docs` document set, the same set on both sides):
|
|
1305
1522
|
- Standard profile (`recheck-mdl-preset.yaml`, `extends: [recheck/markdown]`, 53 rules, `run-recheck-mdl-preset.mjs`, 965 files): **4072ms** median — **-8.9% vs the Phase 2 recording** (`phase2-parity-recheck`, 4468ms, 954 files), i.e. no regression from the Phase 3 rule-registry additions, since the standard profile doesn't exercise any of them (the small speedup is run-to-run variance plus the document-set size difference, not an optimization claim).
|
|
1306
|
-
- Prose profile (`recheck-prose-bench.yaml`, `extends: [recheck/markdown, recheck/prose]` plus one opt-in `occurrence` rule and one opt-in `conditional` rule, 58 rules, `run-recheck-prose.mjs`, same 965 files): **4547ms** median — **+11.7%** vs. the standard profile above, for the five added prose/scope rules (`repetition`, `consistency`, `capitalization`, and the two opt-ins).
|
|
1307
|
-
|
|
1523
|
+
- Prose profile (`recheck-prose-bench.yaml`, `extends: [recheck/markdown, recheck/prose]` plus one opt-in `occurrence` rule and one opt-in `conditional` rule, 58 rules, `run-recheck-prose.mjs`, same 965 files): **4547ms** median — **+11.7%** vs. the standard profile above, for the five added prose/scope rules (`repetition`, `consistency`, `capitalization`, and the two opt-ins).
|
|
1524
|
+
Comfortably under the "investigate if >2x standard" threshold; no pathological per-rule cost found.
|
|
1525
|
+
There is no hard pass/fail gate for this profile (new profile, first recording) — these numbers establish its baseline.
|
|
1526
|
+
- Measured 2026-07-27 (local time; the result JSONs record the UTC date `2026-07-28`, so the file dates and this measurement date differ by design, not by error) at commit `27a8b6feb10` (immediately prior to the commit that added this benchmark profile), on an Apple M2 Max / Darwin 24.6.0 / Node v23.7.0 machine; single 3-run session, not a statistically rigorous multi-session average — treat the deltas as directional, not precise.
|
|
1527
|
+
`pnpm bench --subject <script> --corpus monorepo-docs --runs 3 --record <label>` (median of 3 timed runs after 1 warm-up); recorded to `benchmarks/results/phase3-prose-standard.json` / `phase3-prose-profile.json`.
|
|
1528
|
+
A `--corpus self` (2-file) smoke pair recorded to `phase3-prose-standard-self.json` / `phase3-prose-profile-self.json` proves the harness/subject-script mechanics end-to-end but isn't large enough to be a meaningful timing signal on its own.
|
|
1308
1529
|
|
|
1309
1530
|
- **Phase 4** (refreshed standard/prose figures plus the new `recheck/google` profile, `monorepo-docs` document set, the same set across all three, 968 files — the document set grew by 3 files since the Phase 3 recording):
|
|
1310
|
-
- Standard profile (same config as Phase 2/3, `recheck-mdl-preset.yaml`, 53 rules): **4350ms** median (runs 4341/4350/4369ms — 28ms spread, 0.6% of median: a tight, trustworthy measurement).
|
|
1311
|
-
|
|
1531
|
+
- Standard profile (same config as Phase 2/3, `recheck-mdl-preset.yaml`, 53 rules): **4350ms** median (runs 4341/4350/4369ms — 28ms spread, 0.6% of median: a tight, trustworthy measurement).
|
|
1532
|
+
This refreshes — and for current comparisons supersedes — Phase 3's `4072ms`/965-file recording; the ~7% difference is within normal session-to-session noise (different process/cache/scheduler state), not a regression, and there is still no rule-registry change that would affect this profile.
|
|
1533
|
+
- Prose profile (same config as Phase 3, `recheck-prose-bench.yaml`, 58 rules): **4801ms** median (runs 4599/4801/4840ms — 241ms spread, 5.0% of median) — **+10.4%** vs. the refreshed standard profile above.
|
|
1534
|
+
This is the requested refresh of the Phase 3 prose figures, which the `capitalization` default's AP-title-case → sentence-case change (2026-07-29, see [`extends` presets](#extends-presets) below) made marginally stale, since this profile's `capitalization` rule is exactly what that change touched.
|
|
1535
|
+
The new delta (+10.4%) is close to Phase 3's original (+11.7%); given the 5.0% run-to-run spread observed here, treat both numbers as directionally consistent, not as proof of a precise change in cost — same posture Phase 3 itself took.
|
|
1312
1536
|
- **`recheck/google` profile** (new — `recheck-google-bench.yaml`, `extends: [recheck/markdown, recheck/google]`, 152 rules total: the same 53-rule structural set plus all 99 rules `recheck/google` ships, `run-recheck-google.mjs`, same 968 files): **11792ms** median (runs 11628/11792/12164ms — 536ms spread, 4.5% of median).
|
|
1313
|
-
- **This profile is substantially more expensive than either profile above: roughly 2.7× (~+171%) the standard profile's median time**, a materially different result from the ~1.1–1.2× range Phase 2/3 established for the markdownlint-parity and Vale-parity workloads.
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
- **
|
|
1537
|
+
- **This profile is substantially more expensive than either profile above: roughly 2.7× (~+171%) the standard profile's median time**, a materially different result from the ~1.1–1.2× range Phase 2/3 established for the markdownlint-parity and Vale-parity workloads.
|
|
1538
|
+
This is recorded as a **new baseline on its own terms, not a regression against the standard-profile's ±40% parity gate** — that gate applies only to `recheck/markdown` vs. markdownlint's equivalent rule set (Phase 2, unaffected by this preset's addition) and was never meant to bound a ~99-rule prose-preset workload layered on top of it.
|
|
1539
|
+
The number is reported as measured, without tuning the preset to improve it.
|
|
1540
|
+
- The ~171% delta is far larger than the ≤5% run-to-run spread measured on all three profiles this session, so the *direction and rough magnitude* of "the Google preset costs several times more than the structural set alone" is trustworthy; the precise "171%" is not — this is a single 3-run-median session on one developer machine, not a statistically rigorous benchmark.
|
|
1541
|
+
Read it as "roughly 2.5–3×," not as a number with two decimal digits of meaning.
|
|
1542
|
+
- **What this means for adopters**: turning on `extends: [recheck/google]` roughly triples per-run lint time on a docs-sized document set (968 files: ~4.3s → ~11.8s).
|
|
1543
|
+
That is a real, user-facing cost, stated here so it is visible before adoption rather than discovered later in CI — projects sensitive to CI duration should budget for it explicitly (e.g., a separate, non-blocking job, or a scheduled run) rather than assuming `recheck/google` is free to layer on top of `recheck/markdown`.
|
|
1544
|
+
- Measured 2026-07-30 at commit `7c50caaaf05` (immediately prior to the commit that adds this benchmark profile), on the same Apple M2 Max / Darwin 24.6.0 / Node v23.7.0 machine as Phase 1–3; single 3-run session per profile (1 warm-up + 3 timed runs), same caveats as Phase 3 — treat deltas as directional, not precise.
|
|
1545
|
+
`pnpm bench --subject <script> --corpus monorepo-docs --runs 3 --record <label>`; recorded to `benchmarks/results/phase4-google-standard.json` / `phase4-google-prose-refresh.json` / `phase4-google-profile.json`.
|
|
1546
|
+
|
|
1547
|
+
- **Markdoc parse cost** (`parseMarkdown` in isolation — no rules, no config validation — flag off vs. flag on, `monorepo-docs` document set, 981 files, `run-recheck-parse.mjs` / `run-recheck-parse-markdoc.mjs`): flag off **2825ms** median (runs 2784/2825/2966ms) vs. flag on **2896ms** median (runs 2864/2896/3101ms) — **+2.5%**.
|
|
1548
|
+
That gap is smaller than the ~240–280ms run-to-run spread on either side, so read it as "no measurable parse-time cost from turning `markdoc: true` on" rather than a precise 2.5% overhead; the number is reported as measured.
|
|
1549
|
+
This is its own baseline row — there is no earlier "parse only, flag off" recording to compare against — and it is deliberately not gated against the ±40% markdownlint-parity budget above, which covers the 53-rule structural comparison and never sets this flag.
|
|
1550
|
+
Measured 2026-08-02 at commit `db8df4378ff`, on the same Apple M2 Max / Darwin 24.6.0 / Node v23.7.0 machine as the phases above; single 3-run session per side.
|
|
1551
|
+
`pnpm bench --subject benchmarks/run-recheck-parse.mjs --corpus monorepo-docs --runs 3 --record <label>` (and the `-markdoc` sibling script for the flag-on side); recorded to `benchmarks/results/markdoc-parse-cost-flag-off.json` / `markdoc-parse-cost-flag-on.json`.
|
|
1319
1552
|
- ✅ **Scalable**: File-first architecture with rule indexing optimizes for large repositories; the same micromark AST backs both markdown-structure rules and prose-scope rules, so combining both rule families costs one parse, not two.
|
|
1320
1553
|
|
|
1321
1554
|
## Dependencies
|
|
@@ -1330,7 +1563,8 @@ Recheck trades a bit of the Phase 1 constant-factor lead for full rule-count par
|
|
|
1330
1563
|
- `string-width` - measures the display width of strings containing wide/ambiguous-width or ANSI-styled characters, for CLI table output alignment
|
|
1331
1564
|
|
|
1332
1565
|
### Optional Peer Dependencies
|
|
1333
|
-
- `nspell` + `dictionary-en` - Hunspell-compatible spell checker (and its bundled English dictionary) backing the `spelling` assertion (see [Spelling Assertions](#spelling-assertions-spelling) above). **Not installed by installing `@redocly/recheck`** — both are declared `optional: true` in `peerDependenciesMeta`, loaded lazily via dynamic `import()` only when a config actually enables `spelling`.
|
|
1566
|
+
- `nspell` + `dictionary-en` - Hunspell-compatible spell checker (and its bundled English dictionary) backing the `spelling` assertion (see [Spelling Assertions](#spelling-assertions-spelling) above). **Not installed by installing `@redocly/recheck`** — both are declared `optional: true` in `peerDependenciesMeta`, loaded lazily via dynamic `import()` only when a config actually enables `spelling`.
|
|
1567
|
+
Run `npm i nspell dictionary-en` to enable it (or just `npm i nspell` if every `spelling` rule supplies its own `dictionary` path).
|
|
1334
1568
|
|
|
1335
1569
|
### Development Dependencies
|
|
1336
1570
|
- `vitest` - Modern testing framework
|
|
@@ -1499,7 +1733,7 @@ The enhanced pattern matching checks patterns against:
|
|
|
1499
1733
|
|
|
1500
1734
|
This allows flexible targeting while maintaining backward compatibility.
|
|
1501
1735
|
|
|
1502
|
-
##
|
|
1736
|
+
## Contribute
|
|
1503
1737
|
|
|
1504
1738
|
Want to add new assertions or improve existing ones?
|
|
1505
1739
|
Check out our **[Contributing Guide](src/rules/CONTRIBUTING.md)** for:
|