How to have monospace font in a rectange?

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


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 (260 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 (230,800 points)

You should try the extended syntax with bracket:

rectangle foo [

""<div class="h-entry">..</div>""

Does it help ?

commented Apr 6, 2018 by kaushalmodi (260 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:
commented Apr 9, 2018 by plantuml (230,800 points)
With last beta
You can have now have:

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

Is this what you are looking for ?
commented Apr 9, 2018 by kaushalmodi (260 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 (260 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: