asciidoctor / asciidoctor-vscode

AsciiDoc support for Visual Studio Code using Asciidoctor
Other
331 stars 97 forks source link

Failure to include PlantUML depending on the description method (v3.1.3) #765

Closed iosory7 closed 7 months ago

iosory7 commented 1 year ago

I love to use asciidoctor-vscode from v2.x.x, but I faced a trouble in v3.x.x use.

I tried to include plantuml file from asciidoc in different 3ways.

.
├── README.adoc
└── resources
    ├── main.puml
    ├── sub_a.puml
    └── sub_b.puml

README.adoc includes main.puml. And then main.puml includes both sub_a.puml and sub_b.puml.

One include description (sample1) is succeeded, but other two descriptions (sample2, sample3) are failed.
"Failed" means include files (sub_a.puml and sub_b.puml) are not expanded into preview and html.

:includedir: {docdir}/resources
:imagesdir: {docdir}/resources
:imagesoutdir: {docdir}/resources

:allow-uri-read:
:data-uri:

:kroki-server-url: https://kroki.io
:kroki-fetch-diagram:
:kroki-plantuml-include-paths: {docdir}/resources

= test for asciidoctor.js + plantuml w/kroki

== test
docdir = {docdir} +
kroki-server-url = {kroki-server-url} +
kroki-plantuml-include-paths = {kroki-plantuml-include-paths} +

=== sample1

[plantuml,format="svg"]
....
include::{includedir}/main.puml[]
....

=== sample2

plantuml::{includedir}/main.puml[format="svg"]

=== sample3

[plantuml,format="svg"]
....
!include main.puml
....
@startuml
state NotShooting
  !include sub_a.puml

state Configuring
  !include sub_b.puml

scale 350 width
[*] --> NotShooting

@enduml
```:sub_a.puml
state NotShooting {
  [*] --> Idle
  Idle --> Configuring : EvConfig
  Configuring --> Idle : EvConfig
}
state Configuring {
  [*] --> NewValueSelection
  NewValueSelection --> NewValuePreview : EvNewValue
  NewValuePreview --> NewValueSelection : EvNewValueRejected
  NewValuePreview --> NewValueSelection : EvNewValueSaved

  state NewValuePreview {
     State1 -> State2
  }
}

Same outputs are expected in all 3ways.

I got the same outputs using command line as follows: (I installed asciidoctor.js and asciidoctor-kroki manually)

asciidoctor -r asciidoctor-kroki README.adoc

Enviroment: Ubuntu 22.04 @ WSL2(Win10)

ggrossetie commented 1 year ago

kroki-fetch-diagram won't work in the VS code extension because it relies on unxhr to synchronously get the content. This is the same issue as: https://github.com/asciidoctor/asciidoctor-vscode/issues/731

Using :!kroki-fetch-diagram: produces the expected result:

image

iosory7 commented 1 year ago

Thank you for your investigation and reply.

I tried to use :!kroki-fetch-diagram:, but the same results were obtained when using :kroki-fetch-diagram:... image

If the :kroki-fetch-diagram: setting is the matter, shouldn't the include files not be expanded even with the sample1 method?

In my environment, kroki.io access is via proxy. Could this lead to a difference in results between you and me?

ggrossetie commented 11 months ago

In my environment, kroki.io access is via proxy. Could this lead to a difference in results between you and me?

I don't think so... Could you please copy/paste what you get from "Help > About"?

iosory7 commented 7 months ago

After that, I set up a kroki server on-premiss and set :kroki-server-url: to that server URL, and now it renders in each pattern of three! Thank you for your support.

ggrossetie commented 7 months ago

I'm glad that it's working for you. Should we close this issue? Do you think we should add something in the documentation?