feat: support index.md as section file#460
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
c490365 to
8818f1b
Compare
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.
089b037 to
4910a0d
Compare
n-boshnakov
left a comment
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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: ""` |
There was a problem hiding this comment.
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".
Summary
_index.mdsection file detection to also recognizeindex.mdindex.mdas section index — currently this bypasses thesectionFilespecial case inresolveManifestLinks, breaking overlay manifests silentlyplugin.go:22), confirming this was a known gapMotivation
When downstream repos migrate from Hugo to VitePress and rename
_index.md→index.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) boolhelper that matches both_index.mdandindex.md, update the 5 affected call sites. Full details in the proposal document.Test plan
openspec/changes/support-index-md-as-section-file/proposal.md