Hi there, I’m new to SilverBullet and am looking to use it for D&D player notes.
I have a page for my campaign, and am trying to create a command to automatically instantiate a Location template at a path relative to my campaign page. The idea is that a “New Location” button will be clicked on the campaign page which will run the command.
When I run this command, the page is created in the correct location, but the template frontmatter is not transformed and is instead placed in full. Example:
I’m trying to achieve something similar and you got me started on the process.
Unfortunately, after some testing and some browsing in the SilverBullet code base. It seems to be by design that the exposed syscall to render a template keeps the full frontmatter from the template instead of keeping only the content from the “child” frontmatter.
As you can see here, a renderTemplate function (different one, unavailable to space-script) uses the template.renderTemplate syscall. However, it does some other operations to extract the frontmatter “child” object before rendering the template using the syscall function.
@zef Would it be possible to expose a different template rendering syscall that process the frontmatter in the same way as Page: From Template does? Manually doing that processing in space-script would work but it seems counterproductive as the required functions already exist in the code base. I’d love to contribute but I’m not proficient in java script unfortunately.
EDIT: I just saw that space-lua seems to be progressing well. So maybe it is something to be included in the Lua API instead?