From c2b2aeca6febe5eace94d009a3ff13edf5fca0bb Mon Sep 17 00:00:00 2001 From: Zef Hemel Date: Fri, 16 Dec 2022 16:45:29 +0100 Subject: [PATCH] 0.2.4 release + Mattermost plug doc update --- website/CHANGELOG.md | 2 +- website/🔌 Mattermost.md | 66 ++++++++++++++++++++++------------------ website/🔌 Share.md | 1 + 3 files changed, 39 insertions(+), 30 deletions(-) diff --git a/website/CHANGELOG.md b/website/CHANGELOG.md index b44eba3..af1a78c 100644 --- a/website/CHANGELOG.md +++ b/website/CHANGELOG.md @@ -3,7 +3,7 @@ release. --- -## Next +## 0.2.4 * Vim mode is here! This mode can be enabled on a per-client basis (its state is stored in the browser). To toggle Vim mode on or off use the {[Editor: Toggle Vim Mode]} command. * Security update: SB now binds to `127.0.0.1` by default, allowing just connections via `localhost`. To allow outside connections, pass the `--hostname 0.0.0.0` flag (and ideally combine it with a `--user username:password` flag to add basic authentication). diff --git a/website/🔌 Mattermost.md b/website/🔌 Mattermost.md index 68a6fbb..958f06e 100644 --- a/website/🔌 Mattermost.md +++ b/website/🔌 Mattermost.md @@ -3,11 +3,19 @@ type: plug uri: github:silverbulletmd/silverbullet-mattermost/mattermost.plug.json repo: https://github.com/silverbulletmd/silverbullet-mattermost author: Zef Hemel +share-support: true --- -# Mattermost plug for Silver Bullet -This plug provides a few query providers to query data from some of the [Mattermost suite](https://www.mattermost.com) of products. Please follow the installation, configuration sections, and have a look at the example. +# 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 [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 ## Installation Open your `PLUGS` note in SilverBullet and add this plug to the list: @@ -19,52 +27,52 @@ Open your `PLUGS` note in SilverBullet and add this plug to the list: Then run the `Plugs: Update` command and off you go! ## Configuration -When using the `mm-saved` query provide, you need two bits of configuration to make this plug work. In `SETTINGS` provide the `mattermostUrl` and `mattermostDefaultTeam` settings, they default to the following: +In `SETTINGS` provide the `mattermost` key with a `url` and `defaultTeam` for each server (you can name them arbitrarily): ```yaml - mattermostUrl: https://community.mattermost.com - mattermostDefaultTeam: core + mattermost: + community: + url: https://community.mattermost.com + defaultTeam: core + silverbullet: + url: https://silverbullet.cloud.mattermost.com + defaultTeam: main ``` -In `SECRETS` provide a Mattermost personal access token (or hijack one from your current session): +In `SECRETS` provide a Mattermost personal access token (or hijack one from your current session) for each server: ```yaml - mattermostToken: your-token + mattermost: + community: 1234 + silverbullet: 1234 ``` -To make this 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}}]({{desktopUrl}}) in **{{channelName}}** at {{updatedAt}} {[Unsave]}: +## Query sources + +* `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 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]}: {{prefixLines (substring message 0 300 " ... (More)") "> "}} --- -Note that the `{[Unsaved]}` "button" when clicked, will unsave the post automatically 😎 - -If you use the `mm-boards` query provider, you do not need any configuration of secrets. - -## Query sources - -* `mm-saved` fetches (by default 15) saved posts in Mattermost -* `mm-board` fetches all cards from a Mattermost board exposed via a public share URL (obtained via Share > Publish > Publish to Web > Copy Link) via an `url =` filter (see example below) - -## Commands - -* `Convert post to note` fetches a post by passing its permalink and adds it to a note. If the note doesn't exist, it creates a new one. -* `Unfurl: permalink` available while positioning the caret on top of a mattermost permalink related to the configured url, will fetch the post contents. - -## Example +Note that the `{[Unsave]}` button when clicked, will unsave the post automatically 😎 Example use of `mm-saved` (using the `template/mm-saved` template above): - + -Example use of `mm-board`: +## Posting to a channel - - - +You can use the {[Share: Mattermost Post: Publish]} command to publish the current page to a channel. You will be prompted to select the server and channel to post to. A `$share` key will be injected into frontmatter after the initial post. Subsequent post edits can be published via the standard {[Share: Publish]} command. + +## Loading a post into SB + +Using the {[Share: Mattermost Post: Load]} command you can load an existing post into your space. All you need for this is to have the Mattermost authentication configured as described above. You will be prompted for a post permalink and a page to save it to. If you are the author of the post, the `$share` frontmatter will also be set up so you can change the page and push changes back into Mattermost. diff --git a/website/🔌 Share.md b/website/🔌 Share.md index e324e38..a689367 100644 --- a/website/🔌 Share.md +++ b/website/🔌 Share.md @@ -11,5 +11,6 @@ Specific implementations for sharing are implemented in other plugs, specificall * [[🔌 Markdown]] * [[🔌 Collab]] +* [[🔌 Mattermost]] * [[🔌 Github]]