feat: support merging frontmatter with tp.file.include#1698
feat: support merging frontmatter with tp.file.include#1698AndyEveritt wants to merge 10 commits intoSilentVoid13:masterfrom
tp.file.include#1698Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds support for merging frontmatter when using tp.file.include, enabling nested templates to contribute their frontmatter to the final output. This is a continuation of PR #1643 with improved backwards compatibility for current_functions_object.
Changes:
- Adds frontmatter tracking and merging throughout the template parsing pipeline
- Refactors internal functions to use a stack-based approach for function object management
- Implements frontmatter extraction and merging for included templates
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/core/Templater.ts | Adds frontmatter field to RunningConfig, implements function object stack management, and integrates frontmatter merging into template parsing and file operations |
| src/core/functions/internal_functions/file/InternalModuleFile.ts | Modifies generate_include to extract and merge frontmatter from included files, returning only content without frontmatter |
| src/core/functions/internal_functions/InternalFunctions.ts | Refactors module lifecycle to create new module instances per template parse instead of reusing them, enabling proper per-template state management |
| tests/main.test.ts | Updates test configuration to include the new required frontmatter field |
| docs/documentation.toml | Updates documentation for tp.file.include to describe the frontmatter merging behavior |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
Is there any obstacles preventing this PR to be finally merged ? |
|
I'm not sure why it isn't being merged tbh. I've made a release so you can just install that in your Obsidian repo if you want to use it. It's what I've been doing since September and it has been working fine for me on desktop and mobile |
|
I did a test with the example from #1695 and it still isn't working with your changes, I get an empty object instead of a populated functions object and it fails. |
Same as #1643 but changed the backwards compatibility of
current_functions_objectto be identical to previous behaviour