feat: template generators#1244
Conversation
- update intro page with section on template generators
- add sections on template generators
a9d7cf0 to
da40bfb
Compare
- fix typo in schema template
- update typo in template docs
- fixed property name typo
|
Visit the preview URL for this PR (updated for commit 4644633): https://docusaurus-openapi-36b86--pr1244-bu0qur03.web.app (expires Fri, 16 Jan 2026 17:41:47 GMT) 🔥 via Firebase Hosting GitHub Action 🌎 Sign: bf293780ee827f578864d92193b8c2866acd459f |
|
Thanks @mikemimik! Questions: Would it make sense to rename Could you clarify when to use templateGenerators vs markdownGenerators?
Use markdownGenerators to:
Use templateGenerators to:
Limited flexibility: Template generators take no arguments, so they can only return static templates. Was this intentional? Could passing context be useful for dynamic frontmatter? |
|
Thanks for the well-structured PR and for raising this — the issue is real (inline template strings are hard to override). After review, I don't think the API is the right shape for this. The proposed functions are zero-argument: . A zero-arg function that returns a string is equivalent to just passing the string directly — there's no benefit over accepting in the existing /// options. It adds API surface without adding flexibility. The underlying problem is simpler to fix: today the code always does , which assumes the value is a file path. The fix is to check first: const content = fs.existsSync(template)
? fs.readFileSync(template).toString()
: template;That lets users pass either a file path or an inline template string through the existing option — no new API needed. The one part of this PR worth keeping as a separate refactor: extracting the hardcoded inline template strings out of Closing in favor of the simpler path-or-string fix in the existing options. Happy to review a follow-up PR for the |
Description
Motivation and Context
templateplugin configuration property to be either a string or file path #1243mustachetemplates that are usedHow Has This Been Tested?
demo/packageScreenshots (if appropriate)
Types of changes
Checklist