asciidoctor / asciidoctor-kroki

Asciidoctor.js extension to convert diagrams to images using Kroki!
https://kroki.io/
MIT License
146 stars 47 forks source link

vega-lite read data from source #376

Open rasmusmk opened 2 years ago

rasmusmk commented 2 years ago

I am trying to make a plot using vega-lite included in kroki but have trouble with loading data from a csv in antora context. I have something like this but it cannot locate the csv file. Right now the same csv is placed in folders: pages, partials, attachements because I do not know how to specify where it is placed.

[vegalite]
----
{
  "$schema": "https://vega.github.io/schema/vega-lite/v5.json",
  "data": {"url": "lowpassfilter.csv"},
  "mark": "point",
}
----

I get this error:

Skipping vegalite block. Preprocessing of Vega-Lite view specification failed, because reading the local data file 'lowpassfilter.csv' referenced in the diagram caused an error:
Error: ENOENT: no such file or directory, open 'lowpassfilter.csv'
ggrossetie commented 2 years ago

You need to use an Antora resource ID:

[vegalite]
....
{
  "$schema": "https://vega.github.io/schema/vega-lite/v5.json",
  "data": {"url": "example$lowpassfilter.csv"},
  "mark": "point",
}
....

I just added a test case and it's working as expected. If you are using the Intellij extension it won't work in the preview. My guess is that the preprocessor is not compatible with this environment (Java/JRuby).

rasmusmk commented 2 years ago

Hi

Thanks. I thought I had tried it. But yes it works also for attachment, partial :-)

VS code asciidoc extension can also not show it in preview when have to load the data from file. But in antora it is ok :-)

Mvh Rasmus Kjeldmand

Den tir. 28. jun. 2022 kl. 16.02 skrev Guillaume Grossetie < @.***>:

You need to use an Antora resource ID:

[vegalite] .... { "$schema": "https://vega.github.io/schema/vega-lite/v5.json", "data": {"url": "example$lowpassfilter.csv"}, "mark": "point", } ....

I just added a test case and it's working as expected. If you are using the Intellij extension it won't work in the preview. My guess is that the preprocessor is not compatible with this environment (Java/JRuby).

— Reply to this email directly, view it on GitHub https://github.com/Mogztter/asciidoctor-kroki/issues/376#issuecomment-1168768842, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIM6FHEXBKZDVWEN6SOWTADVRMAYVANCNFSM52B6SBZQ . You are receiving this because you authored the thread.Message ID: @.***>

ggrossetie commented 2 years ago

VS code asciidoc extension can also not show it in preview when have to load the data from file. But in antora it is ok :-)

The VS Code extension does not have Antora support (yet) but we are working on it so this issue might be resolved in the future.

ggrossetie commented 2 years ago

I'm keeping this issue open to remind myself to document this feature.