silverbulletmd / silverbullet

The knowledge tinkerer's notebook
https://silverbullet.md
MIT License
2.35k stars 169 forks source link

Feature Request: expose extractSnippetAroundIndex as template function #805

Open schroederc opened 6 months ago

schroederc commented 6 months ago

I'd like to use extractSnippetAroundIndex in some custom templates. Potentially with an extra argument that caps the length of the rendered snippet.

Example usage:

template: |
  {{#if .}}
  # Quick Notes
  {{#each .}}
  * [[{{name}}]]: {{extractSnippetAroundIndex(makeIndex(name, 0))}}
  {{/each}}
  {{/if}}
query: |
  page where name =~ /^Inbox\/{{journalDate(@page.name)}} /