silverbulletmd / silverbullet

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

Index scripts and styles in templates #828

Closed onespaceman closed 1 week ago

onespaceman commented 3 months ago

Index space-scripts and space-styles in templates, and removes them when rendering

zefhemel commented 3 months ago

Right, I had something like this for a bit, but then reverted it. The reason is that I don't know what the desired behavior is. Does it make sense to remove space scripts from rendered templates? What one could expect to work is creating e.g. a page template that actually generates a space script based on template variables. I don't immediately see use cases for this yet, but I'd expect that to work. What do you think?

onespaceman commented 3 months ago

I was trying to make an widget, which needed a custom function to process the text to a table. It made sense to include the script in the template file instead of separately. For the styles, it's for the future when we can add css classes to blocks. Makes sense to include it along with the widget it styles. Put all these together and it's a mini plug system.