Skip to content

LogeshG5/silverbullet-plantuml

Repository files navigation

Silver Bullet plug for PlantUML diagrams

This plug adds basic PlantUML support to Silver Bullet.

Installation

Run the {[Plugs: Add]} command and paste in: github:logeshg5/silverbullet-plantuml/plantuml.plug.js

Configuration

There are three types of configuration possible

  1. Remote Server
  2. Local Server
  3. Script

1. Remote Server Configuration

Add this to your SETTINGS.md

plantuml:
  serverurl: https://plantuml.com

This configuration uses the offical PlantUML server to generate the diagram. If you do not want to send the data to PlantUML server check other configuration options.

2. Local Server Configuration

PlantUML needs to be installed in your machine at e.g., /usr/local/bin/plantuml.jar. Ensure you have the JDK installed on your system.

Launch a local PlantUML http server.

java -jar /usr/local/bin/plantuml.jar -picoweb:8080

Add this to your SETTINGS.md

plantuml:
  serverurl: http://localhost:8080

This configuration uses the local PlantUML server to generate the diagram. This doesn't send the data to PlantUML server. You will have to keep the local server running always.

3. Script Configuration

PlantUML needs to be installed in your machine at e.g., /usr/local/bin/plantuml.jar. Ensure you have the JDK installed on your system.

The configured script is run with plantuml data encoded in base64 format as argument.

Create a helper script that decodes the input data and generate diagram. Copy the below contents to a script at e.g., /usr/local/bin/gen_plantuml_svg

Helper scripts for Linux & Windows can be found in scripts directory. Take a note to update the plantuml.jar paths.

#!/bin/bash
echo -e $1 | base64 -d | java -jar /usr/local/bin/plantuml.jar -tsvg -pipe

Make it an executable by running the following command

chmod a+x /usr/local/bin/gen_plantuml_svg

In your SETTINGS.md configure the path to the generator.

plantuml:
  generator: /usr/local/bin/gen_plantuml_svg

This helper script is needed as I couldn't get to call the plantuml.jar directly from this plugin.

Use

Put a plantuml block in your markdown:

```plantuml
@startuml
Alice -> Bob: Hi!
@enduml
```

And move your cursor outside of the block to live preview it!

About

PlantUML support for Silver Bullet

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published