Skip to content

fix(lint): resolve all 10 YAML blocking errors; support multi-doc YAML streams#7160

Merged
jstirnaman merged 7 commits intomasterfrom
fix/lint-yaml-blocking-errors
May 1, 2026
Merged

fix(lint): resolve all 10 YAML blocking errors; support multi-doc YAML streams#7160
jstirnaman merged 7 commits intomasterfrom
fix/lint-yaml-blocking-errors

Conversation

@jstirnaman
Copy link
Copy Markdown
Contributor

Summary

Fixes all 10 YAML blocking errors flagged by `yarn lint-codeblocks` against `content/`. Keeps the `yaml` fence label everywhere it makes sense.

Validator change

  • `scripts/lib/codeblock-validators/yaml.mjs`: `yaml.load` → `yaml.loadAll`. Single-doc inputs are unaffected (a stream of one); multi-doc inputs (Kubernetes manifests, InfluxDB template manifests) now parse cleanly. Without this, authors of legitimate multi-doc YAML had to relabel the fence and lose syntax highlighting.

Content fixes (yaml fence preserved unless the block is genuinely not yaml)

File Pattern Fix
`content/influxdb3/clustered/reference/release-notes/clustered.md` (3 errors) diff with `+` prefixes / bare `...` and `....` ellipses Relabel diff fence as `diff`; replace ellipses with structured `# ... fields elided ...` comments
`content/influxdb3/enterprise/admin/clustering.md` (3 errors) Three node configs concatenated per fence → duplicate `mode:` keys Add `---` separators between node configs (now valid via the multi-doc support)
`content/kapacitor/v1/reference/event_handlers/alerta.md` (1 error) Genuine bug: `correlate: 'a', 'b'` invalid syntax + duplicate key Fix to list syntax `correlate: ['event1', 'event2']` and remove duplicate line
`content/influxdb/v2/tools/influxdb-templates/_index.md` (1) + `content/telegraf/v1/input-plugins/{kube_inventory,prometheus}/_index.md` (2) Multi-doc YAML No content change — multi-doc support in the validator now lets these parse

Verification

  • `yarn test:lint-codeblocks`: 59/59 pass
  • Re-running `yarn lint-codeblocks` against the affected files: 0 yaml errors remain
  • Spot-check on 50 other files containing ```yaml fences: 0 new errors (no regression from validator change)

Test plan

  • CI passes
  • Spot-check rendered output on the changed files (yaml syntax highlighting preserved; diff highlighting on the relabeled block)

…eams

Validator change:
  scripts/lib/codeblock-validators/yaml.mjs — switch yaml.load to
  yaml.loadAll so YAML streams (multiple documents separated by ---)
  parse cleanly. Kubernetes manifests, InfluxDB template manifests,
  and similar tools commonly emit multi-doc streams; rejecting them
  forced authors to relabel the fence and lose syntax highlighting.

Content fixes (yaml fence preserved):
  content/influxdb3/clustered/reference/release-notes/clustered.md
    - Line 148 fence relabeled yaml → diff (the block is a literal
      diff with + prefixes, not yaml).
    - Line 823 (now 823): replaced bare `...` ellipsis with
      `# ... fields elided ...` comment so indentation stays valid.
    - Line 1747 (now ~1747): replaced bare `....` and inner `...`
      ellipses with structured `# ... fields elided ...` comments.

  content/influxdb3/enterprise/admin/clustering.md
    - Three node-config blocks (Small / Medium / Large cluster) had
      `mode:` defined per node, producing "duplicated mapping key"
      errors because each block was one YAML document. Added `---`
      between node configs so each becomes its own document in the
      stream — matches author intent (per-node configs side by side)
      and parses cleanly.

  content/kapacitor/v1/reference/event_handlers/alerta.md
    - Genuine YAML bug: `correlate: 'event1', 'event2'` is invalid
      syntax, and the very next `correlate:` line was a duplicate
      key. Fixed to `correlate: ['event1', 'event2']` and removed
      the duplicate line that incorrectly assigned service names to
      the correlate key.

Test coverage: 59/59 lint-codeblocks tests still pass; multi-doc
support is exercised implicitly by the now-passing real content.
@jstirnaman jstirnaman requested a review from a team as a code owner April 28, 2026 16:37
@jstirnaman jstirnaman requested review from sanderson and removed request for a team April 28, 2026 16:37
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 28, 2026

Vale Style Check Results

Metric Count
Errors 0
Warnings 9
Suggestions 5
Warnings (9)
File Line Rule Message
content/influxdb3/clustered/reference/release-notes/clustered.md 1139 InfluxDataDocs.Spelling Did you really mean 'ndots'?
content/influxdb3/clustered/reference/release-notes/clustered.md 1143 InfluxDataDocs.Branding Use 'the Querier' instead of 'the querier'
content/influxdb3/clustered/reference/release-notes/clustered.md 1145 InfluxDataDocs.Branding Use 'the Querier' instead of 'the querier'
content/influxdb3/clustered/reference/release-notes/clustered.md 1458 InfluxDataDocs.Spelling Did you really mean 'variabless'?
content/influxdb3/clustered/reference/release-notes/clustered.md 1466 InfluxDataDocs.Spelling Did you really mean 'autoscale'?
content/influxdb3/clustered/reference/release-notes/clustered.md 1468 InfluxDataDocs.Spelling Did you really mean 'configs'?
content/influxdb3/clustered/reference/release-notes/clustered.md 1469 InfluxDataDocs.WordList Use 'import' or 'load' instead of 'ingest'.
content/kapacitor/v1/reference/event_handlers/alerta.md 2 InfluxDataDocs.Spelling Did you really mean 'Alerta'?
content/kapacitor/v1/reference/event_handlers/alerta.md 5 InfluxDataDocs.Spelling Did you really mean 'Alerta'?

Check passed

@github-actions github-actions Bot added product:kapacitor Kapacitor documentation product:v3-distributed InfluxDB 3 Cloud Serverless, Cloud Dedicated, Clustered product:v3-monolith InfluxDB 3 Core and Enterprise (single-node / clusterable) labels Apr 28, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 28, 2026

PR Preview Action v1.4.8
🚀 Deployed preview to https://influxdata.github.io/docs-v2/pr-preview/pr-7160/
on branch gh-pages at 2026-05-01 14:42 UTC

… comments

Per review feedback on #7160, the legacy admin-section example block
contained `- ...` and bare `...` lines used as ellipsis. While the
current YAML parser accepts them (they parse as the string '...'), they
are misleading: a copy-paste of the example would be invalid as actual
config. Replaced with explicit YAML comments that name what was elided.

Also normalized the leading comment from `## ...snip` to a properly
descriptive YAML comment for consistency.
@jstirnaman
Copy link
Copy Markdown
Contributor Author

Merging this to fix the YAML. I'll continue working on diff syntax highlighting in #7178

