Can \n, \t, etc. be handled within note texts?

0 votes
asked Aug 5, 2016 in Wanted features by boshka (3,940 points)
For ex

!define NOTE_TEXT Note:\nnew line text\n\tnew line tabulated text

note right

NOTE_TEXT

end note
commented Dec 27, 2016 by boshka (3,940 points)
Hi! Are there any suggestions on this?

1 Answer

0 votes
answered Jan 16, 2017 by plantuml (295,000 points)

When a note is defined on several lines (like your example), \n is not interpreted as carriage return.

When a note is defined on a single line (like in the following example), \n is interpreted as carriage return

@startuml
!define NOTE_TEXT Note:\nnew line text\n\tnew line tabulated text
note right: NOTE_TEXT
@enduml


Does it help you ?

commented Jan 16, 2017 by boshka (3,940 points)
Hi!
Thank you. However, I want to have an ability to indicate \n by passing an argument to the note while the note itself is already multiline

!definelong explain(arg)
   note right
      The explanation is:
      arg
   end note
!enddefinelong

explain(Explanation line 1\nExplanation line 2)
commented Jan 16, 2017 by plantuml (295,000 points)
A workaround could be to have:

!definelong explain(arg)
note right: \nThe explanation is:\n<U+FEFF>arg
!enddefinelong

http://www.plantuml.com/plantuml/uml/SoWkIImgAStDuL9CIKtBp4lDoSzBLqYjACX9pCpJI2nAr-JAooz9LIZAJCyeiLA8oGl9I8L8voMMPERdAMGMMyNasOHgkxcwkTa1rNCffkQb88pYueAPvOgaAGSegs0OauSXPgJ9vG3K3tGF0000

We have to use a ZERO WIDTH NO-BREAK SPACE U+FEFF to separate \n and arg. This solution is really ugly, but maybe it will work for you ?
commented Jan 16, 2017 by boshka (3,940 points)
Ok. Will try. Thank you!
Is there a way to ignore \n in the arg (that is, display nothing where the "\n" is) when rendering note?
...