Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add D2 layout engine option #1570

Merged
merged 5 commits into from
Aug 11, 2023

Conversation

felixvanoost
Copy link
Contributor

@felixvanoost felixvanoost commented Jun 12, 2023

Adds support for alternate D2 layout engines (see documentation). Currently this includes both the default layout engine, dagre, and an open-source third-party alternative, ELK.

The TALA engine is not supported because it is proprietary (non-free) and closed-source.

Output with no layout specified (dagre is used by default):

curl http://localhost:8000/d2/svg/eNo9zLkRgDAMRNF8q3ADtEAvvrExBvpPkH9A8rSjkdZvuwuKjpHMrILBLFhV_3xgw6RuRvRsupp50jM06LnIy6nJbyIXXF-3Hm6y-X5cSiFx > default.svg

default

Output with layout=elk:

curl http://localhost:8000/d2/svg/eNo9zLkRgDAMRNF8q3ADtEAvvrExBvpPkH9A8rSjkdZvuwuKjpHMrILBLFhV_3xgw6RuRvRsupp50jM06LnIy6nJbyIXXF-3Hm6y-X5cSiFx?layout=elk > elk.svg

elk

Closes #1557

@felixvanoost felixvanoost marked this pull request as draft June 12, 2023 13:37
@ggrossetie
Copy link
Member

It looks good to me.
@felixvanoost Is it ready for review?

@felixvanoost
Copy link
Contributor Author

@ggrossetie I made these changes while travelling and haven't had time to test them yet. If someone wants to test that the ELK layout engine works, that should be enough. Otherwise I can do it myself next week!

@f3l1x
Copy link

f3l1x commented Jul 27, 2023

Looking forward. 👍

@felixvanoost felixvanoost changed the title WIP: Add D2 layout engine option Add D2 layout engine option Aug 11, 2023
@felixvanoost
Copy link
Contributor Author

@ggrossetie I finally had time to test this; results are in the PR description above. It's working!

@felixvanoost felixvanoost marked this pull request as ready for review August 11, 2023 20:57
@ggrossetie
Copy link
Member

That's quite nice 😍

@ggrossetie ggrossetie merged commit 5adac1c into yuzutech:main Aug 11, 2023
4 checks passed
@felixvanoost felixvanoost deleted the add-d2-layout-engine-option branch August 12, 2023 02:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support for alternate layout engine(s) in D2
3 participants