Conversation
📝 WalkthroughWalkthroughAdds optional heading-level options to section selectors. Grammar changes introduce Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Grade: A- 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
📝 Coding Plan
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment Tip CodeRabbit can generate a title for your PR based on the changes with custom instructions.Set the |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/select/selector.rs`:
- Around line 41-46: The doc for the `level_max` field is inverted: clarify that
`level_max` is an inclusive upper bound on heading depth so a heading with level
n matches when n ≤ level_max; update the example in `selector.rs` to show that
`##` (h2) matches `level_max: 2` and `level_max: 3` but not `level_max: 1`, and
note that if `level_max` is None all levels are allowed; make sure to keep the
field name `level_max` and its Option<u8> semantics unchanged.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 9f053318-9fc1-4f73-9e3a-1b1c5973ef6e
📒 Files selected for processing (8)
src/query/grammar.pestsrc/query/pest.rssrc/query/selector_try_from.rssrc/query/traversal_composites.rssrc/select/sel_section.rssrc/select/selector.rstests/md_cases/bad_queries.tomltests/md_cases/select_sections.toml
|
This looks great, also, if I wanted to just get the headers so that I have a skeleton of an MD file what would you suggest? |
Syntax
Note that mdq always returns the first element that matches, along with all its children. Thus, if you have:
... then
#{1}will return the whole thing, as a single matched entity. The#{1}matches the# Some heading, and then everything else gets brought in with it.In practice, this means that
#{n,}is only useful if headings get defined in the wrong order (h3 before h2 before h1, as in the "preamble" headings in the integ tests on this PR.)Resolves #120.
Breaking changes
Adds fields to
SectionMatcher