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

Plantuml diagrams stopped working in pdf #1323

Closed LukeCz closed 1 year ago

LukeCz commented 1 year ago

Observed vs. expected behavior

Embedded diagrams rendered with Kroki (default public server) are displayed fine in preview but fail to rendered in pdf - replaced by broken links. The issue is that the embedded link in pdf is broken into multiple lines. In the example provided in the attachment the link is

[Diagram] |
https://kroki.io/plantuml/svg/eNpzKC5JLCopzc3hKs7OzCtILErMVQjJLMlJdcvPKwkuqcxJVcjLL8pNzOE
qAYkqqJalFhVn5udpaHI5pOalADUCAEw8GJc=

while it should be a single line. I.e. if you manually concatenate the 2 lines it is a valid URL but when opening in pdf viewer only the first line is clickable as a link.

Steps to reproduce

example.zip Just a simplest adoc file, does not matter if part of Antora structure or not. Kroki server enabled in settings with default (empty) URL.

Environment

Plugin Version: 0.38.12

IntelliJ IDEA 2023.1 (Community Edition) Build #IC-231.8109.175, built on March 28, 2023 Runtime version: 17.0.6+10-b829.5 amd64 VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o. Windows 10.0 GC: G1 Young Generation, G1 Old Generation Memory: 4006M Cores: 20 Non-Bundled Plugins: idea.plugin.protoeditor (231.8109.91) com.intellij.grazie.pro (0.3.214) org.asciidoctor.intellij.asciidoc (0.38.12)

Kotlin: 231-1.8.20-IJ8109.175

ahus1 commented 1 year ago

Thanks for reporting this. I had a look and found that this generated a warning in my IDE's notifications:

WARN uri:classloader:/gems/asciidoctor-pdf-2.3.4/lib/asciidoctor/pdf/converter.rb:resolve_image_path: cannot embed remote image: https://kroki.io/plantuml/svg/eNpzKC5JLCopzc3hKs7OzCtILErMVQjJLMlJdcvPKwkuqcxJVcjLL8pNzOEqAYkqqJalFhVn5udpaHI5pOalADUCAEw8GJc= (allow-uri-read attribute not enabled)

When setting the allow-uri-read attribute in the plugin's settings, this will work as expected:

image

I'll update the next version of the plugin that when Kroki is enabled, the allow-uri-read is set automatically for both PDF and HTML.

ahus1 commented 1 year ago

I prepared the change and it will be part of the next release. I also update the docs. I'll comment here once a pre-release is available.

ahus1 commented 1 year ago

This is part of pre-release 0.38.13. Please let me know if you still experience issues.

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