I know what you’re thinking: another “major” minor release, so quickly?
Yeah… we’re swapping out some of the guts of SilverBullet here, so this warrants the version bump. Honestly, this should have been 100.0, but you know…
This is the one where the template engine SilverBullet is swapped out and no longer using Handlebars.js under the hood. We’d like to thank handlebars for its effort, but everything has to end some day. It’s time to take our destiny into our own hands.
SilverBullet now uses its own custom Template Language that is way, way, way dare I say way more powerful than Handlebars. I put in a lot of effort to ensure backwards compatibility, so unless you did some obscure things in your templates, everything should keep working as is. If not, please reach out on our community and I’ll do my best to support you in this journey that for sure will be worth it.
Trust me, I’m an engineer.
Upgrade note
While the Library/Core library that you (probably) imported previously will keep working (I hope), I would recommend you do another import overwriting the old files. Mainly because many templates have been rebuilt to leverage the new features of our new Template Language and therefore much cleaner. So please follow the installation instructions, and hit “Ok” about 30 times.
So, what’s the fuss all about?
- Soft breaking change:
include
is the new name of the oldtemplate
blocks. Previously, a template block’s primary function was to include an external template or page — that role has now been replaced with Live Templates#Include. If you usedtemplate
blocks in the past, you will see a warning squiggly warning appear suggesting you turn it into aninclude
block, which is functionally equivalent to the oldtemplate.
To fix this across your space, simply replace triple-backticktemplate
with triple-backtickinclude
across all your files and you should be done. That said, SilverBullet will detect if you’re using a legacy syntaxtemplate
blocks and automatically interpret them asinclude
blocks instead so nothing should break. Famous last words. - So, funny story, we’re also instantly deprecating these new
include
blocks and suggest youtemplate
all the things, see Recommended alternative for the rationale behind this insanity. You will ask: “So what is he going to deprecate next? Live Queries? Hahaha!” Honestly, probably yes, because everything those can do, templates do better — basically. But let’s take it slow for now. One step at a time, as my mom says. template
s are the new hotness. The body of atemplate
block is now interpreted as the new and shiny Template Language! This means you get syntax highlighting and (best effort) code completion for all your markdown and template directives endeavors.- The Template Language and Query Language have been unified. It may not have been visible to everybody, but the handlebars syntax and SB’s own query language were different before. No longer.
- The Expression Language used as part of the new Template Language has been significantly expanded. Some notable new features:
- It now supports some basics like a
not
operator, and ternary operator (bla ? true : false
). I know, the level of innovation here is crazy. - It now supports (sub) queries as values, simply wrap any query in
{
and}
and you’re good to go: Expression Language#Queries - It now supports page references as values: Expression Language#Page references
- It now (officially) supports function calls, and while I’ve kept the set of built-in Functions deliberately small for now — this is where the big wins are going to be gained in future releases: Expression Language#Function calls. Let me know in the community what functions you’d like to see. Even the ability to expand the set of functions using JavaScript from within your space is now on the table for future iterations.
- It now supports some basics like a
- This post is not going to do this justice. I recommend you simply (re)read the following pages and check out the examples to have your and start to think what you can do with this:
- Ah yes, you can also still take notes with SilverBullet. That still works. I think.