asciidoctor / asciidoctor-kroki

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

Create more similar HTML compared to asciidoctor-diagram (width and height attributes of img element) #99

Closed stenzengel closed 2 years ago

stenzengel commented 4 years ago

Split of #13 to simplify tracking. The sample Asciidoctor input and the generated HTML output of asciidoctor-diagram and asciidoctor-kroki can be found there.

This issue only considers differences in the "width" and "height" attribute: asciidoctor-diagram sets the image "width" and "height" on the element. Kroki does not set these attributes.

ggrossetie commented 4 years ago

With https://github.com/Mogztter/asciidoctor-kroki/pull/95 if the block has explicit width and/or height attributes they will be preserved.

The remaining issue is to infer the width and height from the generated image when width and height are not explicitly defined. In this case, Asciidoctor Diagram does the following:

PNG https://github.com/asciidoctor/asciidoctor-diagram/blob/66876e9c11c401eec943ff6968cd0c5f6c443906/lib/asciidoctor-diagram/util/png.rb#L9-L22

GIF https://github.com/asciidoctor/asciidoctor-diagram/blob/66876e9c11c401eec943ff6968cd0c5f6c443906/lib/asciidoctor-diagram/util/gif.rb#L10-L18

SVG https://github.com/asciidoctor/asciidoctor-diagram/blob/66876e9c11c401eec943ff6968cd0c5f6c443906/lib/asciidoctor-diagram/util/svg.rb#L7-L24

ggrossetie commented 2 years ago

I've created a dedicated issue, closing.