I noticed an issue with the Mermaid diagram layout/rendering at ch01-introduction-and-motivation.html#rust-philosophy.
I've created a quick patch to fix it.
diff --git a/python-book/src/ch01-introduction-and-motivation.md b/python-book/src/ch01-introduction-and-motivation.md
index f586f48..b9ab24c 100644
--- a/python-book/src/ch01-introduction-and-motivation.md
+++ b/python-book/src/ch01-introduction-and-motivation.md
@@ -404,6 +404,7 @@ graph LR
PY_GIL --> PY_OS["OS / Hardware"]
end
+ PY ~~~ RS
subgraph RS["🦀 Rust"]
direction TB
RS_CODE["Your Code"] --> RS_NONE["No runtime overhead"]
diff --git a/python-book/src/ch04-control-flow.md b/python-book/src/ch04-control-flow.md
index 3988bc0..0c88084 100644
--- a/python-book/src/ch04-control-flow.md
+++ b/python-book/src/ch04-control-flow.md
@@ -218,6 +218,8 @@ flowchart LR
P2 --> P4["result used later"]
P3 --> P4
end
+
+ Python ~~~ Rust
subgraph Rust ["Rust — Expressions"]
R1["let result = if cond"] --> R2["{ 'yes' }"]
R1 --> R3["{ 'no' }"]
diff --git a/python-book/src/ch05-data-structures-and-collections.md b/python-book/src/ch05-data-structures-and-collections.md
index 7242470..4efc124 100644
--- a/python-book/src/ch05-data-structures-and-collections.md
+++ b/python-book/src/ch05-data-structures-and-collections.md
@@ -195,6 +195,7 @@ flowchart LR
PH --> PHT["height: float obj"]
PH --> PD["__dict__"]
end
+ Python ~~~ Rust
subgraph Rust ["Rust Struct (Stack)"]
RW["width: f64<br/>(8 bytes)"] --- RH["height: f64<br/>(8 bytes)"]
end
diff --git a/python-book/src/ch10-traits-and-generics.md b/python-book/src/ch10-traits-and-generics.md
index eb449fb..56a7dfe 100644
--- a/python-book/src/ch10-traits-and-generics.md
+++ b/python-book/src/ch10-traits-and-generics.md
@@ -322,6 +322,7 @@ flowchart TB
VT --> I1["Article::summarize()"]
VT --> I2["Tweet::summarize()"]
end
+ Static ~~~ Dynamic
style Static fill:#d4edda
style Dynamic fill:#fff3cd
```
diff --git a/python-book/src/ch11-from-and-into-traits.md b/python-book/src/ch11-from-and-into-traits.md
index 30e67e3..d5b2845 100644
--- a/python-book/src/ch11-from-and-into-traits.md
+++ b/python-book/src/ch11-from-and-into-traits.md
@@ -62,8 +62,9 @@ let n: i32 = "42".parse()?; // Propagate error with ?
### The From/Into Relationship
+<!-- Open to debate -->
```mermaid
-flowchart LR
+flowchart TB
A["impl From<A> for B"] -->|"auto-generates"| B["impl Into<B> for A"]
C["Celsius::from(Fahrenheit(212.0))"] ---|"same as"| D["Fahrenheit(212.0).into()"]
style A fill:#d4edda
diff --git a/python-book/src/ch15-migration-patterns.md b/python-book/src/ch15-migration-patterns.md
index a39d528..49d96ef 100644
--- a/python-book/src/ch15-migration-patterns.md
+++ b/python-book/src/ch15-migration-patterns.md
@@ -250,8 +250,9 @@ let db_host = get_config()["database"]["host"].as_str().unwrap();
## Incremental Adoption Strategy
+<!-- Open to debate -->
```mermaid
-flowchart LR
+flowchart TB
A["1️⃣ Profile Python<br/>(find hotspots)"] --> B["2️⃣ Write Rust Extension<br/>(PyO3 + maturin)"]
B --> C["3️⃣ Replace Python Call<br/>(same API)"]
C --> D["4️⃣ Expand Gradually<br/>(more functions)"]
Notes & Open Questions
- Open for discussion: note with
<!-- Open to debate -->
- Since this is a very small change, feel free to cherry-pick/apply this patch directly, combine it into another PR, or let me know if you'd prefer me to open a standalone PR for it.
I noticed an issue with the Mermaid diagram layout/rendering at ch01-introduction-and-motivation.html#rust-philosophy.
I've created a quick patch to fix it.
Notes & Open Questions
<!-- Open to debate -->