| .. | ||
| README.md | ||
Examples
Rules stay compact and machine-enforceable; examples live separately to avoid bloating the rule registry.
Goals
-
Provide concrete fixtures for:
- unit tests (lint, autofix, typeset transforms)
- integration tests (render + QA gates)
- documentation (human-readable “why this matters”)
-
Keep examples small (a few lines) and targeted (each example triggers a known set of rules).
Example ID format
EX.<CATEGORY>.<TOPIC>.<NNN>
CATEGORYmust match the category taxonomy (e.g.,PUNCTUATION,NUMBERS,CITATIONS)TOPICis an uppercase short slugNNNis a zero-padded integer (000–999+)
Example:
EX.PUNCTUATION.DASHES.001
Suggested on-disk layout
spec/examples/<category>/EX.<CATEGORY>.<TOPIC>.<NNN>.yamlspec/examples/<category>/fixtures/<name>.md(optional)
Example YAML format (recommended)
Fields:
id(required): example IDrules(required): list of rule IDs the example is meant to exercisebefore(required): inline Markdown or a reference to a fixture fileafter(optional): expected Markdown after autofix (if autofix exists)expected(optional): expected diagnostics/gateslint_errors: array of rule IDs expected as errorslint_warnings: array of rule IDs expected as warningsqa_failures: array of gate keys expected to fail
notes(optional): short human explanation (no book quotes)
Minimal example skeleton:
id: EX.PUNCTUATION.DASHES.001
rules:
- CMOS.PUNCTUATION.DASHES.EM_DASH
before: |
...
after: |
...
expected:
lint_errors:
- CMOS.PUNCTUATION.DASHES.EM_DASH
Test corpus strategy
Maintain a small, curated corpus that triggers:
-
Lint-only issues (AST-level)
- punctuation spacing
- numeral formatting
- heading numbering patterns
- link normalization / unsafe URLs
- citation field completeness
-
Typeset-only issues (token/CSS decisions)
- paragraph indentation patterns
- code block wrapping rules
- table overflow strategies
-
Post-render QA issues (PDF/HTML layout)
- widows/orphans
- stranded headings (keep-with-next)
- overfull lines (especially monospace/code)
- table/caption overflow and clipping
- link wrap incidents (URLs/DOIs split against policy)
Recommended corpus sizing:
- 30–80 fixtures total
- each fixture should target 3–10 rules max
- include “degraded mode” fixtures (intentionally malformed Markdown)