Skip to content

Use CommonMark parsing for section-header-quality headings - #156

Merged
dacharyc merged 1 commit into
mainfrom
fix/153-commonmark-section-headings
Sep 28, 2026
Merged

dacharyc merged 1 commit into
mainfrom
fix/153-commonmark-section-headings

Conversation

@dacharyc

Copy link
Copy Markdown
Member

Summary

Fixes #153.

  • Replace the Markdown heading regex with the shared CommonMark parser, including setext headings and rendered-text comparison for formatted labels.
  • Ignore heading examples in code and comments while preserving HTML heading extraction, mixed HTML/MDX callout ancestry, and duplicate prevention.
  • Preserve Tab/TabItem wrapper compatibility without requiring blank-line separators. Leave classification thresholds, public result fields, dependencies, and request behavior unchanged.
  • Add 58 regression cases in the existing test file and document which headings count.

Validation

  • Full suite on Node 22.22.0: 1,994 tests passed.
  • Full suite on Node 24.21.0: 1,994 tests passed.
  • Affected heading, tab-detection, and serialization suites: 136 tests passed.
  • npm run lint
  • npm run format:check
  • npm run version:check
  • npm run build

The implementation and tests match the fully validated snapshot. A subsequent documentation-only edit also passed its focused formatting check.

Replace raw Markdown heading scanning with the shared parser while preserving HTML/MDX callout exclusions and existing check results.

Add regression coverage for rendered heading labels, code/comments, mixed panels, line endings, and request invariants.

Fixes #153

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

The score-changing behavior requires the repository-mandated scoring-version update.

Review effort: Balanced
Findings: 1 Medium severity

Open (1)
What changed in this PR

Uses CommonMark parsing to improve section-header-quality accuracy while preserving HTML/MDX behavior.

Changes:

  • Supports rendered Markdown and setext headings.
  • Excludes headings in code, comments, and callouts.
  • Adds regression coverage and documentation.
File Description
src/​checks/​content-structure/​section-header-quality.ts Implements parser-backed heading extraction.
test/​unit/​checks/​section-header-quality.test.ts Adds heading and MDX regressions.
docs/​checks/​content-structure.md Documents measured headings and exclusions.

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

Comment thread src/checks/content-structure/section-header-quality.ts
@dacharyc
dacharyc merged commit 11c2f52 into main Sep 28, 2026
4 checks passed
@dacharyc
dacharyc deleted the fix/153-commonmark-section-headings branch September 28, 2026 14:27
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.

Use CommonMark parsing for section-header-quality Markdown headings

2 participants