Configuration file specification

+2 votes
asked Mar 4, 2016 in Wanted features by habdank (420 points)
Dears,

Where I can find specification of the configuration file for the PlantUML?

In the command line options there is mention possibility to use that with "-config" option.

Best regards,

Seweryn.
commented Sep 6, 2016 by joost (100 points)
Hi, I would like to know this as well. I tried using an include file which works when included from the design, but it does not work when passed as a config file.

1 Answer

+2 votes
answered Sep 6, 2016 by plantuml (295,000 points)

It's not very documented nor widely used.
It only works in command line:

Suppose you have the two following files:

test1.txt:
@startuml
Alice->Bob : hello
@enduml



config.txt:
skinparam handwritten true

If you launch the following command:

java -jar plantuml.jar -config config.txt test1.txt

File "config.txt" is automatically included at the very beginning of the diagram.

Does it sound more clear ?

commented Sep 6, 2016 by habdank (420 points)
Hi,

Thanks a lot!

So it can be used as a kind of loader for the "basic" definitions library for the diagrams.

Its cool, because exactly such an options I need to batch-generate documentation from other scripts with common options or diagram definitions.

Best regards,
Seweryn.
commented Jun 13, 2018 by albert (3,520 points)
So basically the configuration file is just a set of plantuml commands that are included at the beginning of each graph.
I think it would be good to have a, small, paragraph in the documentation explaining this.
commented Sep 26, 2019 by valexiev (1,200 points)

So it's just the same as this option?

-I<file>
commented May 11, 2022 by 37_633k0

Hi, I writted some scripts generating puml files in ./puml and a README.md in ./ with links to the .svg plantuml generated. In my case I use

!include ../config.txt

in my main file describing all components. this file is self included by the other .puml files with

!include components.puml

also  all .puml files contains :

@startuml "component_name"

!include components.puml
'some stuff


@enduml

my main components.puml the include to config.txt

and the config.txt file contains puml code but without @startuml and @enduml, like :

skinparam shadowing true
!if %not(%variable_exists("$BGCOLOR"))
!$BGCOLOR = "transparent"
!endif
skinparam backgroundColor $BGCOLOR
!$PRIMARY = "#446e9b"
!$FGCOLOR = $WHITE
skinparam arrow {
    Thickness 3
    Color $PRIMARY
    FontColor $FGCOLOR
}
skinparam defaultFontSize    12


and so on ...

also i ran

java -jar plantuml-1.2022.4.jar "./puml" -tsvg -o "../dist_puml/puml"

that generates svg files that include hyperlinks in the relevant subfolder (I put ../ in the output adress because plantuml.jar wants to create the output inside the input _ ./puml/dist_puml/puml  if i do not, it is not very relevant but I describe)

in this case i do not use -config config.txt also I don't know what is best practices and if it's ok to do so, but I liked the idea to present this alternative

Thank you for your solution, I think I'll use it because I'll soon have to test much parameters/options and then it's handyer to make some different config files and call them with -config option rather than modify all the time files and includes

don't judge me, I'm a nOOb !

...