yuzutech / kroki

Creates diagrams from textual descriptions!
https://kroki.io
MIT License
2.79k stars 206 forks source link

Plantuml directive "!include" doesn't work #1638

Open vetalalien opened 10 months ago

vetalalien commented 10 months ago

Hi, there!

The issue preconditions:

  1. AsciiDoc plugin in PyCharm Community Edition 2022.2.3 (the plugin uses a local Kroki server - http://localhost:8088, look at it below).
  2. Some *.adoc file located at the some path (let it be named as path_to_files) with the next line inside: plantuml::example.puml[png].
  3. example.iuml and example.puml plantuml files located ath the path_to_files, the second one refers to the first one by !include directive of plantuml, look at the files contents here: 3.1 example_iuml.txt 3.2 example_puml.txt
  4. Local Kroki server works on my local machine (docker version), which is run by the next shell command: docker run -v path_to_files:path_to_files -eKROKI_SAFE_MODE=unsafe -eKROKI_PLANTUML_INCLUDE_PATH=path_to_files -eKROKI_PLANTUML_ALLOW_INCLUDE=true -p8088:8000 --name some-kroki -d yuzutech/kroki

I've faced with the next issue - the plantuml diagram example.puml is not rendered in the *.adoc file preview, instead there is the next error: Screenshot_20230902_005534

PS. I had to rename example.iuml and example.puml to example_iuml.txt and example_puml.txt correspondingly, because of there is no supporting with .iuml and .puml extenstions to be downloaded here.

gijsentius commented 7 months ago

Hi @ggrossetie and @vetalalien, I encountered exactly the same error. I did not discover that it broke due to the file extension. I have solved the problem by using a newer version of plantuml.

I have tested the solution by using the following Dockerfile.

FROM yuzutech/kroki:0.23.0

COPY plantuml /tmp/
COPY plantuml-1.2023.13.jar /tmp/plantuml.jar

ENV KROKI_PLANTUML_BIN_PATH=/tmp/plantuml

ENTRYPOINT exec java -jar /usr/local/kroki/kroki-server.jar

I have made a simple executable file containing the following.

java -jar /tmp/plantuml.jar $1

We use kroki version 0.23.0 and I saw that the version of plantuml in that docker image is 1.2023.11. I think if we release a newer version of plantuml (v1.2023.13) which I have tested in the docker image above the problem should be solved.

I will try to create a Merge Request in the yuzutech/plantuml repo and the kroki repository.

EDIT:

After forking the yuzutech/plantuml repo and building a new version of plantuml the problem does still exist.

io.kroki.server.error.BadRequestException: Cannot open URL (line: 2)

I think something with building the native images is going wrong, but I can't provide a solution.