Skip to content

DIALECT-09: Require an anchor with a contract

A declared section anchor emits structure/anchor-missing when no matching ^id resolves.

Builds on: DIALECT-02: Anchor a section, read it from .anchors

Commands, code, and output together; comments mark which is which.

summary.contract.yaml
mcVersion: 1
kind: contract
body:
sections:
- section: Summary
anchor: summary # a ^summary must resolve in this section
$ markdown-contract validate --contract summary.contract.yaml --path notes
# error structure/anchor-missing section 'Summary' is missing required block-id ^summary
  • declarative contract section.anchor
  • structure/anchor-missing rule
  • validate CLI --contract/--path