diff --git a/plantuml/class-diagram-tips.md b/plantuml/class-diagram-tips.md
index 2dc0ddb..f6b5073 100644
--- a/plantuml/class-diagram-tips.md
+++ b/plantuml/class-diagram-tips.md
@@ -1,49 +1,45 @@
## Controlling Class Layout
Layout is determined dymanically, so can be tricky if you are trying to get a specific layout, but you can usually beat it into submission with a combination of the following:
- class1 -> class2 ' horizontal placement
- class2 --> class3 ' vertical placement
- class4 -left-> class4 ' left placement
+ ' force class diagram mode
+ class c1
+
+ ' horizontal placement
+ c1 -> c2
+
+ ' vertical placement
+ c2 --> c3
+
+ ' left placement
+ c4 -left-> c4
-
-
-You can use `left` , `right`, `up`, and `down` to control placement direction.
+You can use `left`, `right`, `up`, and `down` to control placement direction.
If adding a link screws up the class placement you can use `[norank]` to exclude the link from the layout process:
- ' link will not affect class placement
- c4 -[norank]-> c2
-
-
+ ' link will not affect class placement
+ c4 -[norank]-> c2
You can also use `[hidden]` to create invisible links solely for the purpose of influencing the layout. Repeating them will increase the likelihood that the classes will be placed closer and even be aligned with each other:
- ' place c2 and c4 closer together
- c2 -[hidden]-> c4
-
-
-
+ ' place c2 and c4 closer together
+ c2 -[hidden]-> c4
+
' repeated again to place c2 and c4 even closer
c2 -[hidden]-> c4
-
-
-Note that although the links are hidden they still affecting the drawing of links on the same path. If you temporarily remove the `[hidden]` option you can see what is going on:
-
-
+Note that although the links are hidden they still affecting the drawing of links on the same path. If you temporarily remove the `[hidden]` option you can see what is going on.
You can fiddle with the ordering and direction to ensure the one that is being drawn is in the place that you want it (usually in the middle). The trick is to use identical links with the same class ordering and direction. If you want the link drawn in the opposite direction you can't flip the order of the classes - you need to swap the placement of the arrow:
- ' place c2 and c4 closer
- c2 -[hidden]- c4
-
- ' draw the actual link between the hidden links
- c2 <-[norank]- c4
-
- ' place c2 and c4 even closer
- c2 -[hidden]- c4
-
-
+ ' place c2 and c4 closer
+ c2 -[hidden]- c4
+
+ ' draw the actual link between the hidden links
+ c2 <-[norank]- c4
+
+ ' place c2 and c4 even closer
+ c2 -[hidden]- c4
### General Layout Tips
@@ -53,47 +49,40 @@
The rank is determined by:
-- The order in which classes are added to the diagram
-- The layout hints (horizontal, vertical, left, right, up, down)
-- The direction in which the links are defined. The class on the left has higher rank than the one on the right: `higher -> lower`
+* The order in which classes are added to the diagram
+* The layout hints (horizontal, vertical, left, right, up, down)
+* The direction in which the links are defined. The class on the left has higher rank than the one on the right: `higher -> lower`
Link direction can have a dramatic impact. If we add a `c4 --> c2` link we confuse the engine by having `c4` on the left which gives it a higher ranking than `c2` and causes the diagram to flip upside down:
- class c1
- c1 -> c2
- c2 --> c3
- c3 -left-> c4
-
- ' whoops, this flips the diagram on its head
- c4 --> c2
-
-
+ class c1
+ c1 -> c2
+ c2 --> c3
+ c3 -left-> c4
+
+ ' whoops, this flips the diagram on its head
+ c4 --> c2
Drawing links from the top down prevents this re-ranking problem, and means you don't have to use `[norank]` as often. Since the arrow direction has no effect on the layout we can just flip the end that the arrow is drawn at to account for the link being in a different order:
- ' ranking maintained, so layout isn't dramatically affected
- ' arrow drawn at opposite end to account for reverse order
- c2 <-- c4
-
-
+ ' ranking maintained, so layout isn't dramatically affected
+ ' arrow drawn at opposite end to account for reverse order
+ c2 <-- c4
We could have also used the `up` layout hint to prevent the re-ranking:
- c4 -up-> c2
+ c4 -up-> c2
## Layout Direction
You can change the ranking direction from vertical to horizontal using `left to right direction`:
- left to right direction
-
- class c1
- c1 -> c2
- c2 --> c3
- c3 -left-> c4
- c2 <-- c4
-
-
+ left to right direction
+ class c1
+ c1 -> c2
+ c2 --> c3
+ c3 -left-> c4
+ c2 <-- c4
This also changes the meaning of the layout hints. Horizontal hints become vertical, etc.
@@ -102,6 +91,6 @@
You can control the spacing between class using the `NodeSep` and `RankSep` skinparams.
SkinParam {
- NodeSep 45 ' horizontal spacing
- RankSep 45 ' vertical spacing
- }
\ No newline at end of file
+ NodeSep 45 ' horizontal spacing
+ RankSep 45 ' vertical spacing
+ }