mdbook-plantuml 0.4.0

A preprocessor for mdbook which will convert plantuml code blocks into inline SVG diagrams
Documentation

mdBook PlantUML

mdBook preprocessor to render PlantUML code blocks as images in your book.

Usage

First create the preprocessor in your book.toml file:

[book]
authors = ["Dzjengis Khan"]
multilingual = false
src = "src"
title = "mdBook PlantUML preprocessor"

[preprocessor.plantuml]
plantuml-cmd="plantuml.exe"

The above assumes both the mdbook-preprocessor and the plantuml executable are on your path.

Then simply add a PlantUML code block in your book text:

Some text here

```plantuml
@startuml
A --|> B
@enduml
```

Some more text.

The plantuml code block will be replaced an image reference to an SVG image if possible, or png if PlantUML does not support svg for the requested diagram type (i.e. ditaa).

Options

  • plantuml-cmd: Optional command override for PlantUML (defaults to "java -jar plantuml.jar" on Windows and "/usr/bin/plantuml" on Linux). When a URL is provided it is assumed you want to generate the images using a PlantUML server implementation.

Example server configuration

Below is an example server configuration.

You can test your server by appending the URL with "/png/SoWkIImgAStDuGh8ISmh2VNrKT3LhR5J24ujAaijud98pKi1IW80", in this example you'd end up with this URL. When it is working correctly you should see the following image:

[book]
authors = ["Dzjengis Khan"]
multilingual = false
src = "src"
title = "mdBook PlantUML preprocessor"

[preprocessor.plantuml]
plantuml-cmd="http://localhost:8080/plantuml"

Troubleshooting rendering issues

mdBook communicates to the preprocessor using stdio. As a result no log output from the preprocessor is printed to screen. When the preprocessor's markdown error output is insufficient for you it is also to redirect logging to the file ./output.log. by using the command line switch -l. See the config below for an example:

[book]
authors = ["Sytse Reitsma"]
multilingual = false
src = "src"
title = "mdBook E2E test book"

[preprocessor.plantuml]
plantuml-cmd="http://localhost:8080/plantuml"
command = "mdbook-plantuml -l"