Skip to content

Commit 438606b

Browse files
committed
📚 Separate mermaid diagrams
Problem: - Mermaid diagrams are inlined in documentation, which means Github does not know how to render them. Solution: - Separate mermaid docs into their own files. Github knows how to render `.mmd` files.
1 parent c982e97 commit 438606b

File tree

6 files changed

+73
-81
lines changed

6 files changed

+73
-81
lines changed

docs/flows.adoc

Lines changed: 3 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -72,19 +72,7 @@ to the flow.
7272
If we only use the `morning` component in our project, the `MorningRoutine` flow
7373
graph would look like the following:
7474

75-
[mermaid, format="svg"]
76-
----
77-
flowchart TD
78-
a(WAKE_UP)
79-
b(selfcare::SHOWER)
80-
c(selfcare::GET_DRESSED)
81-
d(food::MAKE_COFFEE)
82-
e(food::DRINK_COFFEE)
83-
a --> b
84-
b --> c
85-
c --> d
86-
d --> e
87-
----
75+
mermaid::morning_flow1.mmd[format="svg"]
8876

8977
The power of `flow` services comes when more than one component adds actions to
9078
the flow. Flows can be extended by inserting additional actions with new
@@ -114,28 +102,7 @@ struct childcare {
114102

115103
The new steps are inserted into the existing `flow`​'s dependency graph:
116104

117-
[mermaid, format="svg"]
118-
----
119-
flowchart TD
120-
a(WAKE_UP)
121-
b(selfcare::SHOWER)
122-
c(selfcare::GET_DRESSED)
123-
d(food::MAKE_COFFEE)
124-
e(food::DRINK_COFFEE)
125-
a --> b
126-
b --> c
127-
c --> d
128-
d --> e
129-
f(food::MAKE_BREAKFAST)
130-
g(food::EAT_BREAKFAST)
131-
h(childcare::PACK_SCHOOL_LUNCHES)
132-
i(childcare::SEND_KIDS_TO_SCHOOL)
133-
d --> h
134-
h --> e
135-
e --> f
136-
f --> g
137-
g --> i
138-
----
105+
mermaid::morning_flow2.mmd[format="svg"]
139106

140107
Multiple independent components can add actions to the same `flow`. This is the
141108
power of `flow` services, they can be extended by multiple independent
@@ -161,31 +128,7 @@ all without the `MorningRoutine` source code having known about the new
161128
functionality. We can mix and match new components without modifying the
162129
original source code.
163130

164-
[mermaid, format="svg"]
165-
----
166-
flowchart TD
167-
a(WAKE_UP)
168-
b(selfcare::SHOWER)
169-
c(selfcare::GET_DRESSED)
170-
d(food::MAKE_COFFEE)
171-
e(food::DRINK_COFFEE)
172-
a --> b
173-
b --> c
174-
c --> d
175-
d --> e
176-
f(food::MAKE_BREAKFAST)
177-
g(food::EAT_BREAKFAST)
178-
h(childcare::PACK_SCHOOL_LUNCHES)
179-
i(childcare::SEND_KIDS_TO_SCHOOL)
180-
d --> h
181-
h --> e
182-
e --> f
183-
f --> g
184-
g --> i
185-
j(exercise::RIDE_STATIONARY_BIKE)
186-
a --> j
187-
j --> b
188-
----
131+
mermaid::morning_flow3.mmd[format="svg"]
189132

190133
The `cib` library will take care of initializing and building all services,
191134
including `flow` services. For `flow`​s, this means the dependency graph will be

docs/intro.adoc

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -53,24 +53,4 @@ _cib_ contains several parts that work together:
5353
Various sub-libraries within CIB form a dependency graph. `cib` is an omnibus
5454
library that contains all the functionality.
5555

56-
[mermaid, format="svg"]
57-
----
58-
flowchart BT
59-
nexus(cib_nexus)
60-
log(cib_log)
61-
match(cib_match)
62-
lookup(cib_lookup)
63-
64-
flow(cib_flow) --> nexus
65-
flow --> log
66-
67-
log_fmt(cib_log_fmt) --> log
68-
msg(cib_msg) --> log & match
69-
msg --> lookup
70-
71-
log_binary(cib_log_binary) --> msg
72-
seq(cib_seq) --> flow
73-
74-
interrupt(cib_interrupt)
75-
cib --> seq & log_fmt & log_binary & interrupt
76-
----
56+
mermaid::library_deps.mmd[format="svg"]

docs/library_deps.mmd

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
flowchart BT
2+
nexus(cib_nexus)
3+
log(cib_log)
4+
match(cib_match)
5+
lookup(cib_lookup)
6+
7+
flow(cib_flow) --> nexus
8+
flow --> log
9+
10+
log_fmt(cib_log_fmt) --> log
11+
msg(cib_msg) --> log & match
12+
msg --> lookup
13+
14+
log_binary(cib_log_binary) --> msg
15+
seq(cib_seq) --> flow
16+
17+
interrupt(cib_interrupt)
18+
cib --> seq & log_fmt & log_binary & interrupt

docs/morning_flow1.mmd

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
flowchart TD
2+
a(WAKE_UP)
3+
b(selfcare::SHOWER)
4+
c(selfcare::GET_DRESSED)
5+
d(food::MAKE_COFFEE)
6+
e(food::DRINK_COFFEE)
7+
a --> b
8+
b --> c
9+
c --> d
10+
d --> e

docs/morning_flow2.mmd

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
flowchart TD
2+
a(WAKE_UP)
3+
b(selfcare::SHOWER)
4+
c(selfcare::GET_DRESSED)
5+
d(food::MAKE_COFFEE)
6+
e(food::DRINK_COFFEE)
7+
a --> b
8+
b --> c
9+
c --> d
10+
d --> e
11+
f(food::MAKE_BREAKFAST)
12+
g(food::EAT_BREAKFAST)
13+
h(childcare::PACK_SCHOOL_LUNCHES)
14+
i(childcare::SEND_KIDS_TO_SCHOOL)
15+
d --> h
16+
h --> e
17+
e --> f
18+
f --> g
19+
g --> i

docs/morning_flow3.mmd

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
flowchart TD
2+
a(WAKE_UP)
3+
b(selfcare::SHOWER)
4+
c(selfcare::GET_DRESSED)
5+
d(food::MAKE_COFFEE)
6+
e(food::DRINK_COFFEE)
7+
a --> b
8+
b --> c
9+
c --> d
10+
d --> e
11+
f(food::MAKE_BREAKFAST)
12+
g(food::EAT_BREAKFAST)
13+
h(childcare::PACK_SCHOOL_LUNCHES)
14+
i(childcare::SEND_KIDS_TO_SCHOOL)
15+
d --> h
16+
h --> e
17+
e --> f
18+
f --> g
19+
g --> i
20+
j(exercise::RIDE_STATIONARY_BIKE)
21+
a --> j
22+
j --> b

0 commit comments

Comments
 (0)