Skip to content

fix(plugin-docs-cli): mask inline code before HTML checks - #2840

Merged
sunker merged 2 commits into
mainfrom
eriksundell/plugin-docs-cli-inline-code-mask
Aug 21, 2026
Merged

fix(plugin-docs-cli): mask inline code before HTML checks#2840
sunker merged 2 commits into
mainfrom
eriksundell/plugin-docs-cli-inline-code-mask

Conversation

@sunker

@sunker sunker commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

What this PR does / why we need it:

Angle-bracket placeholder text inside inline code (e.g. <slug> in a URL example) was being flagged as a raw HTML tag, since the no-raw-html check only skipped fenced code blocks, not inline backtick spans. This PR adds a maskInlineCode() helper that neutralizes inline code spans before the HTML-tag regex runs.

Also adds a new unfilled-section-brief validation rule that fails strict validation if a page still contains a scaffolded <!-- section-brief:start --> marker, so an unfilled documentation stub can never ship silently.

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

Both issues were found while manually testing the panel-docs codemod (#2834) against a real plugin.

@sunker sunker changed the title fix(plugin-docs-cli): mask inline code before HTML checks; flag unfilled stubs fix(plugin-docs-cli): mask inline code before HTML checks Aug 20, 2026
@sunker
sunker marked this pull request as ready for review August 20, 2026 13:37
@sunker
sunker requested a review from a team as a code owner August 20, 2026 13:37
@sunker
sunker requested review from Ukochka, academo and oshirohugo and a lite review from Copilot and removed request for a team August 20, 2026 13:37

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.

Pull request overview

This PR improves @grafana/plugin-docs-cli validation correctness and content completeness checks by preventing inline-code placeholders (e.g., <slug>) from being misinterpreted as raw HTML, and by adding a rule to catch unfilled scaffolded documentation stubs before publishing.

Changes:

  • Add maskInlineCode() and apply it to the raw-HTML tag detector so inline backtick spans don’t trigger false positives.
  • Introduce a new strict-mode validation rule (unfilled-section-brief) to fail (or warn in non-strict mode) when scaffold markers remain in docs pages.
  • Add unit tests covering inline-code masking behavior and stub-marker detection.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
packages/plugin-docs-cli/src/validation/types.ts Adds the new unfilled-section-brief rule identifier to the shared rule registry.
packages/plugin-docs-cli/src/validation/rules/utils.ts Introduces maskInlineCode() helper for neutralizing inline code span contents on a line.
packages/plugin-docs-cli/src/validation/rules/utils.test.ts Adds unit tests validating maskInlineCode() behavior across common inline-code patterns.
packages/plugin-docs-cli/src/validation/rules/stub-content.ts Adds a new rule runner to detect leftover section-brief:start scaffold markers in markdown pages.
packages/plugin-docs-cli/src/validation/rules/stub-content.test.ts Adds coverage for stub-content detection, strict vs non-strict severity, line numbers, and multi-file behavior.
packages/plugin-docs-cli/src/validation/rules/markdown.ts Updates matching logic to optionally mask inline code before running specific regex checks (used for raw HTML).
packages/plugin-docs-cli/src/validation/rules/markdown.test.ts Adds regression tests ensuring inline-code placeholders don’t trigger no-raw-html, while real HTML still does.
packages/plugin-docs-cli/src/validation/rules/index.ts Registers the new checkStubContent rule in the rule runner pipeline.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread packages/plugin-docs-cli/src/validation/rules/markdown.ts
Comment thread packages/plugin-docs-cli/src/validation/rules/stub-content.ts
@grafana-catalog-project-bot grafana-catalog-project-bot Bot moved this from 📬 Triage to 🔬 In review in Grafana Catalog Team Aug 20, 2026
@mckn
mckn self-requested a review August 21, 2026 06:28
@sunker
sunker enabled auto-merge (squash) August 21, 2026 06:56

@mckn mckn left a comment

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.

LGTM! Left two nits/questions

}

const lines = raw.split('\n');
for (let i = 0; i < lines.length; i++) {

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.

Is it any value in running these lines in the getCodeBlockLines or maskInlineCode? I'm asking since the other rules seems to use those functions to check for code.


const lines = raw.split('\n');
for (let i = 0; i < lines.length; i++) {
if (!SECTION_BRIEF_START_RE.test(lines[i])) {

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.

Do we also need to verify that there is an end block? Or will this fail if it is missing?

@sunker
sunker merged commit 3cd0785 into main Aug 21, 2026
33 checks passed
@sunker
sunker deleted the eriksundell/plugin-docs-cli-inline-code-mask branch August 21, 2026 08:56
@github-project-automation github-project-automation Bot moved this from 🔬 In review to 🚀 Shipped in Grafana Catalog Team Aug 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: 🚀 Shipped

Development

Successfully merging this pull request may close these issues.

3 participants