yuzutech / kroki

Creates diagrams from textual descriptions!
https://kroki.io
MIT License
2.83k stars 211 forks source link

Provide support for other Graphviz layout commands #358

Closed danyill closed 2 years ago

danyill commented 3 years ago

Currently kroki appears only to support the dot command of Graphviz

https://github.com/yuzutech/kroki/blob/964b2ea3edfc603117d23b2e928106d66384e09b/server/src/main/java/io/kroki/server/Server.java#L85

I would be keen to have support for additional layouts (as described in the documentation)

In each case these could be the name of the graph, with graphviz remaining dot for backwards compatibility.

WDYT?

ggrossetie commented 3 years ago

I would be keen to have support for additional layouts (as described in the documentation)

I believe that the layout can be defined as a graph attribute: https://graphviz.org/doc/info/attrs.html#d:layout

The default layout is dot but I think it's possible to use another layout. For instance:

digraph g1 {
  layout="circo";
  // ...  
}

For reference, the layout can also be defined as a command line argument: https://graphviz.org/doc/info/command.html#minusK but Kroki does not (yet) support command line arguments. See: https://github.com/yuzutech/kroki/issues/169

In any case, I don't think we should add each layout as diagram types. In my opinion, the diagram type should be graphviz and the layout should be defined as part of the diagram source or as an attribute (not supported yet).

danyill commented 3 years ago

Thanks for the prompt response.

You are quite right, I hadn't noticed the layout= syntax.

I think it would be a useful feature to allow specification of this within an attribute to support DRY behavior (e.g. to produce different layouts with the same source file) but it is by no means urgent. For the mean-time the layout= option is just fine for me.

On Sun, Aug 30, 2020 at 3:25 AM Guillaume Grossetie < notifications@github.com> wrote:

I would be keen to have support for additional layouts (as described in the documentation)

I believe that the layout can be defined as a graph attribute: https://graphviz.org/doc/info/attrs.html#d:layout

The default layout is dot but I think it's possible to use another layout. For instance:

digraph g1 { layout="circo"; // ... }

For reference, the layout can also be defined as a command line argument: https://graphviz.org/doc/info/command.html#minusK but Kroki does not (yet) support command line arguments. See: #169 https://github.com/yuzutech/kroki/issues/169

In any case, I don't think we should add each layout as diagram types. In my opinion, the diagram type should be graphviz and the layout should be defined as part of the diagram source or as an attribute (not supported yet).

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/yuzutech/kroki/issues/358#issuecomment-683304974, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAFEXX26AJECJK5WAL7VXNDSDEMYNANCNFSM4QOW26NA .

--

-- Private or confidential message? Public Key available here https://pgp.mit.edu/pks/lookup?search=dan.mulholland%40gmail.com&op=index :

kukimik commented 2 years ago

Isn't this solved by #827 (see https://github.com/yuzutech/kroki/issues/827#issuecomment-891716477)?

ggrossetie commented 2 years ago

That's correct, thanks. It's now possible to specify diagram options: https://docs.kroki.io/kroki/setup/diagram-options/#_graphviz