Files
plainleaf/website/Plugs/Development.md
T
Zef Hemel 822997fd5e Client available upgrade notification
If the server is updated, but the client doesn't match the server
version, a notification will appear instructing the user to reload.
2026-03-10 12:05:33 +01:00

31 lines
1.9 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
The easiest way to get started is to click the “Use this template” on the [silverbullet-plug-template](https://github.com/silverbulletmd/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`).
To compile it, run the build command specified in the plug template repo:
```shell
npm run build
```
For development it’s easiest to simply copy the `.plug.js` file into your space’s `_plug/` folder after it’s built:
```shell
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.
## Debugging
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.
## Distribution
Once you’re happy with your plug, you can distribute it in various ways:
- You can put it on github by simply committing the resulting `.plug.js` file there and instructing users to point to by adding
`- github:yourgithubuser/yourrepo/yourplugname.plug.js` to their `PLUGS` file
- Add a release in your github repo and instruct users to add the release as `- ghr:yourgithubuser/yourrepo` or if they need a specific release `- ghr:yourgithubuser/yourrepo/release-name`
- You need to upload the plug file as asset in the release, with a name matching your repository, e.g, `yourrepo.plug.js`
- If your repository name starts with "silverbullet-", like `silverbullet-foo`, both `silverbullet-foo.plug.js` and `foo.plug.js` asset names will be tried
- You can put it on any other web server, and tell people to load it via https, e.g., `- https://mydomain.com/mypugname.plug.js`.