How to have monospace font in a rectange?

0 votes
asked Apr 6, 2018 in Question / help by kaushalmodi (460 points)

Hello,

It looks like Creole is supported in rectangle names.. so this works:

rectangle "p-name\n\n**Post Entry**"

But I also would like to include monospace fonts in there.. But this doesn't work:

rectangle "p-name\n\n**Post Entry**\n""<div class="h-entry">..</div>"""

I see why this is not working, but also I don't know the correct syntax:

  1. Need to somehow escape the " around h-entry.
  2. Also need to let PlantUML know that the double double-quotes ("") are the Creole monospace markup.

Thank you.

commented Apr 6, 2018 by kaushalmodi (460 points)
I tried escaping "h-entry" as \"h-entry\" and ~"h-entry~", but none worked.

1 Answer

+1 vote
answered Apr 6, 2018 by plantuml (195,460 points)

You should try the extended syntax with bracket:

@startuml
rectangle foo [
p-name

""<div class="h-entry">..</div>""
]
@enduml

http://www.plantuml.com/plantuml/uml/SoWkIImgAStDuIfAJIv9p4lFILLGAj3DIynDZScBoTFI2iWlBb5mpIifgjJIKa9Ib9QVhn3D1L79nQMaP9EIMQQGd9DON6ohbA6R2jAWPAUdPwCF5BTJKkAAvN98pKi1MWG0

Does it help ?

commented Apr 6, 2018 by kaushalmodi (460 points)
edited Apr 6, 2018 by kaushalmodi
Thank you! I have a followup question.. I couldn't figure out how to translate the below to use the extended syntax:

rectangle "**h-entry**\n\nPost Entry\n<div class=h-entry>..</div>" as he #white {
  rectangle "**p-name**\n\nTitle of the post\n<h1 class=p-name>..</h1>" as pn #orchid
}

- I need the nested rectangles
- Need extended syntax for parent and children rectangles too

I am building up from this earlier question: http://forum.plantuml.net/7530/how-to-create-a-diagram-with-unconnected-nested-blocks
commented Apr 9, 2018 by plantuml (195,460 points)
With last beta http://beta.plantuml.net/plantuml.jar
You can have now have:

@startuml
rectangle "**h-entry**\n\nPost Entry\n""<div class="h-entry">..</div>""" as he #white {
  rectangle "**p-name**\n\nTitle of the post\n""<h1 class="p-name">..</h1>""" as pn #orchid
}
@enduml

Is this what you are looking for ?
commented Apr 9, 2018 by kaushalmodi (460 points)
Thanks! That works now! So to summarize, we cannot have a rectangle within a rectangle defined using the extended syntax, correct? Even if so, that's alright, because the above now works.
commented Apr 9, 2018 by kaushalmodi (460 points)
If you present your last snippet as an answer instead of a comment, I can mark this answered using that answer. Thanks again.. Now only the last piece of the puzzle remains.. this one: http://forum.plantuml.net/7537/specify-nested-rectangles-to-be-created-in-vertical-order
...