-
Notifications
You must be signed in to change notification settings - Fork 140
Add support for generating other file extensions in MarkBind Sites #2762
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #2762 +/- ##
==========================================
+ Coverage 61.65% 62.29% +0.63%
==========================================
Files 130 130
Lines 7167 7182 +15
Branches 1480 1580 +100
==========================================
+ Hits 4419 4474 +55
+ Misses 2685 2644 -41
- Partials 63 64 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Generated with Nunjucks variable processing, Configured in `site.json`.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR enhances MarkBind to support generating non-HTML file types (such as .json or .txt) from markdown source files while retaining Nunjucks variable functionality. This allows users to generate dynamic configuration files and other text-based assets using MarkBind's template system.
Key Changes:
- Added optional
fileExtensionproperty to page configurations insite.json - Refactored output path computation in
createPageto normalize paths relative to site root before generating output paths - Modified page generation pipeline to handle non-HTML files by processing only variables and skipping HTML-specific processing (frontmatter, layouts, scripts, Vue SSR)
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
packages/core/src/Site/index.ts |
Added fileExtension to type definitions; refactored createPage to compute output paths based on configured file extension |
packages/core/src/Site/SiteConfig.ts |
Added fileExtension property to SiteConfigPage type |
packages/core/src/Page/index.ts |
Added early return for non-HTML files in generate method; renamed outputPageHtml to writeOutputFile with separate handling for HTML vs non-HTML files |
packages/core/src/Page/PageVueServerRenderer.ts |
Updated method call from outputPageHtml to writeOutputFile |
packages/core/src/Page/PageConfig.ts |
Added documentation comment for template property |
docs/userGuide/syntax/links.md |
Updated documentation to reflect that markdown links are converted to configured output extension |
docs/userGuide/siteJsonFile.md |
Documented the new fileExtension configuration property |
docs/userGuide/addingPages.md |
Added comprehensive section explaining custom file type generation with examples and key limitations |
docs/userGuide/customFileTypes/sampleTxt.md |
Sample text file demonstrating Nunjucks variable usage |
docs/userGuide/customFileTypes/sampleJson.md |
Sample JSON file demonstrating Nunjucks variable usage |
docs/site.json |
Added page configurations for sample custom file type examples |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 12 out of 12 changed files in this pull request and generated 5 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Closes #2761 |
|
Tested, and works as expected e.g., https://git-mastery.github.io/exercises-directory/exercises.json |
What is the purpose of this pull request?
Overview of changes:
Addresses #2761
Enhances by adding functionality for MarkBind to generate other file types while retaining nunjucks variable functionality, i.e. from
.mdfiles into.XXXfiles that might not be.htmlfiles.Summary of Changes
fileExtensionproperty that can be specified insite.json>pages.createPagemethod updated to use the fileExtension to determine output file path.fileExtensionproperty through the build pipeline.outputPageHtmltowriteOutputFileto reflect the new process.Anything you'd like to highlight/discuss:
.mdor.htmllinks.Testing instructions:
Proposed commit message: (wrap lines at 72 characters)
Add support for custom file type generation
Custom file type generation with Nunjucks variable processing
Configured in
site.json.Additionally, add jsdoc and docs for template property
Ensure correct relative file paths, add
fileExtensionpropertyAdd testcase for site.json
...
Checklist: ☑️
Reviewer checklist:
Indicate the SEMVER impact of the PR:
At the end of the review, please label the PR with the appropriate label:
r.Major,r.Minor,r.Patch.Breaking change release note preparation (if applicable):