@@ -4,6 +4,7 @@ import gleam/option.{None, Some}
44import yog/model
55import yog/pathfinding
66import yog/render
7+ import yog/transform
78
89pub fn main ( ) {
910 // Create a sample graph
@@ -20,7 +21,7 @@ pub fn main() {
2021 io . println ( "--- Basic Mermaid Output ---" )
2122 let mermaid_basic =
2223 render . to_mermaid (
23- graph |> model . map_edges ( int . to_string ) ,
24+ graph |> transform . map_edges ( int . to_string ) ,
2425 render . default_options ( ) ,
2526 )
2627 io . println ( "```mermaid" )
@@ -31,17 +32,18 @@ pub fn main() {
3132 io . println ( "\n --- Mermaid with Custom Labels & Highlighting ---" )
3233 case pathfinding . shortest_path ( graph , 1 , 3 , 0 , int . add , int . compare ) {
3334 Some ( path ) -> {
34- let options =
35+ let base_options =
3536 render . MermaidOptions (
3637 node_label : fn ( id , data ) {
3738 data <> " (ID: " <> int . to_string ( id ) <> ")"
3839 } ,
3940 edge_label : fn ( weight ) { weight <> " km" } ,
40- highlighted_nodes : Some ( path . nodes ) ,
41- highlighted_edges : Some ( render . path_to_edges ( path ) ) ,
41+ highlighted_nodes : None ,
42+ highlighted_edges : None ,
4243 )
44+ let options = render . path_to_options ( path , base_options )
4345 let mermaid_custom =
44- render . to_mermaid ( graph |> model . map_edges ( int . to_string ) , options )
46+ render . to_mermaid ( graph |> transform . map_edges ( int . to_string ) , options )
4547 io . println ( "```mermaid" )
4648 io . println ( mermaid_custom )
4749 io . println ( "```" )
0 commit comments