silverbulletmd / silverbullet

The hackable notebook
https://silverbullet.md
MIT License
2.06k stars 146 forks source link

Templates in snippets not working when executed as command #724

Closed gorootde closed 4 months ago

gorootde commented 4 months ago

Snippets executed as command via command palette do not have access to the page meta information, thus the snippet will render e.g. {{name}} as undefined

Minimal Example: snippet.md

---
    tags: template
    hooks.snippet:
        slashCommand: add-title
        command: Add Title
    frontmatter: |
       thePageName: {{name}}
---

When executing this via slash command everything works as expected. When executing via command palette, it will render thePageName: undefined in frontmatter.

zefhemel commented 4 months ago

Can't easily try this, but does it work when you use {{@page.name}} instead?

gorootde commented 4 months ago

Doesn't work either.