AVATEAM-IT-SYSTEMHAUS / mkdocs-kroki-plugin

MkDocs plugin for Kroki-Diagrams
MIT License
42 stars 27 forks source link

jinja templating support #6

Closed richardstubbs closed 2 years ago

richardstubbs commented 2 years ago

Add support for macros and jinja templating before kroki url encoding (accepting that macros j2 start and end strings may need to be set to avid clashing with korki format, it would make documenting single changes that cascade through diagrams a breeze and creating dynamic diagramming biased on logic.

```kroki-nwdiag
nwdiag {
  network dmz {
    address = "{{ ips.dmz_cidr }}"

    web01 [address = "210.x.x.1"];
    web02 [address = "210.x.x.2"];
  }
  network internal {
    address = "172.x.x.x/24";

    web01 [address = "172.x.x.1"];
    web02 [address = "172.x.x.2"];
    db01;
    db02;
  }
}
```

mkdocs.yaml

plugins:
  - kroki
  - macros

extra:
  ips:
    dmz_cidr: 210.x.x.0/24  
b-bittner commented 2 years ago

Thanks for your request, that's really a good idea! But to be honest, at the moment, I don't have a clue how to get functions of a different plugin to work on the kroki-plugin. Is there anybody with a hint or could provide a (draft) PR?

richardstubbs commented 2 years ago

I went to revisit this to implement this feature, on reviewing this, it can be achieved with the markdownextradata plugin

plugins:
  - kroki
  - macros
  - markdownextradata: {}