Added mermaid and KaTeX plugs, updated changelog

pull/229/head
Zef Hemel 2022-12-22 16:47:04 +01:00
parent cca48f66cd
commit 81adc538e5
5 changed files with 108 additions and 1 deletions

View File

@ -9,6 +9,13 @@ release.
* Most areas where you enter text (e.g. the page name, page switcher, command palette and filter boxes) now use a CodeMirror editor. This means a few things:
1. If you have vim mode enabled, this mode will also be enabled there.
2. You can now use the emoji picker (`:party` etc.) in those places, in fact, any plug implementing the `minieditor:complete` event — right now just the emoji picker — will work.
* Added support for plugs to extend fenced code blocks with custom languages and rendering live-preview widgets for them. As a demo of this, have a look at markdown support (mostly for demo purposes):
```markdown
# Header
1. Item 1
2. Item 2
```
Two more plugs are now available that add [[🔌 Mermaid]] and [[🔌 KaTeX]] (LaTeX formula) support using this functionality.
* To keep the UI clean, the dark mode button has been removed, and has been replaced with a command: {[Editor: Toggle Dark Mode]}.
* Bug fix: Long page names in titles now no longer overlap with action buttons.
* Moving focus out of the page title now always performs a rename (previously this only happened when hitting `Enter`).

View File

@ -1,6 +1,6 @@
```
This file lists all plugs that SilverBullet will load. Run the {[Plugs: Update]} command to update and reload this list of plugs.
```yaml
# Insert a list of plugs here, one per line, e.g.
- github:silverbulletmd/silverbullet-git/git.plug.json
```

48
website/🔌 KaTeX.md Normal file
View File

@ -0,0 +1,48 @@
---
type: plug
uri: github:silverbulletmd/silverbullet-katex/katex.plug.json
repo: https://github.com/silverbulletmd/silverbullet-katex
author: Zef Hemel
---
<!-- #include [[https://raw.githubusercontent.com/silverbulletmd/silverbullet-katex/main/README.md]] -->
# Silver Bullet KaTeX plug
## Installation
Run the {[Plugs: Add]} command and paste in: `github:silverbulletmd/silverbullet-katex/katex.plug.json`
That's all!
## Use
Put a latex block in your markdown:
```latex
c = \pm\sqrt{a^2 + b^2}
```
And move your cursor outside of the block to live preview it!
**Note:** [KaTeX](https://katex.org) itself is not bundled with this plug, it pulls the JavaScript, CSS and fonts from the JSDelivr CDN. This means _this plug will not work without an Internet connection_. The reason for this limitation is that it is not yet possible to distribute font files via plugs, and KaTeX depends on specific web fonts.
## Build
Assuming you have Deno and Silver Bullet installed, simply build using:
```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/katex.plug.json
```
And run the `Plugs: Update` command in SilverBullet.
<!-- /include -->

50
website/🔌 Mermaid.md Normal file
View File

@ -0,0 +1,50 @@
---
type: plug
uri: github:silverbulletmd/silverbullet-mermaid/mermaid.plug.json
repo: https://github.com/silverbulletmd/silverbullet-mermaid
author: Zef Hemel
---
<!-- #include [[https://raw.githubusercontent.com/silverbulletmd/silverbullet-mermaid/main/README.md]] -->
# Silver Bullet plug for Mermaid diagrams
This plug adds basic [Mermaid](https://mermaid.js.org/) support to Silver Bullet.
**Note:** The Mermaid library itself is not bundled with this plug, it pulls the JavaScript from the JSDelivr CDN. This means _this plug will not work without an Internet connection_. The reason for this is primarily plug size (bundling the library would amount to 1.1MB). This way Mermaid is only loaded on pages with actual Mermaid diagrams rather than on every SB load.
## Installation
Run the {[Plugs: Add]} command and paste in: `github:silverbulletmd/silverbullet-mermaid/mermaid.plug.json`
That's all!
## Use
Put a mermaid block in your markdown:
```mermaid
flowchart TD
Start --> Stop
```
And move your cursor outside of the block to live preview it!
## Build
Assuming you have Deno and Silver Bullet installed, simply build using:
```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/mermaid.plug.json
```
And run the `Plugs: Update` command in SilverBullet.
<!-- /include -->

View File

@ -33,7 +33,9 @@ These plugs are written either by third parties or distributed separately from t
* [[🔌 Git]] by **Zef Hemel** ([repo](https://github.com/silverbulletmd/silverbullet-github))
* [[🔌 Github]] by **Zef Hemel** ([repo](https://github.com/silverbulletmd/silverbullet-github))
* [[🔌 Graph View]] by **Bertjan Broeksema** ([repo](https://github.com/bbroeksema/silverbullet-graphview))
* [[🔌 KaTeX]] by **Zef Hemel** ([repo](https://github.com/silverbulletmd/silverbullet-katex))
* [[🔌 Mattermost]] by **Zef Hemel** ([repo](https://github.com/silverbulletmd/silverbullet-mattermost))
* [[🔌 Mermaid]] by **Zef Hemel** ([repo](https://github.com/silverbulletmd/silverbullet-mermaid))
* [[🔌 Serendipity]] by **Pantelis Vratsalis** ([repo](https://github.com/m1lt0n/silverbullet-serendipity))
* [[🔌 Twitter]] by **Silver Bullet Authors** ([repo](https://github.com/silverbulletmd/silverbullet-twitter))
<!-- /query -->