feat: support markdown file as category cover#8
Open
julia-rabello wants to merge 7 commits into
Open
Conversation
- Add categoryCover frontmatter field to FrontMatter interface - When a folder has a single .md with categoryCover: true and subcategories, promote that file's name/slug to the category node and set type to markdown - Flatten degenerate categories (single .md, no subfolders) to plain markdown nodes - Relax schema maxItems constraint on markdown node children to allow cover-backed nodes
…categoryCover as tiebreaker
… file counts correctly
Seven cases covering all cover logic paths: auto cover, degenerate flatten, no cover, explicit cover, conflict warning, multilingual dedup, and pruning survival. Runs via plain node against dist/.
Author
Test resultsAdded Results: 7/7 passed
What the tests checkEach test calls
Subcategories must contain at least one file, the tool prunes empty folders before the cover logic runs. Empty subcategory stubs silently make |
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.
EDU-17534
Adds support for using a markdown file as the cover of a category in the navigation, instead of generating a generic index.
Behavior
Category cover logic is structure-driven and applies automatically based on folder contents:
categoryCoverfrontmatter.md+ subfolders.md, no subfolders.md+ subfolderstype: "category"(no change).md+ subfolderstrueon one file.md+ subfolderstrueon more than one fileWhen a cover is applied, the category node gets
type: "markdown"and itsname/slugare taken from the cover file. Subcategories remain inchildren.Changes
transformer.ts: cover and degenerate-category logic inbuildNavigationNode; markdown nodes preserved throughmergeCategoryNodeListstypes.ts:categoryCover?: booleanadded toFrontMatternavigation.schema.json:markdownnodes can now have non-emptychildren(cover-backed categories)readme.md: new "Category cover pages" section