asciidoctor / asciidoctor-kroki

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

[kroki-fetch-diagram] Configurable fetch dir #246

Open gquintana opened 3 years ago

gquintana commented 3 years ago

When kroki-fetch-diagram is enabled, the diagram is fetched in the current dir. I'd like to be able to select the target directory, for example images/kroki, containing downloaded diag-<hash>.svg files. In short, I'd like to have kroki-fetch-dir or kroki-images-dir which would be the default target folder and would override the default imagesdir when set.

ggrossetie commented 3 years ago

You can use imagesoutdir but the path used in the HTML is controlled by imagesdir. The imagesoutdir attribute tells Asciidoctor Kroki where to write the file. The imagesdir attribute tells the processor what to put in the HTML.

Is that what you are looking for?

I'm adding the documentation label since this is an undocumented feature 😅

gquintana commented 3 years ago

Thanks for pointing out the imagesoutdir attribute.

Given a document containing both handmade images and Kroki generated images. I'd like to be able to place images in different folders (the Kroki output directory can be Git ignored, can be pruned, can be a subfolder of the main imagesdir).

When I set imagesoutdir=kroki and imagesdir=main, images are fetched in the kroki directory (good start), but the HTML references them in the main directory, so they are 404 not found.

ggrossetie commented 2 years ago

As far as I know it's not supported by Asciidoctor. If you want to use this configuration then I think you will need to manually copy images to the imagesdir directory.

You should ask on https://asciidoctor.zulipchat.com/ maybe someone will have a better idea...

(sorry for the laaaaate reply!)