-
-
Notifications
You must be signed in to change notification settings - Fork 88
Migrate markdown scopes #2043
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Migrate markdown scopes #2043
Conversation
(section | ||
(atx_heading | ||
(_) | ||
heading_content: (_) @name | ||
) @_.removal | ||
(#shrink-to-match! @name "^\\s*(?<keep>.*)$") | ||
) @_.domain |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Huh is it really this simple? I guess I only needed the leading sibling finder for when we were searching for a section heading of a specific level? If so I'd be tempted to just drop support for specific levels; I can't imagine anyone is using that 🤷♂️
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh I guess this is technically wrong. I believe "grand name" would be incorrect, because the domain should include all subheadings
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All the test passed. That was kind of my benchmark.
I would be happy to drop the specific section levels.
I think that is something we can worry about when we try to implement that logic?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Already looks like subsections are nested
(document
(section
(atx_heading
(atx_h1_marker)
heading_content: (inline)
)
(paragraph
(inline)
)
(section
(atx_heading
(atx_h2_marker)
heading_content: (inline)
)
(paragraph
(inline)
)
)
)
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh amazing. I believe all that sibling logic is a holdover from the old markdown parser we used to use then. We should be able to drop most of that and do something much simpler now
Checklist