| id | 74 |
|---|---|
| title | Directive guide |
| status | ✅ |
| summary | Central guide for all directives and rules with examples, fixability table, placement rules, and nesting behavior. |
Part of the user-model work from plan 73. Sibling plans:
One guide a developer reads to understand every directive and rule without consulting per-rule READMEs. Must also serve Hugo users per #73.
Depends on: plans 75, 76, 77 (guide documents the final syntax, parameter names, and schema composition). Write the guide last so it reflects all changes:
- Plan 75:
{field}replaces{{.field}}in both catalog rows and schema headings. One syntax everywhere. Go templates removed from user-facing surface. - Plan 76:
ratio->words-per-token,max-words->max-words-per-sentence,max-column-width-variance->max-column-width-ratio; "did you mean?" hint for case-mismatched front-matter keys in catalog. - Plan 77: config key
template->schema;<?include?>works in schema files for composition; cycle detection with max depth 10;<?require?>in non-schema files emits a warning.
Blind trials (plan 73) showed six gaps that docs alone can close:
- 4-space indent silently breaks directives (confidence 2.6, no diagnostic emitted).
- Nested directives are undefined (confidence 2.0, nobody could predict behavior).
- Users cannot predict which rules auto-fix (fix confidence 2-3 points lower than check).
<?require?>in a normal file is silently ignored (5/5 flagged as confusing -- looks like it should work anywhere).<?allow-empty-section?>in a template does not propagate to documents using that template (5/5 noted the misleading co-occurrence with## ...).- Templates only enforce headings and front
matter, not directives (2/5 uncertain
whether
<?catalog?>in a template requires documents to also contain one).
Processing instructions (<?...?>) are hidden
by GitHub's Markdown renderer (CommonMark
type-3 HTML blocks). Directives stay invisible
in rendered docs. Generated content between
markers is visible.
- Create use-case guides split by topic:
docs/guides/index.md: guides index with generated catalog of all guide pagesdocs/guides/directives/generating-content.md: catalog and include use cases with examples, placeholder syntax, nesting, and placement rulesdocs/guides/directives/enforcing-structure.md: schema, require, allow-empty-section use cases with composition, schema-vs-normal-file, and optional fieldsdocs/guides/directives/hugo-migration.md: standalone Hugo migration guide with placeholder syntax and schema differencesrule-directory.md: generated catalog of all rules from rule READMEs (project root)
- Add a "see the directive guide" link from each rule README that uses a directive (MDS019, MDS020, MDS021, MDS030).
- Replace embedded rules table in README.md with a link to the rule directory.
- Run
mdsmith fixandmdsmith check .to verify.
-
docs/guides/index.mdexists with generated catalog of guides - Guide covers all four directives with examples
- Rule directory generated from rule READMEs (replaces manual fixability table per review)
- Guide documents 4-space indent footgun
- Guide states nesting is not supported
- Guide documents unified
{field}syntax - Guide has schema-vs-normal-file section
- Guide states
<?require?>is schema-only - Guide states schema directives do not propagate to documents
- Guide documents schema composition via
<?include?> - Guide documents renamed parameters
- Guide has "coming from Hugo" section
- Guide uses
schemanottemplatethroughout - Guide passes
mdsmith check docs/guides/ - Rule READMEs link to the guide
- All tests pass:
go test ./... -
go tool golangci-lint runreports no issues