Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save uupaa/dfb80e9244ce4e2b2d4449a352ec5bc1 to your computer and use it in GitHub Desktop.
Save uupaa/dfb80e9244ce4e2b2d4449a352ec5bc1 to your computer and use it in GitHub Desktop.
Mac VSCode: How to plantUML preview within markdown

Mac VSCode: How to plantUML preview within markdown.

Prepare

$ mkdir -p ~/java
$ cd ~/java
$ brew install maven
$ git clone https://github.com/plantuml/plantuml-server.git
$ cd plantuml-server 
$ export PATH=/opt/apache-maven-3.6.3/bin:$PATH

And VSCode Settings

  1. Install PlantUML and Markdown PDF extensions.
  2. Add PlantUML Settings.
  • ⌘⇧p
  • Select Preferences: Open Settings (JSON)
  • Add setting to settings.json
  "plantuml.render": "PlantUMLServer",
  "plantuml.server": " http://localhost:9999/plantuml",
  "plantuml.commandArgs": [ "-Xmx2g", "-DPLANTUML_LIMIT_SIZE=16384" ],
  1. Choose Allow local content in VSCode warning dialog.

Wakeup local plantUML server

$ cd ~/java/plantuml-server
$ mvn jetty:run -Djetty.port=9999

Preview plantUML

  1. create a new file a.md
' a.md
@startuml
A->B: Hello
@enduml
  1. ⌥d to prerview

Resources:

@moore-automation
Copy link

moore-automation commented Jul 27, 2022

Nice work thanks! Is it worth adding a bash function to simplify the plantuml wakeup?I use the below:

function markdown () {
## Starts plantuml server
cur_dir=$PWD
cd ~/java/plantuml-server
nohup mvn jetty:run -Djetty.port=9999 &
cd $cur_dir
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment