Older
labs / tiddlers / system / macros / $__ou_macros_pudiagram.tid tags:$:/tags/Macro
title: $:/ou/macros/pudiagram type: text/vnd.tiddlywiki \define pudiagram(pucode, codeHeader:"PlantUML code:") [[plantuml[$pucode$]]] <p>$codeHeader$</p> [[plantuml class="plaintext hljs code" edit="false" output="src" [$pucode\$]]]
\end

A macro for rendering both a PlantUML diagram and the code for the diagram from a single code block.

Usage:

plaintext
<<pudiagram
"""
@startuml
a -> b: stuff
@enduml
"""
>>


Note the triple-double quotes.  These are necessary to handle speech marks and stereotypes in the code.

Produces:

<<pudiagram
"""
@startuml
a -> b: stuff
@startuml
"""
>>

If you want to change the heading that appears between the diagram and the code, then use the codeHeader parameter:

plaintext
"""
@startuml
a -> b: stuff
@enduml
"""
>>


Produces: