potential diagrams inmarkdown

Commonmark out of box doesn't seem to support any diagram render capability. Hence everything here is targeting some flavour of markdown.

example of failing to rendering graphviz diagram in github readme due to multi line inside link

![Alt text](“https://g.gravizo.com/svg? digraph G { size =“4,4”; main [shape=box]; main parse [weight=8]; parse execute; main init [style=dotted]; main cleanup; execute { make_string; printf} init make_string; edge [color=red]; main printf [style=bold,label=“100 times”]; make_string [label=“make a string”]; node [shape=box,style=filled,color=“.7 .3 1.0”]; execute compare; } “)

example of rendering the diagram via kroki.io

bash script that generate kroki link from .dot file(can be self hosted)

 
# syntax used here is bash parameter expansion
# https://stackoverflow.com/questions/2013547/assigning-default-values-to-shell-variables-with-a-single-command-in-bash
file="${1:-content/Learn/DevOps/example2.dot}"
cat $file | python -c "import sys; import base64; import zlib; print(base64.urlsafe_b64encode(zlib.compress(sys.stdin.read().encode('utf-8'), 9)).decode('ascii'))" | sed 's/^/ https:\/\/kroki.io\/graphviz\/svg\//'
 

example .dot file of terraform graph

digraph {
compound = "true"
newrank = "true"
subgraph "root" {
  "[root] aws_instance.example"
  [label = "aws_instance.example", shape = "box"]
  "[root] aws_security_group.instance"
  [label = "aws_security_group.instance", shape =a "box"]
  "[root] provider.aws"
  [label = "provider.aws", shape = "diamond"]
  "[root] aws_instance.example" ->
  "[root] aws_security_group.instance"
  "[root] aws_security_group.instance" ->
  "[root] provider.aws"
  "[root] meta.count-boundary (EachMode fixup)" ->
  "[root] aws_instance.example"
  "[root] provider.aws (close)" ->
  "[root] aws_instance.example"
  "[root] root" ->
  "[root] meta.count-boundary (EachMode fixup)"
  "[root] root" ->
  "[root] provider.aws (close)"
  }
}

result

rendered diagram