Add mdbook-mermaid (#26426)

pull/26459/head
Michael Telatynski 2023-10-26 08:40:33 +01:00 committed by GitHub
parent de2d3ff204
commit 588e056699
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 88 additions and 61 deletions

View File

@ -47,8 +47,8 @@ jobs:
with: with:
mdbook-version: "0.4.10" mdbook-version: "0.4.10"
- name: Install mdbook-combiner - name: Install mdbook extensions
run: cargo install mdbook-combiner run: cargo install mdbook-combiner mdbook-mermaid
- name: Prepare docs - name: Prepare docs
run: | run: |

2
.gitignore vendored
View File

@ -28,3 +28,5 @@ electron/pub
/src/modules.ts /src/modules.ts
/build_config.yaml /build_config.yaml
/book /book
/mermaid*
/index.html

View File

@ -24,3 +24,9 @@ git-repository-url = "https://github.com/vector-im/element-web"
# The path that the docs are hosted on # The path that the docs are hosted on
site-url = "/element-web/" site-url = "/element-web/"
additional-js = ["mermaid.min.js", "mermaid-init.js"]
[preprocessor]
[preprocessor.mermaid]
command = "mdbook-mermaid"

View File

@ -4,78 +4,67 @@
been kept untouched for posterity. been kept untouched for posterity.
Old slow flow: Old slow flow:
![image](https://user-images.githubusercontent.com/2403652/73848963-00a2a080-4821-11ea-97d4-1200fc2638f3.png)
```mermaid
flowchart TD
A1(((load_modernizr))) --> B
A2((rageshake)) --> B
B(((skin))) --> C
C(((olm))) --> D
D{mobile} --> E
E((config)) --> F
F((i18n)) --> G
style F stroke:lime
G(((theme))) --> H
H(((modernizr))) --> app
style H stroke:red
```
Current more parallel flow: Current more parallel flow:
![image](https://user-images.githubusercontent.com/2403652/83146440-303a2900-a0ee-11ea-806b-4f53f039b957.png)
<details><summary>Code</summary> ```mermaid
<p> flowchart TD
<pre><code> subgraph index.ts
digraph G { style index.ts stroke:orange
node [shape=box];
subgraph cluster_0 { A[/rageshake/] --> B{mobile}
color=orange; B-- No -->C1(.)
node [style=filled]; B-- Yes -->C2((redirect))
label = "index.ts"; C1 --> D[/olm/] --> R
C1 --> E[platform] --> F[/config/]
F --> G1[/skin/]
F --> R
G1 --> H
G1 --> R
F --> G2[/theme/]
G2 --> H
G2 --> R
F --> G3[/i18n/]
G3 --> H
G3 --> R
H{modernizr}-- No --> J((incompatible))-- user ignore --> R
H-- Yes --> R
entrypoint, s0, ready [shape=point]; linkStyle 0,7,9,11,12,14,15 stroke:blue;
rageshake, config, i18n, theme, skin, olm [shape=parallelogram]; linkStyle 4,8,10,13,16 stroke:red;
mobile [shape=diamond, label="mobile"]; end
modernizr [shape=diamond];
redirect, incompatible [shape=egg];
entrypoint -> rageshake; R>ready] --> 2A
rageshake -> mobile [color=blue]; style R stroke:gray
mobile -> s0 [label="No"];
mobile -> redirect [label="Yes"];
s0 -> platform; subgraph init.tsx
s0 -> olm; style init.tsx stroke:lime
platform -> config; 2A[loadApp] --> 2B[matrixchat]
end
config -> i18n [color=blue]; ```
config -> theme [color=blue];
config -> skin [color=blue];
i18n -> modernizr [color=blue];
theme -> modernizr [color=blue];
skin -> modernizr [color=blue];
modernizr -> ready [label="Yes"];
modernizr -> incompatible [label="No"];
incompatible -> ready [label="user ignore"];
olm -> ready [color=red];
config -> ready [color=red];
skin -> ready [color=red];
theme -> ready [color=red];
i18n -> ready [color=red];
}
subgraph cluster_1 {
color = green;
node [style=filled];
label = "init.tsx";
ready -> loadApp;
loadApp -> matrixchat;
}
}
</code></pre>
</p>
</details>
Key: Key:
- Parallelogram: async/await task - Parallelogram: async/await task
- Box: sync task - Box: sync task
- Diamond: conditional branch - Diamond: conditional branch
- Egg: user interaction - Circle: user interaction
- Blue arrow: async task is allowed to settle but allowed to fail - Blue arrow: async task is allowed to settle but allowed to fail
- Red arrow: async task success is asserted - Red arrow: async task success is asserted
@ -86,4 +75,34 @@ Notes:
- Everything is awaited to be settled before the Modernizr check, to allow it to make use of things like i18n if they are successful. - Everything is awaited to be settled before the Modernizr check, to allow it to make use of things like i18n if they are successful.
Underlying dependencies: Underlying dependencies:
![image](https://user-images.githubusercontent.com/2403652/73848977-08624500-4821-11ea-9830-bb0317c41086.png)
```mermaid
flowchart TD
A((rageshake))
B{mobile}
C((config))
D(((olm)))
E((i18n))
F(((load_modernizr)))
G(((modernizr)))
H(((skin)))
I(((theme)))
X[app]
A --> G
A --> B
A-- assert -->X
F --> G --> X
G --> H --> X
C --> I --> X
C --> E --> X
E --> G
B --> C-- assert -->X
B --> D --> X
style X stroke:red
style G stroke:red
style E stroke:lime
linkStyle 0,11 stroke:yellow;
linkStyle 2,13 stroke:red;
```