-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Linebreak in $label breaks font relationship styling #255
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
For $techn and $descr we have already a function like $breakDescr($descr, $REL_DESCR_MAX_CHAR_WIDTH) which supports explicit \n too. @startuml
!include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/v2.4.0/C4_Container.puml
Container(a, "A")
Container(b, "B")
Container(c, "C")
Container(d, "D")
Rel(c, d, "Relation1\nRelation2", "LONG\nTECHN", "LONG\nDescription")
@enduml We could add similar for labels too |
Also CC @simonbrowndotje here. |
@Potherca: I have extended it that all It can be tested with my extended branch @startuml
' convert it with additional command line argument -DRELATIVE_INCLUDE="./.." to use locally
!if %variable_exists("RELATIVE_INCLUDE")
!include %get_variable_value("RELATIVE_INCLUDE")/C4_Component.puml
!include %get_variable_value("RELATIVE_INCLUDE")/C4_Deployment.puml
!else
!include https://raw.githubusercontent.com/kirchsth/C4-PlantUML/extended/C4_Component.puml
!include https://raw.githubusercontent.com/kirchsth/C4-PlantUML/extended/C4_Deployment.puml
!endif
Enterprise_Boundary(eb, "Enterprise\nBoundary") {
Person(p1, "Normal\nUser\nLabel", "Description\nLine\nBreak")
Container(c1, "Container\nLabel", "container techn\nwith line break", "Description\nLine\nBreak")
Component(c2, "Component\nLabel", component techn\nwith line break", "Description\nLine\nBreak")
}
System_Ext(s1, "System Label\nWith\nLineBreak", "Description\nLine\nBreak")
Rel_(p1, c1, "A relation\nwith custom direction", "o-DOWN->>")
Rel_(p1, c2, "A relation\nwith custom direction", "and technology\nwith LBs", "o-RIGHT-o")
Rel(c1, c2, "A label\nwith\nline breaks", "and technology\nwith LBs")
Rel(c1, s1, "A linked label\nwith\nline breaks", "and technology\nwith LBs", $link = "http://www.plantuml.com")
Node(n1, "A node label\nwith\nline breaks", "type with\nline break", "description\nwith line break")
Node(n2, "A node label", "PlantUML packages have no automatic line breaks, line breaks are automatically inserted into type", "PlantUML packages have no automatic line breaks, line breaks are automatically inserted into description") {
Container(cInNode, "A container in node")
}
!if %variable_exists("RELATIVE_INCLUDE")
!include %get_variable_value("RELATIVE_INCLUDE")/C4_Dynamic.puml
!else
!include https://raw.githubusercontent.com/kirchsth/C4-PlantUML/extended/C4_Dynamic.puml
!endif
Component(from, "From component")
Component(to, "To component")
Rel_("pre1", from, to, "A custom dynamic relation\nwith custom direction", "o-DOWN->>")
Rel_("pre2", from, to, "A custom dynamic relation\nwith custom direction", "and technology\nwith LBs", "+--+")
Rel(from, to, "A dynamic relation\nwith line break")
@enduml If you like it I can push my local branch and create a PR. Best regards PS.: But I'm still not sure if we should support \n in labels at all. E.g. label is typically a component, class name or (logical) function ... names which have no line breaks at all. I think the only valid reason for a line break in a label is that C4-Stdlib is used as drawing tool and not as modelling tool. |
Great! This makes things more consistent and predictable, I think. Good stuff!
I like! Push that PR! 👍
I think this breaks down into either telling the user how to use the tool or listing to the user how the tool is used. |
Ok, I created the PR |
When a newline/linebreak is present in the
$label
of a relationship, the styling breaks.The user can remedie this by adding the "closing" and "opening" creole markers themselves before and after the newline
**\n**
:But to me, this feels like a hack.
To fix this, we could parse the label to replace
\n
with**\n**
, but that might be more work than its worth.Alternatively, we could use HTML instead of Creole syntax, or employ a stereotype:
The text was updated successfully, but these errors were encountered: