-
Notifications
You must be signed in to change notification settings - Fork 2
Formatting
Jude Payne edited this page Jul 9, 2025
·
4 revisions
The dictim.format namespace exposes one public function, fmt which will clean up and re-format a d2 string.
user=> (use 'dictim.format)
nil
user=> (println d2-messy)
family1: The Jones' {
style: { fill: red;
}; personA: Henrick
personB: Michael
personA -- personB: brothers;}
nil
user=> (println (fmt d2-messy))
family1: The Jones' {
style: {
fill: red
}
personA: Henrick
personB: Michael
personA -- personB: brothers
}
nilfmt can take one keyword argument :tab to set the number of spaces used for an indentation step. The default is 2.
The fmt fuunction is invoked by default on d2 compiled from dicitm.