landmaj / mkdocs-d2-plugin

A plugin for embedding D2 diagrams in MkDocs.
https://landmaj.github.io/mkdocs-d2-plugin/
MIT License
22 stars 4 forks source link

feat: adding elk-algorithm #10

Closed ss185994 closed 6 months ago

ss185994 commented 6 months ago

It's been a while since I've used python but I figured I'd give adding this parameter a shot.

d2 seems to set the default to layered https://github.com/terrastruct/d2/blob/7d84b7c1b94a73f030007b2d352738f8782ba9ef/d2layouts/d2elklayout/layout.go#L121

d2 seems to ignore --elk-algorithm if the layout isn't set to elk

❯ d2 --theme=300 --layout=elk --elk-algorithm="mrtree" ../notes/ci.d2 ci.png
success: successfully compiled ../notes/ci.d2 to ci.png in 4.095118334s

❯ d2 --theme=300 --layout=dagre --elk-algorithm="mrtree" ../notes/ci.d2 ci.png
success: successfully compiled ../notes/ci.d2 to ci.png in 2.447612083s

willing to iterate on this, id be shocked if it was this simple

landmaj commented 6 months ago

Thanks for the contribution. I just went on a holiday, so I won't be able to take a look until next weekend.

landmaj commented 6 months ago

I uploaded version 1.3.0 which allows passing arbitrary options, since there are more layout specific options and I don't want to hard-code them all. Please let me know if this version satisfies your needs.

https://landmaj.github.io/mkdocs-d2-plugin/guide/configuration/#local-config

ss185994 commented 6 months ago

I uploaded version 1.3.0 which allows passing arbitrary options, since there are more layout specific options and I don't want to hard-code them all. Please let me know if this version satisfies your needs.

https://landmaj.github.io/mkdocs-d2-plugin/guide/configuration/#local-config

nice, that's even better thank you