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

Title attribute is not used as the alt value on the <img> tag (Ruby)

Curtisjk opened this issue · comments

I am looking to set alt text for accessibility reasons on generated diagrams. We originally put a human-readable description in the target, but this gets put into the filename and nginx generally doesn't like spaces in URIs.

I can see in the code there is provision to set alt text using attr.title but I am not sure if this is supported fully? I attempted the following:

[plantuml,target-name,svg,title="Title Alt Text"]
....
Bob -> Alice : hello
....

But this still resulted in the following HTML:

<div class="content">
<img src="images/target-name-648[...].svg" alt="target-name">
</div>
<div class="title">Figure 1. Title Alt Text</div>

Any guidance here would be greatly appreciated :)

Hey, are you using the Ruby or JavaScript library?

Using the browser extension, it produces:

<div class="imageblock kroki">
<div class="content">
<img src="https://kroki.io/plantuml/svg/eNpzyk9S0LVTcMzJTE5VsFLISM3JyQcAPHcGKw==" alt="Title Alt Text">
</div>
<div class="title">Figure 1. Title Alt Text</div>
</div>

We are using the version provided by the docker-asciidoctor container - which I believe is the ruby version?

And we should probably add some documentation about this logic 😉

Thanks @Mogztter - I will work on the PR later this week.