The easiest way to get started is to click the “Use this template” on the silverbullet-plug-template repo.
Generally, every plug consists of a YAML manifest file named yourplugname.plug.yaml
. This file defines all functions that form your plug. To be loadable by SilverBullet, it needs to be compiled into a bundle (ending with .plug.js
).
For this you need to have Deno installed, after which you can run the deno task build
command specified in the plug template repo:
deno task build
For development it’s easiest to simply copy the .plug.js
file into your space’s _plug/
folder after it’s built:
cp myplug.plug.js ~/myspace/_plug/
Within seconds (watch your browser’s JavaScript console), your plug should be picked up both on the server and, synced to your browser and loaded. No need to even reload the page.
Since plugs run in your browser, you can use the usual browser debugging tools. When you console.log
things, these logs will appear in your browser’s JavaScript console.
Once you’re happy with your plug, you can distribute it in various ways:
.plug.js
file there and instructing users to point to by adding
- github:yourgithubuser/yourrepo/yourplugname.plug.js
to their PLUGS
file- ghr:yourgithubuser/yourrepo
or if they need a specific release - ghr:yourgithubuser/yourrepo/release-name
yourrepo.plug.js
silverbullet-foo
, both silverbullet-foo.plug.js
and foo.plug.js
asset names will be tried- https://mydomain.com/mypugname.plug.js
.