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 support for ELK layout engine #458

Open
StephanPirnbaum opened this issue Mar 19, 2024 · 2 comments
Open

Add support for ELK layout engine #458

StephanPirnbaum opened this issue Mar 19, 2024 · 2 comments

Comments

@StephanPirnbaum
Copy link

For better layout of PlantUML diagrams, I mostly use ELK (Eclipse Layout Kernel). As ELK is not part of the official PlantUML distribution, using asciidoctor-diagram cannot render such diagrams. This issue can easily circumvented when e.g. using the asciidocotr Maven plugin by simply adding the following ELK libraries as a dependency to the plugin.

<dependency>
    <groupId>org.eclipse.elk</groupId>
    <artifactId>org.eclipse.elk.core</artifactId>
    <version>0.7.1</version>
</dependency>
<dependency>
    <groupId>org.eclipse.elk</groupId>
    <artifactId>org.eclipse.elk.alg.layered</artifactId>
    <version>0.7.1</version>
</dependency>
<dependency>
    <groupId>org.eclipse.elk</groupId>
    <artifactId>org.eclipse.elk.alg.mrtree</artifactId>
    <version>0.7.1</version>
</dependency>
<dependency>
    <groupId>org.eclipse.elk</groupId>
    <artifactId>org.eclipse.elk.graph</artifactId>
    <version>0.7.1</version>
</dependency>

However, when e.g. using the https://github.com/asciidoctor/asciidoctor-intellij-plugin this way of providing additional libraries is not possible. Following the ELK discussions and timeline around PlantUML, I don't see that it will be integrated soon into PlantUML itself.

Therefore, it would be great if asciidoctor-diagram could bring the dependencies to ELK itself and thus support a third layouting option besides GraphViz and Smetana for many tools built on top of asciidoctor-diagram.

@pepijnve
Copy link
Member

@ahus1 I think this is feature request for you.

@ahus1
Copy link
Contributor

ahus1 commented Dec 23, 2024

I had a look during the holidays, and this is what I found:

  • For the IntelliJ plugin, you can put extra JARs for rendering the preview in a project specific folder .asciidoctor/lib. See the docs for details. This would then also work for the ELK classes - but that is not sufficient for the current version.
  • The current version of ELK applies serviceloader mechanisms to register the layouts, and those use the root class loader for this. I submitted a fix for that, see Use ELK's classloader, not root classloader to discover services eclipse-elk/elk#1109
  • As of today, ELK is not included in the very latest version of the PlantUML JARs, still: It is the EPL version, not the LGPL version as this project uses. Not sure how @pepijnve will want to handle this.

In the meantime:

  • use https://github.com/ahus1/elk-patched-for-plantuml to build a JAR
  • place the JAR .asciidoctor/lib
  • confirm the warning to load the JAR (necessary every time you restart your IDE)
  • possibly reopen the current AsciiDoc file
  • Enjoy - see screenshot below.

As a follow-up, please create an issue in the https://github.com/asciidoctor/asciidoctor-intellij-plugin. Still I don't think I'll include it until the service loader mechanism is working also in custom class loaders. It might be possible to call the registration manually, still I'd like to avoid that. Let's see what the ELK project decides.

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants