gopuml is a CLI tool to compile Plant UML into images and links.
It has support for generating png, svg and txt output either as files or links. gopuml is built in golang and leverages plantuml.com to generate the output.
gopuml can convert this example text into a file or a link, in this example, using the svg formatter.
@startuml Example
Bob -> Alice : hello
@enduml
gopuml build -f svg example/example.puml
gopuml build -f svg --style link example/example.puml
go install github.com/lonnblad/gopuml/cmd/gopuml@v0.2.1
The command used to compile the Plant UML to different formats.
gopuml build [files]
To test the build feature in the gopuml repository:
gopuml build example/example.puml
-
-f, --format
The format to use when compiling the Plant UML, defaults to:
svg
.Supported formatters are:
png
, will format the content as .pngsvg
, will format the content as .svgtxt
, will format the content as .txt
-
--server
The Server URL to use when the style used is
link
, defaults to:https://www.plantuml.com/plantuml
. -
--style
The style to use when compiling the Plant UML, defaults to:
file
.Supported styles are:
file
, will write the formatted content to a filelink
, will write a link to the formatted content to stdoutout
, will write the formatted content to stdout
gopuml supports running a local webserver which will automatically reload the rendered version of the Plant UML as they are updated
gopuml serve [files]
To test the serve feature in the gopuml repository:
gopuml serve example/example.puml
- -p, --port
The port to use to serve the HTML page, defaults to: 8080
.
These examples can be found here.
The source Plant UML.
@startuml Example
Bob -> Alice : hello
@enduml
Compiles example.png.
gopuml build -f png example/example.puml
Compiles example.svg.
gopuml build -f svg example/example.puml
Compiles example.txt.
gopuml build -f txt example/example.puml
┌───┐ ┌─────┐
│Bob│ │Alice│
└─┬─┘ └──┬──┘
│ hello │
│──────────────>│
┌─┴─┐ ┌──┴──┐
│Bob│ │Alice│
└───┘ └─────┘
Generates a link for the example.png.
gopuml build -f png --style link example/example.puml
Generates a link for the example.svg.
gopuml build -f svg --style link example/example.puml
Generates a link for the example.txt.
gopuml build -f txt --style link example/example.puml