Styling a multi-line string with legacy HTML formatting

0 votes
asked Oct 28, 2020 in Bug by Leo
Is it possible to style a multi-line string with legacy HTML? For example, this doesn't work:

I would like this to look like this:

Is this unintended behavior (bug) or is there an alternative way of doing this (not including the approach of manually altering the tags)?

1 Answer

0 votes
answered Oct 28, 2020 by The-Lu (67,000 points)

Hello L.,

A possible workaround is to put only the begin tag <size:10> as:

On one-line as:

usecase "<size:10>Line one\n<size:10>Line two"

[See on PlantUML server]

or directly on multi-line:

usecase U0 [
<size:10>Line one
<size:10>Line two

[See on PlantUML server]

Or don't use html but use of stereotype:

hide stereotype
skinparam UsecaseFontSize<<medium>> 10
usecase "Line one\nLine two" <<medium>>
usecase "Normal Line one"

[See on PlantUML server]

If that can help,

commented Oct 29, 2020 by Leo
I need this styling to be a part of the sequence message text, like this:

I was hoping to create a procedure to create this type of message, having the method name and argument list as separate procedure arguments, like this:

This, however doesn't allow me to pass in the list of method arguments as multi-line string because styling it would require styling each individual line before calling the procedure, so I'm afraid the first two approaches don't work for me.

As for the last one, I suppose I cannot define a stereotype with this kind of complex styling (first line bold and normal font size, all other normal and small font size)?


commented Oct 30, 2020 by The-Lu (67,000 points)

Hello L.,

That's good and your 'replace' function is a good example of preprocessing procedure.yes

Here is another workaround, simpler:

If all the messages of sequence are on the same kind, or if the 'Method name' is without newline, you can inverse the size:

  • put all the text on small font size (10), with the global parameter "skinparam ArrowFontSize 10".
  • and put only the 'Method name' with normal font size (14).wink

Without procedure:

skinparam ArrowFontSize 10
A -> B : **<size:14>Method name**\nkey1: value1\nkey2: value2

[See on PlantUML server]

With procedure:

skinparam ArrowFontSize 10

!unquoted procedure call($source, $destination, $method, $arguments)
  $source -> $destination : **<size:14>$method**\n$arguments

call(A, B, "Method name", "key1: value1\nkey2: value2")

[See on PlantUML server]

If that can help,