feat(rule): add count constraint #36
Merged
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.
This pull request introduces a new
countfeature to the schema structure, enabling schema authors to specify minimum and maximum occurrences for sections or headings in Markdown documents. The implementation includes schema changes, validation logic, documentation updates, and new integration tests. This provides much more flexibility for validating documents with repeated or optional sections (like step-by-step guides).Schema and Validation Enhancements:
countfield (withminandmaxconstraints) to theStructureElementin the schema, allowing sections to be matched multiple times and validated independently. [1] [2] [3] [4] [5]countconstraint. [1] [2] [3]Validation Logic and Engine Updates:
countconstraints, including checking for too few or too many matches and ensuring content rules apply to each match. [1] [2] [3]Documentation and Example Updates:
README.mdand example schema/tutorials to demonstrate and explain the newcountfeature for repeated sections, replacing previous workarounds. [1] [2] [3] [4]Testing:
countconstraints, including tests for valid, too few, too many, and content-rule violations within repeated sections.