asciidoctor / asciidoctor-intellij-plugin

AsciiDoc plugin for products on the IntelliJ platform (IDEA, RubyMine, etc)
https://intellij-asciidoc-plugin.ahus1.de/
Apache License 2.0
355 stars 145 forks source link

OpenIconic's in embedded PlantUML's not shown #1446

Closed HaLo1701 closed 1 year ago

HaLo1701 commented 1 year ago

Observed vs. expected behavior

I have a problem by using OpenIconic's in embedded PlantUML's. I am not sure since when the problem occurs and if it is a problem of the plugin.

Steps to reproduce

Using the testcall shows the problem:

grafik

The usage of an single icon results in not rendering the icon:

grafik

Environment

Plugin Version: 0.40.4

IntelliJ Details: IntelliJ IDEA 2023.2.1 (Ultimate Edition) Build #IU-232.9559.62, built on August 23, 2023 Licensed to nextN GmbH / Hans Lohuis You have a perpetual fallback license for this version. Subscription is active until September 28, 2024. Runtime version: 17.0.8+7-b1000.8 amd64 VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o. Windows 11.0 GC: G1 Young Generation, G1 Old Generation Memory: 4056M Cores: 28 Registry: debugger.new.tool.window.layout=true ide.experimental.ui=true

Non-Bundled Plugins: MultiHighlight (3.1.0) com.khmelyuk.multirun (1.13) AceJump (3.8.16) indent-rainbow.indent-rainbow (2.2.0) com.intellij.kubernetes (232.9559.34) youngstead.relative-line-numbers (1.1.1) com.jetbrains.jax.ws (232.8660.142) com.intellij.javaee.webSocket (232.8660.142) com.antoshk.jsf-el-extension-plugin (0.2.3.1) com.intellij.javaee.ejb (232.8660.142) PlantUML integration (7.2.0-IJ2023.2) com.intellij.jsf (232.8660.142) org.asciidoctor.intellij.asciidoc (0.40.4) com.intellij.javaee.batch (232.8660.142) izhangzhihao.rainbow.brackets.lite (1.0.1) zielu.gittoolbox (500.0.21+222)

Kotlin: 232-1.9.0-IJ9559.62

Many thanks in advance.

ahus1 commented 1 year ago

I had a look and while the SVG images are included in the GPLv2 licensed version of PlantUML, and while they included them in 1.2023.7 on SourceForge, they stopped distributing them in their GitHub builds in 1.2023.10

[plantuml,format=svg]
----
@startuml
version
@enduml
----

Looking at the license, it seems that the ASL license mentions the OpenIconic icons, so it might be a bug.

[plantuml,format=svg]
----
@startuml
license
@enduml
----

I'll raise an upstream issue, please follow up on the upstream issue.

HaLo1701 commented 1 year ago

Hello @ahus1, many thanks for your really greate support on this and I am happy to post it to you. I will follow the upstream issues and wait for response.

ahus1 commented 1 year ago

There is now a pre-release 0.40.5 which downgrades PlantUML. In my local tests this fixed the icons for me. Please give it a try.

The pre-release of the plugin is available from GitHub releases and the IntelliJ AsciiDoc EAP repository.

HaLo1701 commented 1 year ago

Hi @ahus1, many thanks for the fast update. In the preview it works fine, but if I generate a PDF, the icons still not occur:

grafik

This happens, if I use the generate PDF button or when I am using the command asciidoctor-pdf.

Is there still any thing, I have to update too?

Many thanks again.

ahus1 commented 1 year ago

Then you for the additional tests, I think I found the problem:

When creating a PDF with a diagram from the command line, Asciidoctor Diagram creates a temporary file like diag-plantuml-md5-fff6b14249f6a79d5057685459bd6e86.svg. This allows Asciidoctor Diagram to cache the results. This temporary file's hash doesn't change with the version of Asciidoctor Diagram and Asciidoctor PDF, it only depends on the diagrams source contents.

So while the IDE or the CLI might be a new or an old version, they will always take the cached file.

Please try again to delete the cached file before creating the PDF in the IDE and creating it on the command line.

When creating a HTML from the browser, it makes sense to keep the images locally as they will be needed for the preview. This behavior was then copied to the PDF generation, where it doesn't make sense.

The next version of the plugin will for PDF keep all temporary files in a temporary folder. For the HTML creation, it will force the regeneration of diagrams when creating HTML even if no temporary folder is used there.

If you want to enforce the diagram re-generation on the command line, set the attribute diagram-nocache-option.

I hope you can workaround this for now by deleting the temporary files once, and again when using the CLI to create the PDF. In a few days there should be a new pre-release available which resolves this without deleting temporary files.

HaLo1701 commented 1 year ago

Many thanks for your response.

My problem now is the following:

When I am deleting the temporary files and creating the PDF with the IDE, the diagrams are generated correct. When I am generating it with the CLI, the problem still occurse. If you have a tip, please let me know, because in the CLI I specify a different theme, that I need.

My workaround is creating it at first with the IDE, and then with the CLI, because the second step uses the temporary generated correct diagrams from the first step.

If I do it in the other way (first CLI and then IDE), the diagrams are still wrong in the generated PDF.

The preview works fine.

Many thaks again for your excelent help.

ahus1 commented 1 year ago

There is now pre-release 0.40.6 available which will

To make it work from the CLI, you'll need to install (downgrade) the gem asciidoctor-diagram-plantuml in version 1.2023.5.

FYI, you can also specify a theme for the PDFs in your IDE (if this is the theming you had in mind here). One can reference the themes as AsciiDoc attributes. There is example in the docs which is a bit dated, but should show the direction.

Please let me know if this helps and if this issue can be closed.

The pre-release of the plugin is available from GitHub releases and the IntelliJ AsciiDoc EAP repository.

HaLo1701 commented 1 year ago

Hello,

many many thanks. It works again.

I have downgraded the gem package and it works again.

Your tip for the theme and so on I will take a look, because the creation of the temp files in the IDE no more in the project folder generation is very good.

I will have a look on this separatly, but the issue is solved.

Many thanks for your excelent and fast support.

HaLo1701 commented 1 year ago

Hello @ahus1, I have tested your tip to use the directives pdf-themesdir, pdf-theme and pdf-fontsdir. Many thanks, this works as expected. The only thing, that I have also used in the CLI is the parameter "-a compress" in the asciidoctor-pdf command to make the resulting pdf smaller. Is there also a chance to specify this in the source or in any configuration? If you want, I can create an additional issue or feature request about this. Many thanks in advance.

ahus1 commented 10 months ago

@HaLo1701 - a late reply to your question: The -a compress is setting an attribute on the command line. You can do the same in the plugin's configuration in your IDE's settings - see below.

I tried locally, and it seems that I can't set the attribute inside a document, and using the plugin's settings is the suggested way for those cases.

I don't want to make this the default in the plugin, as it is also not the default on the command line, and it would then confuse users.

image

HaLo1701 commented 10 months ago

Hello @ahus1, many thanks for your response. I have tried it out and it works fine. I can follow your argumentation about the default settings. For me it works as expectet. Many thanks for your explanations.