asciidoctor / asciidoctor-kroki

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

Create more similar HTML compared to asciidoctor-diagram (alt attribute of img element) #98

Closed stenzengel closed 3 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 "alt" attribute: asciidoctor-diagram replaces the "-" character in "my-filename" with " " in the "alt" attribute. Kroki does no replace this character.

ggrossetie commented 4 years ago

It should be an easy fix if someone wants to give it a try. The corresponding code is:

https://github.com/Mogztter/asciidoctor-kroki/blob/ed320a5b10c619fcd2e2ad5dc397c011892f67ff/src/asciidoctor-kroki.js#L89-L96

So if attrs.target is defined, we should do alt = attrs.target.replace(/-/g, ' ').