Macro plantuml

Purpose

Create UML and other diagrams with PlantUML.

Parameter

All parameters are optional.

NameDescription
 type

Type of the diagram. Supported values are:

  • plantuml (default)
  • ditaa
  • dot
  • jcckit
  • salt
 align

Align the diagram. Supported values are:

  • none (default)
  • left
  • center
  • right
 borderBorder size in pixel. Value must be integer > 0.
 hspaceExtra space left and right from the image. Value must be integer > 0.
 vspaceExtra space below and above the image. Value must be integer > 0.
 titleTitle of the diagram, default is none title.
(warning) This is only supported by some diagrams of type plantuml.
dropshadowDrop shadow: 'true' (default), 'false'.
This feature is not supported by all diagram types.
separationSeparation of common edges of shapes in DITAA diagrams: 'true' (default), 'false'
preserve white spacesIf checked no empty line nor white spaces from the beginning of the line or end of the line will be removed anymore. Please note that you can change the default behavior in the (global) plugin configuration.
format

PNG (default)

SVG (beta)

exportName

The graph will be stored as attachment if exportName is given.

(warning) The value of the exportName attribute must be unique on page level scope otherwise the attachments were overwritten on every page view!

(warning) Note that if you update the plugin or the underlying graphviz library this may trigger that a user who is viewing a page will write a new version of the diagram as attachment to the page!

debug

true = Enable debugging.


Sample Code

The body of the macro contains the PlantUML block. The @startuml and @enduml tags are not required.

{plantuml}
state "In Progress" as InProgress
Open -->  InProgress : Start Progress
Open --> Resolved : Resolve Issue
Open --> Closed : Close Issue
InProgress  -up-> Open : Stop Progress
InProgress  --> Resolved : Resolve Issue
InProgress  --> Closed : Close Issue
Resolved  --> Closed : Close Issue
Resolved  --> Reopened : Reopen Issue
Reopened  --> Resolved : Resolve Issue
Reopened  --> Closed  : Close Issue
Reopened  --> InProgress: Start Progress
Closed -up-> Reopened : Reopen Issue
{plantuml}



Include content from attachment or other wiki page

The PlantUML Macro supports the !include directive to include attachments or wiki pages in your diagram. It is not allowed to include files from the filesystem on the server side.

The following link types are supported:

  • ^attachment.ext
  • pagetitle
  • pagetitle^attachment.ext
  • spacekey:pagetitle
  • spacekey:pagetitle^attachment.ext 

In the following example the content of the attachment common.iuml from the current wiki page will be included.

{startuml} 
!include ^common.iuml 
Foo <!-- Bar 
{startuml}

URLs in diagrams

This feature is not supported in sequence and ditaa diagrams.

You can link components of a diagram to other Confluence pages or to external URLs (see sample below). The linkage is still beta since this feature is not officially integrated into the PlantUML library! From version 1.4.2 links can also be written using Confluence markup.

{plantuml}
Internet --|> Space
Space --|> Page
url for Internet is [[http://www.jcoderz.org/fawkez]]
url for Space is [[FOO:Bar]]
url for Page is [Link in Confluence Markup|Home]
{plantuml}


The following list contains all different link notations that can be used inside Confluence:

  • [#anchor] 
  • [pagetitle]
  • [pagetitle#anchor]
  • [spacekey:pagetitle]
  • [spacekey:pagetitle#anchor]
  • [phrase@shortcut]

You can always pass a 'alias' that can be used as link text. To separate the URL from the alias use the pipe symbol '|'.

url for Space is [[FOO:Bar|This is the link text]]
url for Space is [This is the link text|FOO:Bar]

Standard links are enclosed by two brackets instead of Confluence links that are enclosed by only one bracket. If the link starts with a slash '/' like /path/to/file.html or the link contains a protocol like http://www.jcoderz.org than this will not be interpreted as Confluence link and therefore stays untouched.

Embedding Images

It is possible to embed images into a diagram using the creole engine. 

title
<u>Simple</u> communication example
on <i>several</i> lines and using <font color=red>html</font>
This is a local image on the server <img /home/confluence/confluence-5.9/atlassian-confluence-5.9.6/confluence/images/icons/mail.png>
This is the compact syntax <img:http://www.eclipse.org/tptp/images/ico_home.gif>
end title
A -> B: Request
A <-- B: Response

Svek

The default rendering mode for PlantUML diagrams is Svek. The difference between Svek and the old GraphViz rendering mode is illustrated in the following picture:

The 1st diagram left is rendered using the (old) GraphViz mode. The other diagrams are rendered using the (default) Svek rendering mode (w/ and w/o drop-shadow effect and the last one is a SVG image instead of PNG image).

SVG Support

All diagrams are rendered as PNG image by default. You can switch to SVG output format using the "format" macro parameter:

{plantuml:format=SVG}
Foo o-- Bar
{plantuml}

Macro Browser