Please provide a way to indent multiline text in class attributes

+1 vote
asked Jul 14, 2018 in Wanted features by Anthony-Gaudino (5,740 points)

This was requested by user adipriyantobpn on an old QA.

Please provide a way to indent multiline text in class attributes.

Example:

@startuml
class foo {
+operatorTypes : array = [
        "<" => [
            0 => "a",
            1 => "b"
        ],
        ">" => [
            0 => "c",
            1 => "e"
        ]
    ]
}
@enduml

Results in:

I would like to have the text in the class indented as in the PlantUML code.

1 Answer

+1 vote
answered Jul 14, 2018 by albert (2,540 points)
edited Jul 15, 2018 by albert

You can use the literal character sequence `\t` i.e. tab character, charcater '\' followed by 't') as explained also in http://forum.plantuml.net/6604/is-there-a-way-to-indent-text-inside-a-shape
So the file will look like:

@startuml
class foo {
+operatorTypes : array = [
\t\t"<" => [
\t\t\t0 => "a",
\t\t\t1 => "b"
\t\t],
\t\t">" => [
\t\t\t0 => "c",
\t\t\t1 => "e"
\t\t]
\t]
}
@enduml

(tested it with PlantUML version 1.2018.09beta6)

...