@jstirnaman jstirnaman merged commit d69aca7 into master May 1, 2026
21 of 22 checks passed
@jstirnaman jstirnaman deleted the fix/lint-yaml-blocking-errors branch May 1, 2026 17:30
github-actions Bot added a commit that referenced this pull request May 1, 2026
jstirnaman added a commit that referenced this pull request May 1, 2026
…ontent (#7178)

* fix(lint): resolve all 10 YAML blocking errors; support multi-doc streams

Validator change:
  scripts/lib/codeblock-validators/yaml.mjs — switch yaml.load to
  yaml.loadAll so YAML streams (multiple documents separated by ---)
  parse cleanly. Kubernetes manifests, InfluxDB template manifests,
  and similar tools commonly emit multi-doc streams; rejecting them
  forced authors to relabel the fence and lose syntax highlighting.

Content fixes (yaml fence preserved):
  content/influxdb3/clustered/reference/release-notes/clustered.md
    - Line 148 fence relabeled yaml → diff (the block is a literal
      diff with + prefixes, not yaml).
    - Line 823 (now 823): replaced bare `...` ellipsis with
      `# ... fields elided ...` comment so indentation stays valid.
    - Line 1747 (now ~1747): replaced bare `....` and inner `...`
      ellipses with structured `# ... fields elided ...` comments.

  content/influxdb3/enterprise/admin/clustering.md
    - Three node-config blocks (Small / Medium / Large cluster) had
      `mode:` defined per node, producing "duplicated mapping key"
      errors because each block was one YAML document. Added `---`
      between node configs so each becomes its own document in the
      stream — matches author intent (per-node configs side by side)
      and parses cleanly.

  content/kapacitor/v1/reference/event_handlers/alerta.md
    - Genuine YAML bug: `correlate: 'event1', 'event2'` is invalid
      syntax, and the very next `correlate:` line was a duplicate
      key. Fixed to `correlate: ['event1', 'event2']` and removed
      the duplicate line that incorrectly assigned service names to
      the correlate key.

Test coverage: 59/59 lint-codeblocks tests still pass; multi-doc
support is exercised implicitly by the now-passing real content.

* fix(clustered/release-notes): replace bare ellipsis placeholders with comments

Per review feedback on #7160, the legacy admin-section example block
contained `- ...` and bare `...` lines used as ellipsis. While the
current YAML parser accepts them (they parse as the string '...'), they
are misleading: a copy-paste of the example would be invalid as actual
config. Replaced with explicit YAML comments that name what was elided.

Also normalized the leading comment from `## ...snip` to a properly
descriptive YAML comment for consistency.

* fix(syntax-highlighting): extend diff highlight to overflowing line content

The .gi (and .gd) classes used `display: block`, which sizes the
highlighted span to the parent's visible width. When a diff line
horizontally overflows the code-block container, the text continues to
the right of the visible area but the green/red background does not —
the right-hand portion of the line renders without any highlight, which
is what the user reported on a clustered release-notes diff fence.

Switch to `display: inline-block` + `min-width: 100%`. inline-block
lets the element grow with content (so it covers the full overflow
width); min-width: 100% keeps the highlight at least as wide as the
visible container for short lines. The combined behavior is the
standard pattern for line-level diff highlights in pre/code blocks.

* fix(syntax-highlighting): stack diff lines and align highlight colors with palette

The previous `display: inline-block` on `.gi`/`.gd` swallowed the
trailing newline inside each chroma diff-line span, collapsing every
diff line onto a single inline row.

Switch to `display: block` + `width: max-content` + `min-width: 100%`:
block restores per-line stacking, max-content lets the highlight grow
with content past the visible area, and min-width keeps short lines
tinted to the right edge.

Replace the hard-coded green/red with palette variables
($gr-rainforest/$gr-viridian, $r-curacao/$r-ruby) and lower the tint
opacity for better readability against the article background.

* test(diff-fence): add render-regression fixtures and assertions

Add four diff fence fixtures to content/example.md (subtractive only,
subtractive with overflow, subtractive with context, mixed additions
and deletions) and matching Cypress assertions in
render-regression.cy.js.

Tests guard against the regression fixed in the prior commit:

- per-row stacking (sibling .gd spans must have distinct top offsets)
- display: block on .gd/.gi
- width: max-content (.gd offsetWidth exceeds parent clientWidth on
  overflowing lines)
- context lines remain untinted

Also extend assertHasHighlightedCodeBlock's selector to include
language-diff so the existing /example/ smoke test covers the new
fixtures.

* fix: resolve code review findings for PR #7178

- Apply Prettier formatting to multi-line .toArray() chain in
  render-regression.cy.js (was unstaged)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

product:kapacitor Kapacitor documentation product:v3-distributed InfluxDB 3 Cloud Serverless, Cloud Dedicated, Clustered product:v3-monolith InfluxDB 3 Core and Enterprise (single-node / clusterable)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant