feat: add paragraphs rule, top-level paragraph collection, and unknown-key warnings - #76
Merged
Merged
Conversation
…phs slice Use a loose list (blank line between items) in TestParagraphsTopLevelOnly so item content becomes ast.Paragraph with a ListItem parent, genuinely exercising the ast.KindDocument exclusion gate in parser.go. A tight list renders as ast.TextBlock and never hit that gate. Also initialize the Paragraphs slice in the root/heading Section literals in hierarchy.go for consistency with sibling fields.
golangci-lint govet flags reflect.Ptr as an alias that should be inlined to reflect.Pointer.
jackchuka
marked this pull request as ready for review
July 24, 2026 22:52
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds three related features to
mdschema:Parent().Kind() == ast.KindDocument).paragraphssection rule — a new structural rule validating paragraph count constraints (min/max) per section, modeled on the existingwordcountrule..mdschema.ymlcontains keys not recognized by the schema, without rejecting the config.schema.jsonand the generator are updated to reflect the new rule.Changes
internal/parser/— collect top-level paragraphs per section; newParagraphtypeinternal/rules/paragraph.go— newparagraphsstructural rule + testsinternal/schema/warnings.go— unknown-key detection + testsinternal/vast/types.go—Node.Paragraphs()accessorcmd/mdschema/commands/— warnings wired to CLI (stderr)schema.json— regeneratedtestdata/paragraph/+internal/integration/paragraph_test.go— valid/invalid fixturesTesting
go build ./...,go vet ./...,go test ./...— all passmin) casesNotes
Reviewed on-branch; no Critical/Important issues found. Minor follow-up: consider an integration fixture exercising the
maxconstraint (currently only covered by the rules unit test).🤖 Generated with Claude Code