Skip to content

feat: support index.md as section file#460

Open
klocke-io wants to merge 1 commit into
gardener:masterfrom
klocke-io:feature/support-index-md-as-section-file
Open

feat: support index.md as section file#460
klocke-io wants to merge 1 commit into
gardener:masterfrom
klocke-io:feature/support-index-md-as-section-file

Conversation

@klocke-io
Copy link
Copy Markdown
Member

@klocke-io klocke-io commented May 20, 2026

Summary

  • Adds proposal to extend docforge's hardcoded _index.md section file detection to also recognize index.md
  • VitePress and other modern SSGs use index.md as section index — currently this bypasses the sectionFile special case in resolveManifestLinks, breaking overlay manifests silently
  • The docsy plugin already handles both names (plugin.go:22), confirming this was a known gap

Motivation

When downstream repos migrate from Hugo to VitePress and rename _index.mdindex.md, docforge no longer auto-generates the section index from frontmatter. Instead it treats it as a normal file, resolves its source, and fetches real content — overwritingl section metadata.

Proposal

Minimal approach: add an isSectionFile(name string) bool helper that matches both _index.md and index.md, update the 5 affected call sites. Full details in the proposal document.

Test plan

  • Review proposal at openspec/changes/support-index-md-as-section-file/proposal.md
  • Discuss approach and approve before implementation

@gardener-prow
Copy link
Copy Markdown

gardener-prow Bot commented May 20, 2026

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign kostov6 for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@gardener-prow gardener-prow Bot added do-not-merge/needs-kind Indicates a PR lacks a `kind/foo` label and requires one. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. cla: yes Indicates the PR's author has signed the cla-assistant.io CLA. labels May 20, 2026
@klocke-io klocke-io force-pushed the feature/support-index-md-as-section-file branch from c490365 to 8818f1b Compare May 20, 2026 08:40
Adds openspec proposal to extend docforge's hardcoded _index.md
section file detection to also recognize index.md, enabling
VitePress-migrated repos to work without reverting renames.
@klocke-io klocke-io force-pushed the feature/support-index-md-as-section-file branch from 089b037 to 4910a0d Compare May 20, 2026 09:16
Copy link
Copy Markdown

@n-boshnakov n-boshnakov left a comment

Choose a reason for hiding this comment

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

Other than some minor comments, the specs sound good to me.

As a side note (see comment), should we also consider adding a way to do the same section file recognition for README.md files? Perhaps as a new feature in the future?

- **WHEN** a manifest node has `file: index.md` and `source: ""`
- **THEN** the resolver SHALL skip source resolution and return nil

#### Scenario: Node with file index.md and a source is NOT a section file
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Should we include the same scenario for a "Node with file _index.md ...", as every other scenario comes in "pairs"?

- **THEN** the resolver SHALL proceed with normal source resolution

#### Scenario: Node with a non-index filename is NOT a section file
- **WHEN** a manifest node has `file: readme.md` and `source: ""`
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Do we actually want to also include "README.md" and "readme.md" as index files as well? Some repositories we ingest use that naming convention instead of "index.md".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla: yes Indicates the PR's author has signed the cla-assistant.io CLA. do-not-merge/needs-kind Indicates a PR lacks a `kind/foo` label and requires one. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants