LukeCarrier / mkdocs-drawio-exporter

Exports your Draw.io diagrams at build time for easier embedding into your documentation
https://pypi.org/project/mkdocs-drawio-exporter/
MIT License
77 stars 8 forks source link

Alt-Text from draw.io document text #48

Open DennyWebb opened 1 year ago

DennyWebb commented 1 year ago

Feature consideration/request: Parse the draw.io document for all text, then embed that text as the alt text of the image so that searches/search engines can parse it and make image contents searchable.

LukeCarrier commented 6 months ago

Hi @DennyWebb, thanks for the suggestion. Whilst I appreciate this was some time ago, is there any chance you'd be able to provide some example source diagrams containing the alternate text and what you'd expect the summary to be?

My understanding is that it's generally better to limit alt attribute text to ~150 characters, as it could otherwise be a hassle to users of screen readers. I would imagine we'd be better off using HTML <figure> and <figcaption> for that purpose.

Some possibly helpful context:

DennyWebb commented 6 months ago

Sure! Sort of... without giving away anything sensitive, imagine a draw IO that's one network diagram out of a dozen or so different ones across a large organization... so servernames, workstation names, switch names, etc all over the place in the draw file. Then, I have a report of a machine acting up, I can quickly go and search to find the draw image without having to dig to figure out which department that machine is hosted in.

Granted, this can also be solved by better naming conventions/etc to make these things more obvious... but... people are people.

For a more specific example: In my specific case it was actually a function name from an error log, and trying to find which application that function existed in. There were some issues with the logging so we weren't getting a complete picture.

The figcaption is a great suggestion. Really it wouldn't even have to be on the image itself though, just at the page level as something that would make the site search identify that page as containing the content, regardless on if it's actually displayed.

LukeCarrier commented 6 months ago

Since the primary concern here is making the text from diagrams searchable, I think the path of least resistance is #40, where we'll make it possible to inline the contents of an exported SVG rather than embedding it as an <object>/<img>.

LukeCarrier commented 5 months ago

Closed #40 in favour of #56, which should land in v0.9.0. Unfortunately it doesn't look as though the search indexer recurses into <svg> elements to find the text, so I need to troubleshoot this a little further.

I'm going to keep this out of the next release for now, but will try to get back around to it soon. I suspect this might need some changes to MkDocs itself.