Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using plantuml within a markdown document

At the moment I am trying to make a presentation using markdown.

In order to include an UML diagram I want to use PlantUML.

The code is written in the document below. I am of the understanding, that this should work. However it does not.

Of course there is a solution to create the UML diagrams outside separately and include the in markdown. This however would make the document less self contained.

Markdown code

Here is (part of) the code:

---
Previous slide

---

# diagram

```plantuml
@startuml
  class Example {
    - String name
    - int number 
    
    +void getName()
    +void getNumber()
    +String toString()
  }
@enduml
```

---
Next slide

---

This blog post suggests that this should work.

Is there anything I am missing?

like image 224
Heijne Avatar asked Nov 17 '25 03:11

Heijne


2 Answers

Installing 2 additional extensions was required for me to get this to work:

markdown extension pack

markdown plantuml preview

like image 150
WonkoTheSane Avatar answered Nov 18 '25 19:11

WonkoTheSane


If you're using VSCode, you need install extensions:

  1. Markdown Plantuml Preview
  2. Markdown Preview Enhanced

Then download Plantuml Jar

Open VSCode:
Press F1, search and choose Open User Settings
Search markdown-preview-enhanced.plantumlJarPath
Set path for Plantuml Jar
Example: C:\plantuml-gplv2-1.2023.12.jar

Try code and preview:

```plantuml
A -> B: abc
```

Prerequisite: You have installed and set the path for java

like image 31
anphung Avatar answered Nov 18 '25 21:11

anphung



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!