Skip to main content

Module section_format

Module section_format 

Source
Expand description

Section-body reduction — the markdown half of the section-format vocabulary (agent-toolbox plan 08).

Reduces a section body to its top-level block sequence with a real CommonMark parser (pulldown-cmark, no default features, GFM tables via the runtime Options flag). A line-scanner disagrees with CommonMark on exactly the constructs agents produce — lazy continuation lines, mixed bullet markers (- then * is two lists), indented code blocks containing - , GFM tables degrading to paragraphs on a malformed delimiter row — and a validator that disagrees with the renderer every agent uses sends repair loops that cannot converge. The parser is the referee.

The reduction carries, per block kind, exactly the material the declaration surface checks: list items (text a renderer shows — lazy continuations joined by a single space), paragraph source lines, table header + row cells. The expression matching itself lives in memstead_schema::content_expr — this module only observes.

Structs§

ReducedBlock
One top-level block of a section body: what it is, where it starts, and the per-kind material the format checks consume.
ReducedSection
The reduced view of one section body.
SetextReservedHeading
A setext heading of depth 1–2 found anywhere in the body. The byte-class line guard (^# / ^## ) cannot see these — only the real parser can — so the reduction reports them for the format-checked-section refusal.
TableRow
One body row of a reduced table.

Enums§

BlockDetail
Per-kind check material.
SectionFormatViolation
One violation of a section’s declared format. The serde shape is the wire details payload of the corresponding refusal code — SECTION_CONTENT_MISMATCH / SECTION_ITEM_PATTERN_MISMATCH / INVALID_TABLE_COLUMNS — plus the reserved-setext case, which rides the pre-existing SECTION_CONTENT_INVALID family.

Functions§

check_section_format
Evaluate one section body against its declared format. Returns every violation in document order (the write path refuses with the first; health reports all). A section declaring no content — or one whose expression failed to compile, which the loader refuses anyway — produces no violations (free-form).
reduce_section
Reduce a section body to its top-level block sequence.