asciidoctor / asciidoctor-vscode

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

VS Code Preview does not work when local Kroki server is configured. #791

Closed spikeguru closed 11 months ago

spikeguru commented 1 year ago

Hi folks, I configured the asciidoc extension using a local kroki server. I added the settings that (1) the local server is used when the VS Task is executed and (2) that the preview is using the local server as well. The VS workspace configuration does look like that:

    "settings": {
        "asciidoc.asciidoctor_command": "C:/develop/gist/tools/ruby/bin/asciidoctor.bat -r asciidoctor-kroki -o-",
        "asciidoc.pdf.asciidoctorPdfCommandPath": "C:/develop/gist/tools/ruby/bin/asciidoctor.bat",
        "asciidoc.pdf.asciidoctorPdfCommandArgs": ["-r asciidoctor-kroki", "-r asciidoctor-pdf", "-a kroki-server-url=http://wded5115:8000/", "-a allow-uri-read", "-b pdf"],
        "asciidoc.use_asciidoctor_js": false,       
        "asciidoc.enableErrorDiagnostics": true,
        "asciidoc.extensions.enableKroki": true,
        "asciidoc.preview.asciidoctorAttribute": {          
            "kroki-server-url": "http://wded5115:8000"
        },

When executing the VS task, the diagram are fetched successfully from the local server but in the VS Code preview function the diagrams are not rendered and I only get a empty image file sign displayed. When requesting a test diagram by URL in the browser, it gets rendered as expected. I tested it with using a proxy and checked traffic with wireshark but I can not find the root cause of the problem. Do you have any idea what I am missing to get the preview successfully running with a local kroki server instance? As we generate confidential diagrams it is important for us to not use the public server. Thanks in advance!

ggrossetie commented 1 year ago

Are you using kroki-fetch-diagram ? Did you try to set allow-uri-read in asciidoc.preview.asciidoctorAttribute ? Did you try to disable preview security ?

I tested it with using a proxy and checked traffic with wireshark but I can not find the root cause of the problem

Did you see requests sent to your Kroki server ?

spikeguru commented 1 year ago

Hi, thanks a alot for your recommendations. I enabled allow-uri-read and kroki-fetch-diagram in the preview settings and it works now. I did not find these possible setting values of asciidoc.preview.asciidoctorAttribute explicitly in docs of the vscode extension documentation. Did I just miss them? Otherwise it would be nice to have them added.

ggrossetie commented 11 months ago

The documentation for Asciidoctor Kroki is here: https://github.com/ggrossetie/asciidoctor-kroki#readme Feel free to open a pull request to improve the documentation of the VS Code Extension or the Asciidoctor Kroki.