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 support for expression-based heading matching in the schema, allowing dynamic validation of Markdown heading structure using boolean expressions. It adds a new
exprfield to heading patterns, updates the validation logic to handle expressions, and expands the documentation and tests to cover these new features. Several internal APIs and utilities were also updated to support expression-based matching.Expression-based heading matching:
exprfield to theHeadingPatternschema, allowing boolean expressions (e.g.,"slug(filename) == slug(heading)") for dynamic heading validation. The schema, JSON schema, and documentation were all updated to describe this new field, available functions, and variables. [1] [2] [3] [4]expr-lang/exprlibrary. The newMatchesHeadingmethod inPatternMatcherhandles expressions, and the builder/validator now passes the document filename for context. [1] [2] [3] [4] [5] [6] [7]Validation logic improvements:
expris present, including improved error messages that show the evaluated expression and variables for easier debugging. [1] [2] [3] [4] [5]Testing:
Internal API consistency:
generateSlugto an exported functionGenerateSlugfor use in expression evaluation and updated all references accordingly. [1] [2] [3]