asciidoctor / asciidoctor-kroki

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

Generate image with link to self (anchor tag with image URL) #258

Open mikaello opened 3 years ago

mikaello commented 3 years ago

I am using this package to generate a SVG image for my Excalidraw diagram:

[excalidraw]
------
include::example$flow-diagram.excalidraw[]
------

This works fine, but the problem is that this flow diagram is quite big, so it would be useful to be able to click the diagram and get the full image (just showing the raw image in another tab would be perfect). I have tried many versions of adding the link attribute, but couldn't get anything to work.

What would be nice was if there was anything like this:

[excalidraw, link=%self%]
------
include::example$flow-diagram.excalidraw[]
------

So the generated image was contained in an anchor tag with the image source link as URL.

I could of course add the generated image URL as a link attribute, but since the generated URL changes every time the Excalidraw diagram is changed this is error prone.

Maybe it already exist a feature like this?

ggrossetie commented 3 years ago

That's a good idea and it's somehow related to: https://github.com/asciidoctor/asciidoctor/issues/3656 Having said that, I think we can implement this feature ahead of time since we create an Image block.

What would be nice was if there was anything like this: [excalidraw, link=%self%]

I think we should use the value self instead of %self% but otherwise 👍🏻

ggrossetie commented 2 years ago

Once Asciidoctor 2.1 will be released, this feature will be available since we pass the link attribute to Asciidoctor core.