Tool to re-format the PlantUML code in a consistent manner?

0 votes
asked Nov 15, 2022 in Wanted features by philCryo (140 points)
reshown Nov 15, 2022 by philCryo

Hi there,

I'd like to have a tool / feature that'll re-format the PlantUML code in a consistent manner to make it more readable.

Adding indents, for instance...

The only tool I've found that supports re-format the PlantUML code so far is the Visual Studio Code Plugin...and that botches in sequence diagrams things like:

  • Secondary group labels (moves them to the next line of code...which is syntactically incorrect)
  • `note right` within a group ends up an indent to the right of the `end note`
  • etc.

Help?

commented Jan 18, 2023 by The-Lu (64,340 points)

1 Answer

–1 vote
answered Oct 1, 2023 by Masum
@startuml top_level_dfd

!define RECTANGLE class
!define ENTITY rectangle
!define DATABASE rectangle

!define PROCESS [RECTANGLE]
!define EXTERNAL_ENTITY [ENTITY]
!define DATA_STORE [DATABASE]

EXTERNAL_ENTITY Customers
EXTERNAL_ENTITY "Digital Screens" as DigitalScreens
EXTERNAL_ENTITY Website

Customers --|> PROCESS ParkingManagementSystem
DigitalScreens --|> PROCESS ParkingManagementSystem
Website --|> PROCESS ParkingManagementSystem

PROCESS ParkingManagementSystem {
  PROCESS "Car Detection Process" as CarDetection
  PROCESS "Image Recognition Process" as ImageRecognition
  PROCESS "Analytics & Optimization Process" as AnalyticsOptimization
  DATA_STORE "Parking Data Store"
  DATA_STORE "Customer Data Store"

  Customers --|> CarDetection
  DigitalScreens --|> CarDetection
  Website --|> CarDetection
  CarDetection --|> ParkingDataStore
  CarDetection --|> CustomerDataStore

  CarDetection --|> ImageRecognition
  ImageRecognition --|> ParkingDataStore
  ImageRecognition --|> CustomerDataStore

  ParkingManagementSystem --|> AnalyticsOptimization
  ParkingDataStore --|> AnalyticsOptimization
  CustomerDataStore --|> AnalyticsOptimization
}

@enduml

this code does not work
asked Oct 1, 2023 in Question / help by The-Lu (64,340 points) Support for code that doesn't work
...