forked from GitHubMirrors/silverbullet-icalendar
Merge pull request #3 from silverbulletmd/deno
Use the deno-based Silver Bullet plug build
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -1,2 +0,0 @@
|
|||||||
*.plug.json
|
|
||||||
node_modules
|
|
||||||
5
.vscode/settings.json
vendored
Normal file
5
.vscode/settings.json
vendored
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"deno.enable": true,
|
||||||
|
"editor.formatOnSave": true,
|
||||||
|
"deno.config": "deno.jsonc"
|
||||||
|
}
|
||||||
37
README.md
37
README.md
@@ -9,15 +9,40 @@ If you don't know what it is, check its [webpage](https://silverbullet.md), but
|
|||||||
you want me to spoil the fun: it is an extensible note taking app with markdown and plain files at its core
|
you want me to spoil the fun: it is an extensible note taking app with markdown and plain files at its core
|
||||||
(well... there is a bit of magic in there too, but what good it would be without a little magic?)
|
(well... there is a bit of magic in there too, but what good it would be without a little magic?)
|
||||||
|
|
||||||
## Installation
|
## Build
|
||||||
|
To build this plug, make sure you have `plugos-bundle` installed. If not, be sure to have [Deno](https://deno.land) installed first, then run:
|
||||||
|
|
||||||
Open (`cmd+k`) your `PLUGS` note in SilverBullet and add this plug to the list:
|
```shell
|
||||||
|
deno install -f -A --unstable --importmap https://deno.land/x/silverbullet/import_map.json https://deno.land/x/silverbullet/plugos/bin/plugos-bundle.ts
|
||||||
```yaml
|
|
||||||
- https://github.com/Willyfrog/silverbullet-plug-example/releases/download/v0.1/helloworld.plug.json
|
|
||||||
```
|
```
|
||||||
|
|
||||||
Then run the `Plugs: Update` command and off you go!
|
After this, build the plug with
|
||||||
|
|
||||||
|
```shell
|
||||||
|
deno task build
|
||||||
|
```
|
||||||
|
|
||||||
|
Or to watch for changes and rebuild automatically
|
||||||
|
|
||||||
|
```shell
|
||||||
|
deno task watch
|
||||||
|
```
|
||||||
|
|
||||||
|
Then, load the locally built plug, add it to your `PLUGS` note with an absolute path, for instance:
|
||||||
|
|
||||||
|
```
|
||||||
|
- file:/Users/you/path/to/hello.plug.json
|
||||||
|
```
|
||||||
|
|
||||||
|
And run the `Plugs: Update` command in SilverBullet.
|
||||||
|
## Installation
|
||||||
|
If you would like to install this plug straight from Github, make sure you have the `.json` file committed to the repo and simply add
|
||||||
|
|
||||||
|
```
|
||||||
|
- github:user/plugname/plugname.plug.json
|
||||||
|
```
|
||||||
|
|
||||||
|
to your `PLUGS` file, run `Plugs: Update` command and off you go!
|
||||||
|
|
||||||
## What's with all that Lone Ranger quotes
|
## What's with all that Lone Ranger quotes
|
||||||
|
|
||||||
|
|||||||
7
deno.jsonc
Normal file
7
deno.jsonc
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"importMap": "import_map.json",
|
||||||
|
"tasks": {
|
||||||
|
"build": "plugos-bundle --importmap import_map.json hello.plug.yaml",
|
||||||
|
"watch": "plugos-bundle -w --importmap import_map.json hello.plug.yaml"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,7 +1,9 @@
|
|||||||
name: hello-world
|
name: hello-world
|
||||||
version: 0.1
|
version: 0.1
|
||||||
|
imports:
|
||||||
|
- https://get.silverbullet.md/global.plug.json
|
||||||
functions:
|
functions:
|
||||||
helloWorld:
|
helloWorld:
|
||||||
path: "./hello.ts:helloWorld"
|
path: "./hello.ts:helloWorld"
|
||||||
command:
|
command:
|
||||||
name: "Say hello"
|
name: "Say hello"
|
||||||
6
hello.ts
6
hello.ts
@@ -1,4 +1,4 @@
|
|||||||
import { flashNotification } from "@silverbulletmd/plugos-silverbullet-syscall/editor";
|
import { editor } from "$sb/silverbullet-syscall/mod.ts";
|
||||||
|
|
||||||
const loneRangerQuotes = [
|
const loneRangerQuotes = [
|
||||||
"Hi-Yo! Silver",
|
"Hi-Yo! Silver",
|
||||||
@@ -8,5 +8,7 @@ const loneRangerQuotes = [
|
|||||||
];
|
];
|
||||||
|
|
||||||
export async function helloWorld() {
|
export async function helloWorld() {
|
||||||
await flashNotification(loneRangerQuotes[Math.floor(Math.random() * loneRangerQuotes.length)]);
|
await editor.flashNotification(
|
||||||
|
loneRangerQuotes[Math.floor(Math.random() * loneRangerQuotes.length)],
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
7
import_map.json
Normal file
7
import_map.json
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"imports": {
|
||||||
|
"$sb/": "https://deno.land/x/silverbullet@0.1.2/plug-api/",
|
||||||
|
"handlebars": "https://esm.sh/handlebars",
|
||||||
|
"yaml": "https://deno.land/std/encoding/yaml.ts"
|
||||||
|
}
|
||||||
|
}
|
||||||
11574
package-lock.json
generated
11574
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
16
package.json
16
package.json
@@ -1,16 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "hello_world",
|
|
||||||
"version": "0.0.1",
|
|
||||||
"author": "A Lone Ranger",
|
|
||||||
"scripts": {
|
|
||||||
"build": "plugos-bundle --exclude yaml handlebars @lezer/lr -- helloWorld.plug.yaml",
|
|
||||||
"start": "plugos-bundle -w --exclude yaml handlebars @lezer/lr -- helloWorld.plug.yaml"
|
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"@silverbulletmd/plugos-silverbullet-syscall": "^0.0.26",
|
|
||||||
"@silverbulletmd/plugs": "^0.0.26"
|
|
||||||
},
|
|
||||||
"devDependencies": {
|
|
||||||
"@plugos/plugos": "^0.0.26"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user