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
342 stars 146 forks source link

Diagram not rendered when using opts=inline to a block #552

Closed bric3 closed 3 years ago

bric3 commented 3 years ago

AsciiDoc Plugin Version: 0.31.27

IDE Name and Version: 2020.2.2 RC

IntelliJ IDEA 2020.2.2 RC (Ultimate Edition)
Build #IU-202.7319.45, built on September 9, 2020
Licensed to Comuto SA / Brice Dutheil
Subscription is active until January 22, 2021
Runtime version: 11.0.8+10-b944.31 x86_64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
macOS 10.15.6
GC: ParNew, ConcurrentMarkSweep
Memory: 1631M
Cores: 8
Non-Bundled Plugins: com.github.weisj.darkmode, Error-prone plugin, Lombook Plugin, String Manipulation, com.intellij.bigdecimal-folding, com.thvardhan.gradianto, name.kropp.intellij.makefile, org.jetbrains.plugins.go-template, com.intellij.kubernetes, org.toml.lang, com.jetbrains.packagesearch.intellij-plugin, org.asciidoctor.intellij.asciidoc, org.jetbrains.plugins.go

For example with this svgbob (with the plugin options svgbob = /usr/local/bin/svgbob), but the issue happens for ditaa and plantuml as well. If opts=inline is in the options then the diagram is not rendered, but if removed the diagram renders properly.

.svgbob test
[svgbob,"svgbob-test",stroke-width=1,opts=inline]
----
       .---.
      /-o-/--
   .-/ / /->
  ( *  \/
   '-.  \
      \ /
       '
----

I wonder if this is due to JCEF ?

bric3 commented 3 years ago

Well I don't know... I had the issue for days, then I just switched to swing viewer then back to JCEF, and it started to work. ¯\_(ツ)_/¯

ahus1 commented 3 years ago

Thanks for sharing this. I might have fixed inlined SVG as part of issue #548, that ended up in pre-release 0.31.25 and stable-release 0.31.27.

JCEF preview now uses real SVGs, and the proper content-security-policy in the preview. If you find anything else that bothers you, please don't hesitate to open an issue.

ahus1 commented 3 years ago

I finally found the solution for this: the latest release of kroki requires "opts=inline", but asciidoctor-diagram requires "svg-type=inline". I updated the docs, and will raise this with asciidoctor-diagram.

It might appear to work when you open the browser preview and a temporary SVG is created. Hm.