ALT-text for images in HTML/EPUB export

Hello again, When providing an alt-text for images like so (which works for PDFs): \setupexternalfigures[location=default] \setupbackend[export=yes,xhtml=yes] \setupinteraction [state=start] \starttext \startchapter[title=Example] \startsection[title={Section}] \placefigure {} {\externalfigure[hacker.jpg][ label={Look, a $e^{\pi i}+1=0$ hacker!}] } \stopchapter \stoptext the figure becomes in the HTML export <div class="float figure method-here" id="aut-3"> <div class="floatcontent"><div class="image label-Look, a $e^{\\\\pi i}+1=0$ hacker!" id="export-example-image-1" image="export-example-image-1"><!--empty--></div></div> <div class="floatcaption"><div class="floatlabel figure">Figure </div><div class="floatnumber figure">1.1</div></div> </div> How do I turn this into an ALT text in the HTML? Or how do I have to provide the Alt text correctly? And what do I do about Alt texts that contain math? The \\\\pi looks a little strange⦠Thanks once again, Matthias

On 7/14/2025 12:44 AM, Matthias Weber wrote:
Hello again,
When providing an alt-text for images like so (which works for PDFs):
\setupexternalfigures[location=default]
\setupbackend[export=yes,xhtml=yes]
\setupinteraction [state=start]
\starttext
\startchapter[title=Example] \startsection[title={Section}]
\placefigure {} {\externalfigure[hacker.jpg][ label={Look, a $e^{\pi i}+1=0$ hacker!}] }
\stopchapter
\stoptext
the figure becomes in the HTML export
<div class="float figure method-here" id="aut-3"> <div class="floatcontent"><div class="image label-Look, a $e^{\\\\pi i}+1=0$ hacker!" id="export-example-image-1" image="export-example-image-1"><!--empty--></div></div> <div class="floatcaption"><div class="floatlabel figure">Figure </div><div class="floatnumber figure">1.1</div></div> </div>
How do I turn this into an ALT text in the HTML? Or how do I have to provide the Alt text correctly? And what do I do about Alt texts that contain math? The \\\\pi looks a little strangeā¦
labels actually end up as class entry which is what labels were for: identifier so we have to reconsider using label and find another key instead, like 'comment' or 'description' or so, something that is not yet used as we might need it in more places .. maybe comment is best left for something not interpred so 'description' could work ... given wolfgangs blessing adding it to the export is a few lines (escaping is a different discussion) Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl -----------------------------------------------------------------

Am 14.07.2025 um 08:44 schrieb Hans Hagen via ntg-context:
so we have to reconsider using label and find another key instead, like 'comment' or 'description' or so, something that is not yet used as we might need it in more places .. maybe comment is best left for something not interpred so 'description' could work ... given wolfgangs blessing
description is unused as a key and a better name than comment but extending it to descriptiontext leaves room for more ...text keys, e.g. alternativetext to set different strings for pdf and xml. Wolfgang

On 7/14/2025 10:58 PM, Wolfgang Schuster wrote:
Am 14.07.2025 um 08:44 schrieb Hans Hagen via ntg-context:
so we have to reconsider using label and find another key instead, like 'comment' or 'description' or so, something that is not yet used as we might need it in more places .. maybe comment is best left for something not interpred so 'description' could work ... given wolfgangs blessing
description is unused as a key and a better name than comment but extending it to descriptiontext leaves room for more ...text keys, e.g. alternativetext to set different strings for pdf and xml.
I'll add these to externalfigure then (instead of using label for it). Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl -----------------------------------------------------------------
participants (4)
-
Hans Hagen
-
Hans Hagen
-
Matthias Weber
-
Wolfgang Schuster