Skip to content

Don't count # comments in code blocks as the SKILL.md title - #918

Open
JYunth wants to merge 2 commits into
NVIDIA:mainfrom
JYunth:fix/body-heading-code-fence
Open

JYunth wants to merge 2 commits into
NVIDIA:mainfrom
JYunth:fix/body-heading-code-fence

Conversation

@JYunth

@JYunth JYunth commented Nov 26, 2026

Copy link
Copy Markdown

Summary

The body_heading check looked for any line starting with "# ", so a comment in a code block (e.g. # install dependencies in a bash example) passed as the skill's title. A skill with no title didn't get flagged. This parses the body with markdown-it, which is already a dependency, and only counts a real level-1 heading.

Added tests for # lines in fenced code, indented code and HTML comments, plus one where a real title is still found after commented code.

Verification

  • I am familiar with the Contributing Guidelines
  • Added or updated focused tests
  • Updated documentation for user-visible changes
  • Ran make lint
  • Ran make test
  • Ran make build
  • Did not add credentials, private datasets, or proprietary benchmark content

Release Impact

  • No user-visible release note needed
  • Updated CHANGELOG.md

…md title

The body_heading check matched any line starting with '# ', so a shell or
Python comment inside a fenced code block (or a '#' line in an HTML
comment) satisfied it. A SKILL.md with no title then skipped the only HIGH
body finding. Parse the body with markdown-it and require a non-empty ATX
level-1 heading instead.

Signed-off-by: JYunth <jyunth28@gmail.com>
Copilot AI balanced review requested due to automatic review settings November 26, 2026 15:08

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

tokens = _BODY_PARSER.parse(body)
return any(
token.type == "heading_open"
and token.tag == "h1"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P2] Require the H1 to be at document level

MarkdownIt also emits an h1 token for a heading nested inside a blockquote or list item. With > # Report example as the only H1, both validate --tiers 1 --checks schema and tier1 --checks schema exit 0 on this commit. The base exits 1 and reports the high-severity body_heading finding. I verified the same outcome for a heading nested in a list item.

Please require token.level == 0 and add a nested-heading regression alongside the fenced-code cases. The top-level H1 and fenced-comment controls already behave as intended on this commit.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, thanks. Added the token.level == 0 check and blockquote and list-item cases to the test. > # Report example now fails validate --tiers 1 --checks schema and tier1 --checks schema again.

Signed-off-by: JYunth <jyunth28@gmail.com>
Copilot AI balanced review requested due to automatic review settings November 27, 2026 05:48

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants