grammars: Highlight inline HTML comments in Markdown - #60211
Conversation
|
We require contributors to sign our Contributor License Agreement, and we don't have @qrkks on file. You can sign our CLA at https://zed.dev/cla. Once you've signed, post a comment here that says '@cla-bot check'. |
|
@cla-bot check |
|
The cla-bot has been summoned, and re-checked this pull request! |
|
@cla-bot check |
|
The cla-bot has been summoned, and re-checked this pull request! |
|
Hi! Just checking in on this small Markdown grammar fix. Is this approach still aligned with the current direction for Markdown highlighting in Zed? Happy to adjust anything if needed. Thanks! |
MrSubidubi
left a comment
There was a problem hiding this comment.
Mind sharing a before-after, please? I had a look now and highlighting worked as I'd expect it for me, so would like to be sure to not just see the test (thanks for adding that upfront) but also a visual before-after
|
Thanks for checking, and good catch! I took another look and found that #61212, which was merged after this PR was opened, now handles inline HTML tags through HTML grammar injection and includes coverage for inline and multiline HTML comments. I also noticed that it initially used the same direct @comment capture as this PR before switching to the more general injection-based approach. That explains why highlighting already works on the current main. This PR has therefore been superseded, so I’ll close it. Thanks for the review! |
|
No problem, appreciate you checking in on this! |
Summary
Root cause
The Markdown-inline grammar exposes comments and ordinary inline HTML as the same
html_tagnode. The existing highlight query did not distinguish comments by their source text, so<!-- ... -->received no comment capture inside paragraphs.This change adds a query predicate that applies
@commentonly when anhtml_tagstarts with<!--.Validation
rustup run stable rustfmt --edition 2024 --check crates/grammars/src/grammars.rsgit diff --check<!-- hidden note -->and<span>after</span>with the updated query and verified that only the comment received thecommentcaptureRelease Notes: