Skip to content

Report headless files as one section in section mode - #89

Merged
nrynss merged 1 commit into
mainfrom
fix/issue-88-headless-sections
Oct 8, 2026
Merged

nrynss merged 1 commit into
mainfrom
fix/issue-88-headless-sections

Conversation

@nrynss

@nrynss nrynss commented Oct 8, 2026 •

Copy link
Copy Markdown
Owner

Summary

In section mode, a file with no headings is one (no header) chunk covering the body after frontmatter. Its date still comes from git blame on those body lines, so a frontmatter-only edit does not refresh a page that also has body content. A frontmatter-only stub stays in the report. --paragraph-level is unchanged.

The surviving section id is the old first paragraph's id ([]:preamble:1). Later paragraph ids are dropped, and that id's fingerprint and span change.

Closes #88

Checklist

  • gofmt -l . prints nothing
  • go vet ./... passes
  • go test ./... passes
  • Tests added/updated for behavior changes
  • CHANGELOG.md [Unreleased] updated (for user-facing changes)
  • No new external dependencies (stdlib-only core)

Notes for reviewers

Section mode now calls parseHeaderless instead of parseParagraphs. The chunk uses the same frontmatter rules as the preamble: a closed --- or +++ block at the top is skipped unless it is the whole file. Blame lines outside that span are not folded into the date.

Test plan

  • gofmt -l on the touched parser files is empty
  • go test ./internal/parser/ ./internal/analyzer/ ./internal/report/ ./cmd/rustydocs/
  • Confirm a headless Mintlify page reports one (no header) row in section mode and still splits under --paragraph-level

Summary by CodeRabbit

  • Bug Fixes
    • In section mode, files without headings are now grouped into a single “(no header)” section. Leading frontmatter is excluded from the section body; if a file contains only frontmatter, that content is retained.
    • Blank-only files continue to be handled as before. Paragraph mode continues to split headerless files into paragraph chunks, including frontmatter.
    • The resulting section preserves the prior first paragraph’s ID, though its fingerprint and span may change; later paragraph IDs are not retained.

Blank-line splits ran even when paragraph mode was off, so a page with
no headings was counted and dated per paragraph, including frontmatter.
@coderabbitai

coderabbitai Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 5cf57ce9-a4a4-4915-85b4-39f51c5c7a67
📥 Commits

Reviewing files that changed from the base of the PR and between 479e124 and 528bd42.

📒 Files selected for processing (5)
  • CHANGELOG.md
  • CLAUDE.md
  • internal/parser/markdown.go
  • internal/parser/preamble_test.go
  • internal/parser/resolution_test.go

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

Headerless Markdown files now produce one (no header) chunk in section mode. The chunk excludes leading frontmatter unless the file contains only frontmatter. Paragraph mode continues to split headerless files into paragraph chunks, including frontmatter.

Changes

Headerless section parsing

Layer / File(s) Summary
Headerless chunk behavior
internal/parser/markdown.go, internal/parser/preamble_test.go, internal/parser/resolution_test.go, CHANGELOG.md, CLAUDE.md
Section mode creates one (no header) chunk for headerless files. The chunk covers the body after frontmatter, except for frontmatter-only files; blank-only files retain a whole-file chunk. Tests cover chunk lines, logical keys, reusable references, dates, blame history, and unchanged paragraph-mode splitting. The changelog notes the resulting ID, fingerprint, and span changes.

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~12 minutes

Change: Bug fix · Severity of issue fixed: Medium

Merge Risk: ⚪ Minimal · up to 528bd

Headerless files now produce one chunk in section mode, as the linked issue requests. Section IDs for these files change once, which the changelog documents. No merge-blocking risk was identified.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 75.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 8 functions across 3 files. (2 skipped: 2… Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: reporting files without headings as one section in section mode.
Linked Issues check ✅ Passed The pull request addresses the active coding requirements in [#88]. In section mode, headerless files produce one (no header) chunk for content after frontmatter. Frontmatter-only files remain repor…
Out of Scope Changes check ✅ Passed The changed files stay within [#88]. The parser change implements the requested chunking behavior. The parser tests verify the behavior. The changelog and parser architecture documentation describe th…
Full details: Docstring Coverage

Explanation

Docstring coverage is 75.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 8 functions across 3 files. (2 skipped: 2 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

I’m a rabbit; I thump at the page,
One neat chunk now fits on the stage.
Frontmatter stays when it stands all alone,
Paragraph mode keeps its old tone.
I nibble the tests, then hop home.

Comment @coderabbitai help to get the list of available commands.

@nrynss
nrynss merged commit 6755f5d into main Oct 8, 2026
7 checks passed
@nrynss
nrynss deleted the fix/issue-88-headless-sections branch October 8, 2026 15:56
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.

Headless files are split into paragraph chunks in section mode

1 participant