From 134c46da43a7da34ced1bbade86fa564c74baac2 Mon Sep 17 00:00:00 2001 From: Gabriel Kaszewski Date: Wed, 17 Jun 2026 10:09:44 +0200 Subject: [PATCH] fix: correct mermaid flowchart edge label syntax (-->|label| not --|"label"|) --- crates/adapters/mermaid/src/mermaid_renderer.rs | 12 ++++++------ .../adapters/mermaid/tests/mermaid_renderer_tests.rs | 6 +++--- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/crates/adapters/mermaid/src/mermaid_renderer.rs b/crates/adapters/mermaid/src/mermaid_renderer.rs index 42b9a47..14117fe 100644 --- a/crates/adapters/mermaid/src/mermaid_renderer.rs +++ b/crates/adapters/mermaid/src/mermaid_renderer.rs @@ -225,17 +225,17 @@ impl MermaidRenderer { } for ((source, target), count) in &module_edges { - let arrow = if self.show_weights { + let line = if self.show_weights { let label = if *count == 1 { - r#"|"1 dep"|"#.to_string() + "1 dep".to_string() } else { - format!(r#"|"{count} deps"|"#) + format!("{count} deps") }; - format!("--{label}") + format!(" {source} -->|{label}| {target}") } else { - "-->".to_string() + format!(" {source} --> {target}") }; - lines.push(format!(" {source} {arrow} {target}")); + lines.push(line); } lines.join("\n") diff --git a/crates/adapters/mermaid/tests/mermaid_renderer_tests.rs b/crates/adapters/mermaid/tests/mermaid_renderer_tests.rs index e19779b..2311826 100644 --- a/crates/adapters/mermaid/tests/mermaid_renderer_tests.rs +++ b/crates/adapters/mermaid/tests/mermaid_renderer_tests.rs @@ -321,7 +321,7 @@ fn module_level_aggregates_cross_module_deps_into_single_arrow() { let content = output.files()[0].content(); let arrow_count = - content.matches("Orders --> Infra").count() + content.matches("Orders --|").count(); + content.matches("Orders --> Infra").count() + content.matches("Orders -->|").count(); assert_eq!( arrow_count, 1, "should have exactly one aggregated arrow, got:\n{content}" @@ -374,7 +374,7 @@ fn module_level_shows_dep_count_as_edge_label() { let content = output.files()[0].content(); assert!( - content.contains(r#"|"2 deps"|"#), + content.contains("|2 deps|"), "expected dep count label in: {content}" ); } @@ -412,7 +412,7 @@ fn module_level_single_dep_uses_singular_label() { let content = output.files()[0].content(); assert!( - content.contains(r#"|"1 dep"|"#), + content.contains("|1 dep|"), "expected singular dep label in: {content}" ); }