diff --git a/Makefile b/Makefile
index 3dc88576..fa43cc4f 100644
--- a/Makefile
+++ b/Makefile
@@ -55,6 +55,7 @@ test_plantuml: test
document_test_cases: test_plantuml
python3 util/generate_test_cases_docs.py
+ python3 util/format_svg.py docs/test_cases/*.svg
clanguml_diagrams: debug
mkdir -p docs/diagrams
diff --git a/docs/test_cases/t00002_class.svg b/docs/test_cases/t00002_class.svg
index 9af0b1d9..63e03bea 100644
--- a/docs/test_cases/t00002_class.svg
+++ b/docs/test_cases/t00002_class.svg
@@ -1,67 +1,85 @@
-
\ No newline at end of file
+
diff --git a/docs/test_cases/t00003_class.svg b/docs/test_cases/t00003_class.svg
index e5fc59cf..48241701 100644
--- a/docs/test_cases/t00003_class.svg
+++ b/docs/test_cases/t00003_class.svg
@@ -1,46 +1,70 @@
-
\ No newline at end of file
+
diff --git a/docs/test_cases/t00004_class.svg b/docs/test_cases/t00004_class.svg
index e673475c..baf5ccb3 100644
--- a/docs/test_cases/t00004_class.svg
+++ b/docs/test_cases/t00004_class.svg
@@ -1,46 +1,55 @@
-
\ No newline at end of file
+
diff --git a/docs/test_cases/t00005_class.svg b/docs/test_cases/t00005_class.svg
index 6e548328..8adb2e51 100644
--- a/docs/test_cases/t00005_class.svg
+++ b/docs/test_cases/t00005_class.svg
@@ -1,112 +1,147 @@
-
\ No newline at end of file
+
diff --git a/docs/test_cases/t00006_class.svg b/docs/test_cases/t00006_class.svg
index cc402db1..08005a56 100644
--- a/docs/test_cases/t00006_class.svg
+++ b/docs/test_cases/t00006_class.svg
@@ -1,160 +1,215 @@
-
\ No newline at end of file
+
diff --git a/docs/test_cases/t00007_class.svg b/docs/test_cases/t00007_class.svg
index 616fa5f8..4e78c6cc 100644
--- a/docs/test_cases/t00007_class.svg
+++ b/docs/test_cases/t00007_class.svg
@@ -1,44 +1,51 @@
-
\ No newline at end of file
+
diff --git a/docs/test_cases/t00008_class.svg b/docs/test_cases/t00008_class.svg
index ab9cfcdc..9ea74662 100644
--- a/docs/test_cases/t00008_class.svg
+++ b/docs/test_cases/t00008_class.svg
@@ -1,54 +1,76 @@
-
\ No newline at end of file
+
diff --git a/docs/test_cases/t00009_class.svg b/docs/test_cases/t00009_class.svg
index ae6fd8b0..6c28d9fd 100644
--- a/docs/test_cases/t00009_class.svg
+++ b/docs/test_cases/t00009_class.svg
@@ -1,56 +1,76 @@
-
\ No newline at end of file
+
diff --git a/docs/test_cases/t00010_class.svg b/docs/test_cases/t00010_class.svg
index 03bd89fc..ca16e0e4 100644
--- a/docs/test_cases/t00010_class.svg
+++ b/docs/test_cases/t00010_class.svg
@@ -1,52 +1,70 @@
-
\ No newline at end of file
+
diff --git a/docs/test_cases/t00011_class.svg b/docs/test_cases/t00011_class.svg
index 67d574c1..c26f4fc1 100644
--- a/docs/test_cases/t00011_class.svg
+++ b/docs/test_cases/t00011_class.svg
@@ -1,38 +1,47 @@
-
\ No newline at end of file
+
diff --git a/docs/test_cases/t00012_class.svg b/docs/test_cases/t00012_class.svg
index 77b37438..b4f026b4 100644
--- a/docs/test_cases/t00012_class.svg
+++ b/docs/test_cases/t00012_class.svg
@@ -1,90 +1,133 @@
-
\ No newline at end of file
+
diff --git a/docs/test_cases/t00013_class.svg b/docs/test_cases/t00013_class.svg
index c6c989a1..b68e16ff 100644
--- a/docs/test_cases/t00013_class.svg
+++ b/docs/test_cases/t00013_class.svg
@@ -1,110 +1,148 @@
-
\ No newline at end of file
+
diff --git a/docs/test_cases/t00014_class.svg b/docs/test_cases/t00014_class.svg
index 461ae116..8cfdf0b9 100644
--- a/docs/test_cases/t00014_class.svg
+++ b/docs/test_cases/t00014_class.svg
@@ -1,102 +1,150 @@
-
\ No newline at end of file
+
diff --git a/docs/test_cases/t00015_class.svg b/docs/test_cases/t00015_class.svg
index 48ecd9ce..ed1cc348 100644
--- a/docs/test_cases/t00015_class.svg
+++ b/docs/test_cases/t00015_class.svg
@@ -1,43 +1,48 @@
-
\ No newline at end of file
+
diff --git a/docs/test_cases/t00016_class.svg b/docs/test_cases/t00016_class.svg
index ed7797a1..5707acb9 100644
--- a/docs/test_cases/t00016_class.svg
+++ b/docs/test_cases/t00016_class.svg
@@ -1,53 +1,68 @@
-
\ No newline at end of file
+
diff --git a/docs/test_cases/t00017_class.svg b/docs/test_cases/t00017_class.svg
index 5be5275c..163ffe65 100644
--- a/docs/test_cases/t00017_class.svg
+++ b/docs/test_cases/t00017_class.svg
@@ -1,110 +1,135 @@
-
\ No newline at end of file
+
diff --git a/docs/test_cases/t00018_class.svg b/docs/test_cases/t00018_class.svg
index 76cdd262..6d09b37a 100644
--- a/docs/test_cases/t00018_class.svg
+++ b/docs/test_cases/t00018_class.svg
@@ -1,43 +1,58 @@
-
\ No newline at end of file
+
diff --git a/docs/test_cases/t00019_class.svg b/docs/test_cases/t00019_class.svg
index 11452e5d..5ff485e8 100644
--- a/docs/test_cases/t00019_class.svg
+++ b/docs/test_cases/t00019_class.svg
@@ -1,89 +1,122 @@
-
\ No newline at end of file
+
diff --git a/docs/test_cases/t00020_class.svg b/docs/test_cases/t00020_class.svg
index ec08620a..9024cd8d 100644
--- a/docs/test_cases/t00020_class.svg
+++ b/docs/test_cases/t00020_class.svg
@@ -1,94 +1,114 @@
-
\ No newline at end of file
+
diff --git a/docs/test_cases/t00021_class.svg b/docs/test_cases/t00021_class.svg
index 0400be70..dc51718b 100644
--- a/docs/test_cases/t00021_class.svg
+++ b/docs/test_cases/t00021_class.svg
@@ -1,95 +1,112 @@
-
\ No newline at end of file
+
diff --git a/docs/test_cases/t00022_class.svg b/docs/test_cases/t00022_class.svg
index e286fcf2..643e1fca 100644
--- a/docs/test_cases/t00022_class.svg
+++ b/docs/test_cases/t00022_class.svg
@@ -1,41 +1,48 @@
-
\ No newline at end of file
+
diff --git a/docs/test_cases/t00023_class.svg b/docs/test_cases/t00023_class.svg
index 4d394d1f..bf2a2775 100644
--- a/docs/test_cases/t00023_class.svg
+++ b/docs/test_cases/t00023_class.svg
@@ -1,58 +1,70 @@
-
\ No newline at end of file
+
diff --git a/docs/test_cases/t00024_class.svg b/docs/test_cases/t00024_class.svg
index 4c02ceb0..7cd8c584 100644
--- a/docs/test_cases/t00024_class.svg
+++ b/docs/test_cases/t00024_class.svg
@@ -1,56 +1,70 @@
-
\ No newline at end of file
+
diff --git a/docs/test_cases/t00025_class.svg b/docs/test_cases/t00025_class.svg
index 8650a211..92f28c28 100644
--- a/docs/test_cases/t00025_class.svg
+++ b/docs/test_cases/t00025_class.svg
@@ -1,67 +1,90 @@
-
\ No newline at end of file
+
diff --git a/docs/test_cases/t00026_class.svg b/docs/test_cases/t00026_class.svg
index c5ad1cc0..5cf2fe41 100644
--- a/docs/test_cases/t00026_class.svg
+++ b/docs/test_cases/t00026_class.svg
@@ -1,73 +1,106 @@
-
\ No newline at end of file
+
diff --git a/docs/test_cases/t00027_class.svg b/docs/test_cases/t00027_class.svg
index 222ab061..87cee6b1 100644
--- a/docs/test_cases/t00027_class.svg
+++ b/docs/test_cases/t00027_class.svg
@@ -1,105 +1,148 @@
-
\ No newline at end of file
+
diff --git a/docs/test_cases/t00028_class.svg b/docs/test_cases/t00028_class.svg
index 87c260c5..eb76b63f 100644
--- a/docs/test_cases/t00028_class.svg
+++ b/docs/test_cases/t00028_class.svg
@@ -1,133 +1,163 @@
-
\ No newline at end of file
+
diff --git a/docs/test_cases/t00029_class.svg b/docs/test_cases/t00029_class.svg
index f5a44483..5fb8b499 100644
--- a/docs/test_cases/t00029_class.svg
+++ b/docs/test_cases/t00029_class.svg
@@ -1,70 +1,81 @@
-
\ No newline at end of file
+
diff --git a/docs/test_cases/t00030_class.svg b/docs/test_cases/t00030_class.svg
index 735fb9f2..ff438e89 100644
--- a/docs/test_cases/t00030_class.svg
+++ b/docs/test_cases/t00030_class.svg
@@ -1,52 +1,71 @@
-
\ No newline at end of file
+
diff --git a/docs/test_cases/t00031_class.svg b/docs/test_cases/t00031_class.svg
index 175622b1..78b68bb8 100644
--- a/docs/test_cases/t00031_class.svg
+++ b/docs/test_cases/t00031_class.svg
@@ -1,63 +1,93 @@
-
\ No newline at end of file
+
diff --git a/docs/test_cases/t00032_class.svg b/docs/test_cases/t00032_class.svg
index ce226d29..d84a400f 100644
--- a/docs/test_cases/t00032_class.svg
+++ b/docs/test_cases/t00032_class.svg
@@ -1,82 +1,98 @@
-
\ No newline at end of file
+
diff --git a/docs/test_cases/t00033_class.svg b/docs/test_cases/t00033_class.svg
index 3f2ba4d5..368fba71 100644
--- a/docs/test_cases/t00033_class.svg
+++ b/docs/test_cases/t00033_class.svg
@@ -1,74 +1,98 @@
-
\ No newline at end of file
+
diff --git a/docs/test_cases/t00034_class.svg b/docs/test_cases/t00034_class.svg
index a06629a6..886adb30 100644
--- a/docs/test_cases/t00034_class.svg
+++ b/docs/test_cases/t00034_class.svg
@@ -1,60 +1,78 @@
-
\ No newline at end of file
+
diff --git a/docs/test_cases/t00035_class.svg b/docs/test_cases/t00035_class.svg
index 46f289d8..38d5d469 100644
--- a/docs/test_cases/t00035_class.svg
+++ b/docs/test_cases/t00035_class.svg
@@ -1,48 +1,42 @@
-
\ No newline at end of file
+
diff --git a/docs/test_cases/t00036_class.svg b/docs/test_cases/t00036_class.svg
index e628e932..8c605353 100644
--- a/docs/test_cases/t00036_class.svg
+++ b/docs/test_cases/t00036_class.svg
@@ -1,62 +1,76 @@
-
\ No newline at end of file
+
diff --git a/docs/test_cases/t20001_sequence.svg b/docs/test_cases/t20001_sequence.svg
index 8253e215..bbbcbdff 100644
--- a/docs/test_cases/t20001_sequence.svg
+++ b/docs/test_cases/t20001_sequence.svg
@@ -1,32 +1,63 @@
-
\ No newline at end of file
+
diff --git a/docs/test_cases/t20002_sequence.svg b/docs/test_cases/t20002_sequence.svg
index e316b7f8..d8e94f30 100644
--- a/docs/test_cases/t20002_sequence.svg
+++ b/docs/test_cases/t20002_sequence.svg
@@ -1,23 +1,47 @@
-
\ No newline at end of file
+
diff --git a/docs/test_cases/t30001_package.svg b/docs/test_cases/t30001_package.svg
index 0b9ac111..5fe708ff 100644
--- a/docs/test_cases/t30001_package.svg
+++ b/docs/test_cases/t30001_package.svg
@@ -1,44 +1,46 @@
-
\ No newline at end of file
+
diff --git a/docs/test_cases/t30002_package.svg b/docs/test_cases/t30002_package.svg
index 5bacd6c5..1c52a720 100644
--- a/docs/test_cases/t30002_package.svg
+++ b/docs/test_cases/t30002_package.svg
@@ -1,84 +1,92 @@
-
\ No newline at end of file
+
diff --git a/docs/test_cases/t30003_package.svg b/docs/test_cases/t30003_package.svg
index f1feab21..5c271413 100644
--- a/docs/test_cases/t30003_package.svg
+++ b/docs/test_cases/t30003_package.svg
@@ -1,35 +1,34 @@
-
\ No newline at end of file
+
diff --git a/docs/test_cases/t30004_package.svg b/docs/test_cases/t30004_package.svg
index 8591f854..c31fa15a 100644
--- a/docs/test_cases/t30004_package.svg
+++ b/docs/test_cases/t30004_package.svg
@@ -1,47 +1,47 @@
-
\ No newline at end of file
+
diff --git a/docs/test_cases/t30005_package.svg b/docs/test_cases/t30005_package.svg
index f0ed020d..961fed2c 100644
--- a/docs/test_cases/t30005_package.svg
+++ b/docs/test_cases/t30005_package.svg
@@ -1,48 +1,43 @@
-
\ No newline at end of file
+
diff --git a/docs/test_cases/t30006_package.svg b/docs/test_cases/t30006_package.svg
index 92daf49f..bdb0cbb4 100644
--- a/docs/test_cases/t30006_package.svg
+++ b/docs/test_cases/t30006_package.svg
@@ -1,38 +1,33 @@
-
\ No newline at end of file
+
diff --git a/docs/test_cases/t30007_package.svg b/docs/test_cases/t30007_package.svg
index b3794762..5ab9d3b9 100644
--- a/docs/test_cases/t30007_package.svg
+++ b/docs/test_cases/t30007_package.svg
@@ -1,45 +1,36 @@
-
\ No newline at end of file
+
diff --git a/docs/test_cases/t90000_class.svg b/docs/test_cases/t90000_class.svg
index a5beec6d..37c80296 100644
--- a/docs/test_cases/t90000_class.svg
+++ b/docs/test_cases/t90000_class.svg
@@ -1,33 +1,47 @@
-
\ No newline at end of file
+
diff --git a/util/format_svg.py b/util/format_svg.py
new file mode 100755
index 00000000..1539f88d
--- /dev/null
+++ b/util/format_svg.py
@@ -0,0 +1,51 @@
+#!/usr/bin/python3
+
+##
+## util/format_svg.py
+##
+## Copyright (c) 2021-2022 Bartek Kryza
+##
+## Licensed under the Apache License, Version 2.0 (the "License");
+## you may not use this file except in compliance with the License.
+## You may obtain a copy of the License at
+##
+## http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing, software
+## distributed under the License is distributed on an "AS IS" BASIS,
+## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+## See the License for the specific language governing permissions and
+## limitations under the License.
+##
+
+import sys
+from lxml import etree
+
+def main(argv):
+ if len(argv) < 1:
+ print('Usage: \n')
+ print('\t\t ./format_svg.py input_file1.svg input_file2.svg ...\n')
+ sys.exit(1)
+
+ for inputfile in argv:
+ # Read svg file contents
+ with open(inputfile, 'r') as f:
+ xml = f.read()
+
+ # Parse SVG XML
+ tree = etree.fromstring(bytes(xml, encoding='utf8'))
+
+ # Remove comments from SVG, to minimize diff
+ # when updating diagrams in Git
+ comments = tree.xpath('//comment()')
+
+ for c in comments:
+ p = c.getparent()
+ p.remove(c)
+
+ # Overwrite the input svg properly formatted
+ etree.ElementTree(tree).write(inputfile, encoding='utf-8', pretty_print=True)
+
+
+if __name__ == "__main__":
+ main(sys.argv[1:])
\ No newline at end of file