CSS in template

How might I apply CSS to bits of a template? e.g. I have the template below:

---
tags: template
description: Project reference link with meta info as list item
---
* [[{{name}}]] {{status}} {{#if reviewDate}}{{reviewDate}}{{/if}}
  

How might I apply css (either inline or by adding a class or ID) to the #if part?

Thanks

Nick

Unless somebody comes up with a clever CSS hack (I’m no expert), this is not easily supported.

This should make that easier once implemented: Support Live Preview for HTML tags · Issue #702 · silverbulletmd/silverbullet · GitHub

1 Like

One way to hack is to insert $ananchor into the template and use CSS like:

span:has(a[name="ananchor"]) {
  font-style: italic;
}

…etc

3 Likes

There you go! The hacker’s notebook.

1 Like