Skip to content

grammars: Highlight inline HTML comments in Markdown - #60211

Open
qrkks wants to merge 1 commit into
zed-industries:mainfrom
qrkks:codex-highlight-inline-markdown-comments
Open

grammars: Highlight inline HTML comments in Markdown#60211
qrkks wants to merge 1 commit into
zed-industries:mainfrom
qrkks:codex-highlight-inline-markdown-comments

Conversation

@qrkks

@qrkks qrkks commented Jul 1, 2026

Copy link
Copy Markdown

Summary

  • highlight inline HTML comments in Markdown with the theme's comment style
  • leave other inline HTML tags unaffected
  • add regression coverage for the Markdown-inline highlight query

Root cause

The Markdown-inline grammar exposes comments and ordinary inline HTML as the same html_tag node. 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 @comment only when an html_tag starts with <!--.

Validation

  • rustup run stable rustfmt --edition 2024 --check crates/grammars/src/grammars.rs
  • git diff --check
  • parsed inline Markdown containing both <!-- hidden note --> and <span>after</span> with the updated query and verified that only the comment received the comment capture

Release Notes:

  • Improved Markdown syntax highlighting for inline HTML comments.

@cla-bot

cla-bot Bot commented Jul 1, 2026

Copy link
Copy Markdown

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'.

@zed-community-bot zed-community-bot Bot added the first contribution the author's first pull request to Zed. NOTE: the label application is automated via github actions label Jul 1, 2026
@qrkks

qrkks commented Jul 1, 2026

Copy link
Copy Markdown
Author

@cla-bot check

@cla-bot cla-bot Bot added the cla-signed The user has signed the Contributor License Agreement label Jul 1, 2026
@cla-bot

cla-bot Bot commented Jul 1, 2026

Copy link
Copy Markdown

The cla-bot has been summoned, and re-checked this pull request!

@qrkks

qrkks commented Jul 1, 2026

Copy link
Copy Markdown
Author

@cla-bot check

@cla-bot

cla-bot Bot commented Jul 1, 2026

Copy link
Copy Markdown

The cla-bot has been summoned, and re-checked this pull request!

@qrkks
qrkks marked this pull request as ready for review July 1, 2026 15:43
@smitbarmase smitbarmase added the area:languages/markdown Markdown markup support label Jul 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:languages/markdown Markdown markup support cla-signed The user has signed the Contributor License Agreement first contribution the author's first pull request to Zed. NOTE: the label application is automated via github actions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants