Long text in JSON

0 votes
asked Sep 30, 2022 in Question / help by boshka (3,940 points)
Hi,

is there a way to define max width of the text that is rendered from a JSON string so that the text in the Plantuml output would auto wrap? Like in the example below:

json JSON {

  "text": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."

}
commented Oct 1, 2022 by The-Lu (64,340 points)

Hello B., and all,

See a similar wanted feature here, in order to fix your issue:

Now awaiting implementation,
Regards.

1 Answer

0 votes
answered Oct 9, 2022 by The-Lu (64,340 points)

Hello B., and all,

With last snapshot (~v1.2022.10beta1) and last online version, we can now use:

@startuml
<style>
map {
  MaximumWidth 300
}
</style>
json JSON {
  "text": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."
}
@enduml

Thanks to PlantUML team, yes
Enjoy,
Regards.

commented Oct 10, 2022 by boshka (3,940 points)
thank you for the quick resolution!
commented May 16, 2023 by The-Lu (64,340 points)

Now, you can use `json` style, like:

@startuml
<style>
json {
  MaximumWidth 300
}
</style>
json JSON {
  "text": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat."
}
@enduml

Enjoy.

commented Mar 26 by boshka (3,940 points)
Could you also fix to correctly handle line feeds (and probably other symbols like \t, etc.)? It looks that those are now just get ignored
...