| id | 242 |
|---|---|
| title | proto.md schemas declare content entries via `<?content?>` |
| status | ✅ |
| summary | A `<?content?>` directive row in a proto.md section body declares the same content entry the inline `content:` list declares, so file-based kinds validate and extract body content instead of projecting empty section objects. |
| model | opus |
| depends-on |
A kind backed by a proto.md file schema validates headings
only. The proto surface cannot express the inline schema's
content: entries. mdsmith extract therefore projects
every section of a proto-based kind as an empty object:
"tagline": {}The inline form of the same section declares
content: [{ kind: paragraph }] and projects
"tagline": { "text": "…" }. This asymmetry forces any
extraction-centric kind onto the inline form. The inline form
cannot root at H1, so such a kind can never combine body
extraction with the # {title} heading sync
(see the
extract guide).
After this plan, a <?content?> directive row in a proto
section body declares one content entry. The directive body
carries the same keys as an inline entry:
# {title}
## Tagline
<?content
kind: paragraph
projection: inline
?>Two directives in one section declare two ordered entries
(text / text-2 keys behave as in the inline form). The
precedent is <?require filename: "…"?>, which already lives
in proto bodies as a directive row.
- The schema-package proto parser
(
internal/schema/parse_file.go) parses the directive into the sameContentslice the inline parser fills. Validation reuses the inline rules (projection: inlineonly onkind: paragraph, …). - MDS020's legacy file-schema parser must skip
<?content?>rows so they are not treated as body-sync template text. Full content validation for proto-based kinds rides the plan-156 parser thatmdsmith extractalready uses. bind:andrequired:keys pass through unchanged.
- Parse
<?content?>rows in the schema-package proto parser into content entries; reject unknown keys and invalid kind/projection combinations at parse time with the same diagnostics as the inline form. - Teach the legacy MDS020 proto parser to skip
<?content?>rows (no body-sync interpretation, no diagnostic). - Wire extraction: a proto-based kind with
<?content?>entries projects body content identically to the equivalent inline schema. Differential test: one schema expressed both ways, byte-identical extract output (modulo root level). - Document the directive in the section-schema reference proto.md section and in the schemas guide; update the inline-vs-proto capability table.
- Revisit the
extract guide
"Frontmatter
titleand the H1" section: the content-entries limit no longer applies; rewrite the trade-off paragraph.
- A proto.md section body may contain
<?content?>directive rows; each declares one content entry with the inline keys (kind,projection,required,bind). -
mdsmith extracton a proto-based kind with declared content projects the same tree as the equivalent inline schema. - MDS020 (legacy path) neither flags nor body-syncs a
<?content?>row. - Invalid directives (unknown kind,
projection: inlineon a code-block,bind: ""on a content entry) fail at config load with the inline form's diagnostics. - Docs updated: section-schema reference, schemas guide capability table, extract guide trade-off paragraph.
- All tests pass:
go test ./... -
go tool golangci-lint runreports no issues
- Expressing
repeat:/sequential:in proto.md (existing limitation, unchanged). - The MDS020 cutover from the legacy parser to the schema-package parser (separate effort; this plan only makes the legacy parser skip the new rows).