This question is something of a follow-up to tex4ht: customize \includegraphics conversion to HTML and also to When generating html, how do you specify image size?
background
In my .tex file I specify images to be included as follows:
\includegraphics[alt={alt tags, information}]{example-image-a}
and have theimg element wrapped in its own container:
<div class="figure"><!--l. 7-->
<p class="noindent"></p>
<div class="my-box"><img src="mwe0x.png" alt="PIC" class=
"my-class" /></div>
<!--l. 8-->
<p class="indent"></p>
</div>
I use the following cmh.cfg:
\Preamble{html5}
\makeatletter
\define@key{Gin}{alt}{}
\Configure{GraphicsAlt}{my alt text}
\Configure{graphics}
{\HCode{<div class="my-box">}%
\Picture+[PIC]{ class="my-class"}}
{\EndPicture \HCode{</div>}}
\begin{document}
\EndPreamble
and produce the html output above using the call:
make4ht -u -f html5 -c cmh.cfg mwe.tex
goal
I'd like to have the ALT tag updated from the includegraphics call.
I've tried the following modification to cmh.cfg
\Picture+[\a:GraphicsAlt]{ class="my-class"}}
but this results in
Missing $ inserted
the question
How can I change my cmh.cfg file so that the img element receives custom alt tags and my custom class?
mwe.tex
\documentclass{article}
\usepackage{graphicx}
\begin{document}
here is some text
\begin{figure}
\includegraphics[alt={descriptions,info}]{example-image-a}
\end{figure}
\end{document}
cmh.cfg
\Preamble{html5}
\makeatletter
\define@key{Gin}{alt}{}
\Configure{GraphicsAlt}{my alt text}
\Configure{graphics}
{\HCode{<div class="my-box">}%
\Picture+[PIC]{ class="my-class"}}
{\EndPicture \HCode{</div>}}
\begin{document}
\EndPreamble
call
make4ht -u -f html5 -c cmh.cfg mwe.tex