Skip to content

feat: add an index_head knob for the heading a fresh index gets - #17

Merged
SunsetDrifter merged 1 commit into
mainfrom
feat/index-head
Oct 8, 2026
Merged

SunsetDrifter merged 1 commit into
mainfrom
feat/index-head

Conversation

@SunsetDrifter

Copy link
Copy Markdown
Owner

Summary

Some installs don't commit their generated index, for example when entry titles are private. They recreate it from scratch in every clone, and the first rebuild-index then writes the generic # Index heading, silently replacing the tree's own heading and its do-not-hand-edit guidance.

New extension knob index_head (default None, which keeps # Index): the text written above the generated marker when the index file does not exist yet.

  • An existing index keeps whatever head it already carries; index_head only seeds a missing one.
  • A marker-less index whose only content above a yaml pinning fence is the configured head keeps the fence, matching the existing behavior for the generic head.
  • A non-string value raises ConfigError at configure().

This upstreams a patch a downstream install was carrying locally on its vendored copy, so a plain re-copy of wikilint/ no longer drops the feature.

Test plan

  • TDD: tests/test_index_head.py (fresh head, default unchanged, stable rebuild with no drift, existing head wins, pinning fence preserved, type validation); 3 red before implementation
  • Full suite passes on Python 3.11.14 and 3.14.4 (156 tests)
  • Template lints clean (0 errors)

A tree that does not commit its generated index (its entry titles are
private) recreates the index from scratch in every clone. rebuild-index
then writes the generic "# Index" heading, silently replacing the tree's
own heading and do-not-hand-edit guidance on that first rebuild.

index_head (default None, keeping "# Index") is the text written above
the generated marker when the index does not exist yet. An existing
index keeps whatever head it carries, and a marker-less index holding a
yaml pinning fence under the configured head keeps the fence, as it
already did under the generic one. Non-string values fail at configure().
@SunsetDrifter
SunsetDrifter merged commit 9641fc8 into main Oct 8, 2026
2 checks passed
@SunsetDrifter
SunsetDrifter deleted the feat/index-head branch October 8, 2026 09:16
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.

1 participant