Skip to content

VALIDATION-PLANES-16: All three planes in one deterministic order

One validate() merges frontmatter, structure, content, and rule findings and sorts them by line, then col, then plane.

Builds on: VALIDATION-PLANES-15: A cross-cutting docRule over the whole doc

A TypeScript program against the library API; inline comments show the resulting values and behavior.

const { findings } = c.validate(src, { path: "doc.md" });
// sorted by line, then col, then plane:
// [ { id: "doc/always", level: "error" }, // no pos -> first
// { id: "frontmatter/enum", pos: { line: 3 } },
// { id: "structure/section-order", pos: { line: 6 } },
// { id: "content/max-words", pos: { line: 9 } } ]
  • Contract.validate() one-pass merge (src/core/validate.ts)
  • ValidationResult.findings deterministic sort: line -> col -> plane (src/core/validate.ts sortFindings)
  • PLANE_ORDER frontmatter -> structure -> content -> text -> rule (src/core/validate.ts)