fix: auto-frontmatter legacy wiki pages#381
Open
Jacob Weyer (JacobWeyer) wants to merge 1 commit into
Open
Conversation
Contributor
|
Thanks Jacob Weyer (@JacobWeyer). Definitely agree with what I'm reading in your PR description. Migration shouldn't be a user concern. Taking a look at your PR! |
Contributor
|
Q about, "keep malformed YAML front matter as a hard failure so ambiguous metadata is not silently rewritten". I'm not sure having a hard failure here was ever the right choice. I think we could have maybe a degraded front matter rather than a hard failure. Something deterministic that maybe we just attempt to pull from the markdown file. Thoughts? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Why
OpenWiki now treats front matter as part of its generated-doc contract: the index synchronizer parses page metadata to render directory indexes, and the write validator warns when new wiki pages omit required OKF fields. That works for fresh pages, but update runs can fail on existing generated docs that predate the front-matter requirement.
Observed failure while running
openwiki@0.2.0against an existing repository wiki:This meant a user had to manually add front matter before OpenWiki could finish indexing. The tool should handle that migration itself.
Behavior
For Markdown files included in wiki indexes:
type: Referencetitlefrom the first H1, or filename fallbackdescriptionfrom the first prose paragraph, or a generic fallbackValidation
pnpm exec vitest run test/index-middleware.test.tspnpm exec vitest run test/frontmatter-validator.test.ts test/index-middleware.test.tspnpm run typecheckpnpm run buildpnpm run lint:checkpnpm test