PlantUML

approved

by Johannes Theiner

Generate PlantUML diagrams.

★ 533 stars↓ 168,212 downloadsUpdated 5mo agoMIT

PlantUML Support for Obsidian

libera manifesto

Render PlantUML Diagrams in Obsidian


Demonstration

This plugin uses either the PlantUML Online Server, or a local .jar file for rendering.

You can also host your own server (Docker / JEE / PicoWeb) and specify its address in the settings.

Please note that using the local rendering method is not as performant as using a server.

Usage

Create a fenced codeblock using plantuml as the language. Specify your plantuml code inside. To generate a diagram with higher resolution use plantuml-svg

You can also use plantuml-ascii to generate ASCII Art.

Documentation on Plantuml can be found on plantuml.com

Linking to notes in vault

Since the syntax for weblinks in PlantUML is the same for as for Wikilinks in Obsidian, a special syntax is used: [[[Your other note]]] For the content of such a link refer to the obisidian documentation.

Normal web links are described here

Captions

Turn on Captions below diagrams in the settings to show captions below diagrams like image captions, instead of inside the image.

The PlantUML caption of a diagram is then shown below it, \n starts a new line:

```plantuml
caption Figure 1: Login flow
Bob -> Alice : hello
```

Embedded .puml files show their display text as caption instead: ![[diagram.puml|Figure 1: Login flow]]

Only plain text captions are moved below the diagram. Captions with formatting, links or preprocessor variables, and captions inside blocks or !if branches stay inside the image. The caption is styled with the .puml-caption class. Exported and copied diagrams don't contain it.

Including an .puml file

⚠️ Only works when using local rendering

This works just as describe in the official documentation.

Examples

```plantuml
Bob -> Alice : hello
Alice -> Wonderland: hello
Wonderland -> next: hello
next -> Last: hello
Last -> next: hello
next -> Wonderland : hello
Wonderland -> Alice : hello
Alice -> Bob: hello
```

results in:

```plantuml-ascii
Bob -> Alice : hello
Alice -> Wonderland: hello
Wonderland -> next: hello
next -> Last: hello
Last -> next: hello
next -> Wonderland : hello
Wonderland -> Alice : hello
Alice -> Bob: hello
```

results in:

     ┌───┐          ┌─────┐          ┌──────────┐          ┌────┐          ┌────┐
     │Bob│          │Alice│          │Wonderland│          │next│          │Last│
     └─┬─┘          └──┬──┘          └────┬─────┘          └─┬──┘          └─┬──┘
       │    hello      │                  │                  │               │   
       │──────────────>│                  │                  │               │   
       │               │                  │                  │               │   
       │               │      hello       │                  │               │   
       │               │─────────────────>│                  │               │   
       │               │                  │                  │               │   
       │               │                  │       hello      │               │   
       │               │                  │ ─────────────────>               │   
       │               │                  │                  │               │   
       │               │                  │                  │     hello     │   
       │               │                  │                  │ ──────────────>   
       │               │                  │                  │               │   
       │               │                  │                  │     hello     │   
       │               │                  │                  │ <──────────────   
       │               │                  │                  │               │   
       │               │                  │       hello      │               │   
       │               │                  │ <─────────────────               │   
       │               │                  │                  │               │   
       │               │      hello       │                  │               │   
       │               │<─────────────────│                  │               │   
       │               │                  │                  │               │   
       │    hello      │                  │                  │               │   
       │<──────────────│                  │                  │               │   
     ┌─┴─┐          ┌──┴──┐          ┌────┴─────┐          ┌─┴──┐          ┌─┴──┐
     │Bob│          │Alice│          │Wonderland│          │next│          │Last│
     └───┘          └─────┘          └──────────┘          └────┘          └────┘

Known issues

Not all methods of using PlantUML support all different diagrams. Following are a few known issues.

  • ASCII can only ever generate Sequence diagrams
  • The PicoWeb server does not support clickable links in png diagrams
  • Some languages like chinese are not rendered correctly -> Switch to SVG rendering

Installation

Settings > Community plugins > Community Plugins > Browse and search for PlantUML.

For plugin developers

Search results and similarity scores are powered by semantic analysis of your plugin's README. If your plugin isn't appearing for searches you'd expect, try updating your README to clearly describe your plugin's purpose, features, and use cases.