WIP: CLI running of plugs

This commit is contained in:
Zef Hemel
2023-08-04 18:56:55 +02:00
parent de3e385017
commit 3464af0252
35 changed files with 738 additions and 136 deletions
+2 -2
View File
@@ -33,7 +33,7 @@ Example query:
<!-- #query page where name = "Attributes" -->
|name |lastModified |contentType |size|perm|pageAttribute|
|----------|-------------|-------------|----|--|-----|
|Attributes|1690384301337|text/markdown|1591|rw|hello|
|Attributes|1691165890257|text/markdown|1609|rw|hello|
<!-- /query -->
This attaches an attribute to an item:
@@ -57,5 +57,5 @@ Example query:
<!-- #query task where page = "Attributes" and taskAttribute = "hello" -->
|name|done |taskAttribute|page |pos |
|----|-----|-----|----------|----|
|Task|false|hello|Attributes|1352|
|Task|false|hello|Attributes|1355|
<!-- /query -->
+12 -12
View File
@@ -23,18 +23,18 @@ You will notice this whole page section is wrapped in a strange type of block. T
Dont believe me, check this out, heres a list of (max 10) pages in your space ordered by last modified date, it updates (somewhat) dynamically 🤯. Create some new pages and come back here to see that it works:
<!-- #query page select name order by lastModified desc limit 10 -->
|name |
|-------------------------|
|CHANGELOG |
|🔨 Development |
|Server |
|Raspberry Pi Installation|
|STYLES |
|Getting Started |
|Sandbox |
|SETTINGS |
|SilverBullet |
|🔌 Core/Templates |
|name |
|------------------|
|🔌 Directive/Query|
|Attributes |
|Getting Started |
|🔌 Core/Tags |
|🔌 Github |
|🔌 Mattermost |
|🔌 Git |
|🔌 Ghost |
|🔌 Share |
|Install |
<!-- /query -->
That said, the directive used wrapping this page section is `#use` which uses the content of another page as a template and inlines it. Directives recalculate their bodies in two scenarios:
+2 -2
View File
@@ -20,13 +20,13 @@ This consists of two steps (unless Deno is already installed — in which case w
With Deno installed, run:
```shell
deno install -f --name silverbullet -A https://get.silverbullet.md
deno install -f --name silverbullet --unstable -A https://get.silverbullet.md
```
This will give you (and when you use `silverbullet upgrade`) the latest stable release. If you prefer to live on the bleeding edge, you can install using the following command instead:
```shell
deno install -f --name silverbullet -A https://silverbullet.md/silverbullet.js
deno install -f --name silverbullet --unstable -A https://silverbullet.md/silverbullet.js
```
This will install `silverbullet` into your `~/.deno/bin` folder (which should already be in your `$PATH` if you followed the Deno install instructions).
+2 -2
View File
@@ -18,7 +18,7 @@ and be queried:
<!-- #query item where tags = "core-tag" -->
|name |tags |page |pos|
|-------------------------------|--------|------------|---|
|This is a tagged item #core-tag|core-tag|🔌 Core/Tags|486|
|This is a tagged item #core-tag|core-tag|🔌 Core/Tags|493|
<!-- /query -->
and **tags**:
@@ -28,5 +28,5 @@ and **tags**:
And they can be queried this way:
<!-- #query task where tags = "core-tag" render [[template/task]] -->
* [ ] [[🔌 Core/Tags@783]] This is a tagged task #core-tag
* [ ] [[🔌 Core/Tags@804]] This is a tagged task #core-tag
<!-- /query -->
+25 -25
View File
@@ -88,8 +88,8 @@ Example:
<!-- #query data where age > 20 and country = "Italy" -->
|name|age|city |country|page |pos |
|----|--|-----|-----|------------------|----|
|John|50|Milan|Italy|🔌 Directive/Query|3293|
|Jane|53|Rome |Italy|🔌 Directive/Query|3294|
|John|50|Milan|Italy|🔌 Directive/Query|2933|
|Jane|53|Rome |Italy|🔌 Directive/Query|2934|
<!-- /query -->
#### 4.2 Plugs data sources
@@ -156,11 +156,11 @@ For the sake of simplicity, we will use the `page` data source and limit the res
**Result:** Look at the data. This is more than we need. The query even gives us template pages. Let's try to limit it in the next step.
<!-- #query page limit 3 -->
|name |lastModified |contentType |size|perm|
|--------------|-------------|-------------|----|--|
|API |1688987324351|text/markdown|1405|rw|
|Authelia |1688482500313|text/markdown|866 |rw|
|Authentication|1686682290943|text/markdown|1730|rw|
|name |lastModified |contentType |size |perm|
|--|--|--|--|--|
|Authentication |1686682290943|text/markdown|1730 |rw|
|Guide/Deployment/Cloudflare and Portainer|1690298800145|text/markdown|12899|rw|
|Markdown |1676121406520|text/markdown|1178 |rw|
<!-- /query -->
@@ -171,13 +171,13 @@ For the sake of simplicity, we will use the `page` data source and limit the res
**Result:** Okay, this is what we wanted but there is also information such as `perm`, `type` and `lastModified` that we don't need.
<!-- #query page where type = "plug" order by lastModified desc limit 5 -->
|name |lastModified |contentType |size|perm|type|repo |uri |author |
|--|--|--|--|--|--|--|--|--|
|🔌 Directive|1688987324365|text/markdown|2607|rw|plug|https://github.com/silverbulletmd/silverbullet | | |
|🔌 KaTeX |1687099068396|text/markdown|1342|rw|plug|https://github.com/silverbulletmd/silverbullet-katex |github:silverbulletmd/silverbullet-katex/katex.plug.js |Zef Hemel |
|🔌 Core |1687094809367|text/markdown|402 |rw|plug|https://github.com/silverbulletmd/silverbullet | | |
|🔌 Twitter |1685105433212|text/markdown|1266|rw|plug|https://github.com/silverbulletmd/silverbullet-twitter|github:silverbulletmd/silverbullet-twitter/twitter.plug.js|SilverBullet Authors|
|🔌 Mermaid |1685105423879|text/markdown|1096|rw|plug|https://github.com/silverbulletmd/silverbullet-mermaid|github:silverbulletmd/silverbullet-mermaid/mermaid.plug.js|Zef Hemel |
|name |lastModified |contentType |size|perm|type|uri |repo |author |share-support|
|--|--|--|--|--|--|--|--|--|--|
|🔌 Github |1691137925014|text/markdown|2206|rw|plug|github:silverbulletmd/silverbullet-github/github.plug.js |https://github.com/silverbulletmd/silverbullet-github |Zef Hemel|true|
|🔌 Mattermost|1691137924741|text/markdown|3535|rw|plug|github:silverbulletmd/silverbullet-mattermost/mattermost.plug.json|https://github.com/silverbulletmd/silverbullet-mattermost|Zef Hemel|true|
|🔌 Git |1691137924435|text/markdown|1112|rw|plug|github:silverbulletmd/silverbullet-git/git.plug.js |https://github.com/silverbulletmd/silverbullet-git |Zef Hemel| |
|🔌 Ghost |1691137922296|text/markdown|1733|rw|plug|github:silverbulletmd/silverbullet-ghost/ghost.plug.js |https://github.com/silverbulletmd/silverbullet-ghost |Zef Hemel|true|
|🔌 Share |1691137921643|text/markdown|693 |rw|plug| |https://github.com/silverbulletmd/silverbullet | | |
<!-- /query -->
#### 6.3 Query to select only certain fields
@@ -189,13 +189,13 @@ and `repo` columns and then sort by last modified time.
from a visual perspective.
<!-- #query page select name, author, repo where type = "plug" order by lastModified desc limit 5 -->
|name |author |repo |
|name |author |repo |
|--|--|--|
|🔌 Directive| |https://github.com/silverbulletmd/silverbullet |
|🔌 KaTeX |Zef Hemel |https://github.com/silverbulletmd/silverbullet-katex |
|🔌 Core | |https://github.com/silverbulletmd/silverbullet |
|🔌 Twitter |SilverBullet Authors|https://github.com/silverbulletmd/silverbullet-twitter|
|🔌 Mermaid |Zef Hemel |https://github.com/silverbulletmd/silverbullet-mermaid|
|🔌 Github |Zef Hemel|https://github.com/silverbulletmd/silverbullet-github |
|🔌 Mattermost|Zef Hemel|https://github.com/silverbulletmd/silverbullet-mattermost|
|🔌 Git |Zef Hemel|https://github.com/silverbulletmd/silverbullet-git |
|🔌 Ghost |Zef Hemel|https://github.com/silverbulletmd/silverbullet-ghost |
|🔌 Share | |https://github.com/silverbulletmd/silverbullet |
<!-- /query -->
#### 6.4 Display the data in a format defined by a template
@@ -205,11 +205,11 @@ from a visual perspective.
**Result:** Here you go. This is the result we would like to achieve 🎉. Did you see how I used `render` and `template/plug` in a query? 🚀
<!-- #query page where type = "plug" order by lastModified desc limit 5 render [[template/plug]] -->
* [[🔌 Directive]]
* [[🔌 KaTeX]] by **Zef Hemel** ([repo](https://github.com/silverbulletmd/silverbullet-katex))
* [[🔌 Core]]
* [[🔌 Twitter]] by **SilverBullet Authors** ([repo](https://github.com/silverbulletmd/silverbullet-twitter))
* [[🔌 Mermaid]] by **Zef Hemel** ([repo](https://github.com/silverbulletmd/silverbullet-mermaid))
* [[🔌 Github]] by **Zef Hemel** ([repo](https://github.com/silverbulletmd/silverbullet-github))
* [[🔌 Mattermost]] by **Zef Hemel** ([repo](https://github.com/silverbulletmd/silverbullet-mattermost))
* [[🔌 Git]] by **Zef Hemel** ([repo](https://github.com/silverbulletmd/silverbullet-git))
* [[🔌 Ghost]] by **Zef Hemel** ([repo](https://github.com/silverbulletmd/silverbullet-ghost))
* [[🔌 Share]]
<!-- /query -->
PS: You don't need to select only certain fields to use templates. Templates are
+5 -11
View File
@@ -9,8 +9,7 @@ share-support: true
<!-- #include [[https://raw.githubusercontent.com/silverbulletmd/silverbullet-ghost/main/README.md]] -->
# Ghost plug for Silver Bullet
This allows you to publish your pages as [Ghost](https://ghost.org/) pages or
posts. I use it to publish [Zef+](https://zef.plus).
This allows you to publish your pages as [Ghost](https://ghost.org/) pages or posts. I use it to publish [Zef+](https://zef.plus).
## Configuration
@@ -22,9 +21,7 @@ In your `SETTINGS` specify the following settings:
url: https://your-ghost-blog.ghost.io
```
Then, create a Custom Integration (in your Ghost control panel under Settings >
Advanced > Integrations > Add Custom Integration). Enter a name (whatever you
want), then copy the full Admin API Key in your `SECRETS` file, mirroring the
Then, create a Custom Integration (in your Ghost control panel under Settings > Advanced > Integrations > Add Custom Integration). Enter a name (whatever you want), then copy the full Admin API Key in your `SECRETS` file, mirroring the
structure of SETTINGS:
```yaml
@@ -34,10 +31,8 @@ structure of SETTINGS:
## Usage
The plugin hooks into Silver Bullet's
[Share infrastructure](https://silverbullet.md/%F0%9F%94%8C_Share). Therefore to
share a page as either a Ghost page or post, add a `$share` front matter key.
For posts this should take the shape of:
The plugin hooks into Silver Bullet's [Share infrastructure](https://silverbullet.md/%F0%9F%94%8C_Share). Therefore to
share a page as either a Ghost page or post, add a `$share` front matter key. For posts this should take the shape of:
---
$share:
@@ -51,8 +46,7 @@ And for pages:
- ghost:myblog:page:my-page-slug
---
Now, when you {[Share: Publish]} (Cmd-s/Ctrl-s) your post will automatically be
created (as a draft) or updated if it already exists.
Now, when you {[Share: Publish]} (Cmd-s/Ctrl-s) your post will automatically be created (as a draft) or updated if it already exists.
Enjoy!
+18 -9
View File
@@ -7,28 +7,37 @@ author: Zef Hemel
<!-- #include [[https://raw.githubusercontent.com/silverbulletmd/silverbullet-git/main/README.md]] -->
# SilverBullet plug for Git
Very basic in functionality, it assumes you have git configured for push and pull in your space. What it does, roughly speaking:
`Git : Sync`:
* Adds all *.md files in your folder to git
* It commits them with a "Snapshot" commit message
* It `git pull`s changes from the remote server
* It `git push`es changes to the remote server
{[Git: Sync]}:
`Git: Snapshot`:
* Asks you for a commit message
* Commits
- Adds all files in your folder to git
- It commits them with a "Snapshot" commit message
- It `git pull`s changes from the remote server
- It `git push`es changes to the remote server
{[Git: Snapshot]}:
- Asks you for a commit message
- Commits
{[Github: Clone]}:
Clones into your space from a Github repository. This will do authentication based on a [personal access token](https://github.com/settings/tokens).
## Installation
Open your `PLUGS` note in SilverBullet and add this plug to the list:
```
- github:silverbulletmd/silverbullet-git/git.plug.json
- github:silverbulletmd/silverbullet-git/git.plug.js
```
Then run the `Plugs: Update` command and off you go!
## To Build
```shell
deno task build
```
+1 -1
View File
@@ -17,7 +17,7 @@ Provides various integrations with Github:
Open your `PLUGS` note in SilverBullet and add this plug to the list:
```
- github:silverbulletmd/silverbullet-github/github.plug.json
- github:silverbulletmd/silverbullet-github/github.plug.js
```
Then run the `Plugs: Update` command and off you go!
+3 -3
View File
@@ -7,12 +7,12 @@ share-support: true
---
<!-- #include [[https://raw.githubusercontent.com/silverbulletmd/silverbullet-mattermost/main/README.md]] -->
# Mattermost for SilverBullet
# Mattermost for Silver Bullet
This plug provides various integrations with the [Mattermost suite](https://www.mattermost.com) of products. Please follow the installation, configuration sections, and have a look at the example.
Features:
* Integration with [SilverBullet Share](https://silverbullet.md/%F0%9F%94%8C_Share), allowing you to publish and update a page as a post on Mattermost, as well as load existing posts into SB as a page using the {[Share: Mattermost Post: Publish]} (to publish an existing page as a Mattermost post) and {[Share: Mattermost Post: Load]} (to load an existing post into SB) commands.
* Integration with [Silver Bullet Share](https://silverbullet.md/%F0%9F%94%8C_Share), allowing you to publish and update a page as a post on Mattermost, as well as load existing posts into SB as a page using the {[Share: Mattermost Post: Publish]} (to publish an existing page as a Mattermost post) and {[Share: Mattermost Post: Load]} (to load an existing post into SB) commands.
* Access your saved posts via the `mm-saved` query provider
* Unfurl support for posts (after dumping a permalink URL to a post in a page, use the {[Link: Unfurl]} command).
* Boards support is WIP
@@ -46,7 +46,7 @@ In `SECRETS` provide a Mattermost personal access token (or hijack one from your
* `mm-saved` fetches (by default 15) saved posts in Mattermost, you need to add a `where server = "community"` (with server name) clause to your query to select the mattermost server to query.
To make the `mm-saved` query results look good, it's recommended you render your query results with a template. Here is one to start with: you can keep it in e.g., `templates/mm-saved`:
To make the `mm-saved` query results look good, it's recommended you render your query results a template. Here is one to start with, you can keep it in e.g. `templates/mm-saved`:
[{{username}}]({{url}}) in {{#if channelName}}**{{channelName}}**{{else}}a DM{{/if}} at _{{updatedAt}}_ {[Unsave]}:
-1
View File
@@ -11,7 +11,6 @@ Specific implementations for sharing are implemented in other plugs, specificall
<!-- #query page where share-support = true render [[template/page]] -->
* [[🔌 Ghost]]
* [[🔌 Markdown]]
* [[🔌 Collab]]
* [[🔌 Mattermost]]
* [[🔌 Github]]
<!-- /query -->