From ebdb7cba6e8f762bf5bce871a76977f29e40b01e Mon Sep 17 00:00:00 2001 From: dacharyc Date: Wed, 22 Apr 2026 21:41:24 -0400 Subject: [PATCH] fix: warnings and callouts should not trigger duplicate section header warnings --- .../section-header-quality.ts | 42 ++- .../checks/section-header-quality.test.ts | 285 ++++++++++++++++++ 2 files changed, 324 insertions(+), 3 deletions(-) diff --git a/src/checks/content-structure/section-header-quality.ts b/src/checks/content-structure/section-header-quality.ts index 82484ec..816b431 100644 --- a/src/checks/content-structure/section-header-quality.ts +++ b/src/checks/content-structure/section-header-quality.ts @@ -1,3 +1,4 @@ +import type { HTMLElement } from 'node-html-parser'; import { parse } from 'node-html-parser'; import { registerCheck } from '../registry.js'; import type { CheckContext, CheckResult, CheckStatus } from '../../types.js'; @@ -23,17 +24,52 @@ interface GroupHeaderAnalysis { const MD_HEADING_RE = /^#{1,6}\s+(.+)$/gm; +const CALLOUT_ROLES = new Set(['alert', 'note', 'status', 'complementary']); + +/** + * Check whether a heading is inside a callout/admonition container rather than + * being a structural section header. Walks up the ancestor chain looking for + * signals: semantic HTML (