From 52159ec8fe02cb98f2767746c3a9c4363df57beb Mon Sep 17 00:00:00 2001 From: Abdelkader Boudih Date: Wed, 17 Jan 2024 21:50:02 +0100 Subject: [PATCH] chore: replace to image with mermaid --- README.md | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index a4ce159d..84e76187 100644 --- a/README.md +++ b/README.md @@ -301,13 +301,40 @@ File.open("example.dot", "w") { |f| f.write(Tag.root.to_dot_digraph) } ``` Then, in a shell, ```dot -Tpng example.dot > example.png```, which produces: -![Example tree](https://raw.github.com/ClosureTree/closure_tree/master/img/example.png) +```mermaid +graph TD; + a --> b; + a --> b2; + b --> c1; + b --> c2; + c1 --> d1; + c1 --> d2; +``` If you want to customize the label value, override the ```#to_digraph_label``` instance method in your model. Just for kicks, this is the test tree I used for proving that preordered tree traversal was correct: -![Preordered test tree](https://raw.github.com/ClosureTree/closure_tree/master/img/preorder.png) +```mermaid +graph TD; + a --> b; + a --> l; + b --> c; + b --> h; + c --> d; + c --> e; + d --> f; + d --> g; + h --> i; + i --> j; + j --> k; + l --> m; + l --> n; + m --> o; + n --> p; + n --> q; + p --> r; +``` ### Available options