Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR implements support for consuming defaults configuration from _config.yml, addressing issue #19. The implementation allows users to define default front matter values for pages and posts based on path and type scopes, following Jekyll's defaults pattern.
Key Changes
- Added
getDefaults()function to apply default values from_config.ymlto pages during the templating process - Added
typeproperty to Post and Page parsers to enable type-based default matching - Updated highlight.js API usage to accommodate breaking changes in v11
- Refactored test suite structure with new unit tests organized by functionality
Reviewed Changes
Copilot reviewed 16 out of 34 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| lib/writers/templated.js | Implements getDefaults() function for applying defaults from config; refactored to use async/await pattern and fs/promises |
| lib/parsers/post.js | Added type property to distinguish between 'posts' and 'drafts' |
| lib/parsers/page.js | Added type property set to 'pages'; fixed URL generation for markdown files |
| lib/highlight.js | Updated highlight.js API call from old highlight(lang, code) to new highlight(code, { language }) format |
| test/unit/site.test.js | New unit tests for Site class, including test coverage for defaults feature |
| test/unit/parsers/post.test.js | New unit tests for post parsing functionality |
| test/unit/parsers/page.test.js | New unit tests for page parsing functionality |
| test/unit/writers/templated.test.js | New unit tests for templated writer |
| test/unit/liquid.test.js | Updated import path to match new test directory structure |
| test/site.test.js | Removed old test file as functionality moved to unit tests |
| test/fixture/defaults/* | New test fixture demonstrating defaults feature with layouts and scoped defaults |
| test/fixture/basic/* | New basic test fixture for core functionality testing |
| package.json | Updated test script to run tests recursively |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Contributor
Merged
* Initial plan * Fix typo in test comment: mattter → matter Co-authored-by: cyjake <252317+cyjake@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: cyjake <252317+cyjake@users.noreply.github.com>
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.
fixes #19