asciidoctor / asciidoctor-kroki

Asciidoctor.js extension to convert diagrams to images using Kroki!

Home Page:https://kroki.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

vega-lite read data from source

rasmusmk opened this issue · comments

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'

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).

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.

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