Hmm, when I try (as hacker.tex) 

\setupexternalfigures[location=default]

\startsetups[document:start]
    \setupinteraction[
        title=\documentvariable{title},
        author=\documentvariable{author},
    ]
\stopsetups

\setupbackend[export=yes,xhtml=yes]

\setupexport
  [svgstyle=mathtest-style,
   hyphen=yes,
   width=60em]
   
 \enabledirectives[export.css.hyphens=yes]
\enabledirectives[export.css.textwidth=100em]
  

\starttext


\placefigure
[force]
[figure:crc2]
{Hacker}   
{\externalfigure[hacker.jpg][width=.6\textwidth,
alternativetext={
A lot of math: $\int_0^\infty e^{-x^2}\, dx=\frac12 \sqrt\pi$
}]}

\stoptext


The exported file hacker-div.html 

— is missing something like <html lang="en" data-theme="light”> 

— links only 

<link type="text/css" rel="stylesheet" href=“styles/hacker-defaults.css" />
<link type="text/css" rel="stylesheet" href="styles/hacker-images.css" />
<link type="text/css" rel="stylesheet" href="styles/hacker-fonts.css" />
<link type="text/css" rel="stylesheet" href="styles/hacker-styles.css" />


but should also link to

<link type="text/css" rel="stylesheet" href="styles/hacker-templates.css" />

— has the following for the image

<div class="floatcontent"><div alt=" A lot of math: $\\\\int _0^\\\\infty 
e^{-x^2}\\\\, dx=\\\\frac 12 \\\\sqrt \\\\pi $ " class="image label-hacker.jpg" 
id="Exporttest-image-1" image="Exporttest-image-1"><!--empty--></div></div>

This shows the image, but the alt tag is not readable. One can test this by 
removing/renaming hacker.jpg from the images directory. 
It seems the alt tag only works inside <img>. So changing <div alt …>  <img alt 
… > works.
It might break other things. 
And then there is the question whether alt texts should contain math. It’s 
probably best to just use plain text in alt texts.

Thanks, 

Matthias


PS: I just tried 

\usemodule[math-goodriddance] \goodriddancemath

Yes, that is what I was looking for, but it looks like it is only working for 
inline math?




> On Jul 26, 2025, at 5:23 PM, Hans Hagen via ntg-context <ntg-context@ntg.nl> 
> wrote:
> 
> On 7/26/2025 4:14 PM, Matthias Weber wrote:
>>  Thank you, I look forward to testing any new export features.
>> In my attempts to create accessible documents using ConTeXt sources, my 
>> current approach is to create an HTML file using ConTeXt, which I then 
>> manually tweak.
>> The style sheets that ConTeXt provides are wonderfully easy to adapt, even 
>> for a beginner like me.
>> To make the HTML file accessible, some manual editing has to happen, and 
>> maybe there is something that can be done to make it easier.
>> Below are some observations/comments/questions.
>> Thanks for all the work you do!
>> 1) Screen readers rely on header tags <H1> .. </H1>, etc, while ConText uses 
>> style sheets to provide a more customizable header structure. So I have to 
>> change the ConTeXt headers to
>> <H1> .. </H1>. That’s about 50-100 lines of manual HTML editing, not too bad
> 
> we could have some post processing options, i don't want to spoil the generic 
> approach (likely driven from the already there lua specification file)
> 
> btw, what is actually missing from html is a way to avoid <a> as there is no 
> field in css to tag an element as such (which to me is quite an omission 
> although there seem to have been a moment when it was supported, and we don't 
> want to mess with javascript)
> 
>> 2) The HTML is missing one style sheet: add
>> <link type="text/css" rel="stylesheet" href=“styles/file-templates.css" />
> 
> ?
> 
>> 3) The label={text} parameter for images that provides tags for PDFs becomes 
>> in HTML
>> <div class="image label-{text} >,
>> which has to be manually changed to the ALT-tag in HTML
> 
> wasn't that fixed? we now have descriptiontext and alternativetext keys 
> instead
> 
>> 4) All PDF files have to become SVG. I have not been able to set this up so 
>> that the export to HTML recognizes them and that the created PDF displays 
>> them; it has been an either-or.
> 
> should work although we have a fix for sub documents coming
> 
>> 5) There are problems with links within the document (using \in etc), they 
>> don’t consistently work in the HTML: The ones to sections work, the ones to 
>> theorems, etc don’t. I provided a minimal example earlier.
> 
> just collect these examples so that we can check them all at once
> 
>> 6)I haven’t heard back from our librarian, who does accessibility checks, 
>> about whether the math is deemed to be accessible. The MATHML appears fine, 
>> and I can also see the spelled-out text in the HTML. I am wondering whether 
>> it is possible to have an accessible text-only HTML export from Context that 
>> replaces every image with its alternative text and every math element with 
>> the spelled-out version ConTeXt creates, along with all navigational 
>> elements.
> 
> they are probaby clueless ... all this math has been constantly changing for 
> decades so maybe they decided not to burn their hands on it (and i'd expect 
> libraries to demand specific variant documents for the target audience 
> anyway) .. maybe you should ask / look around for users
> 
>> I have not been able to use the MathBlobs tracker for anything but 
>> footnotes. Maybe there is a way (using modes) to replace all math with 
>> spelled-out math, and all figures with their alt-texts?
> 
> too long ago ... maybe mikael remembers becuase i think we played with that 
> (text under formula or so) ... maybe you mean one of our secret undocumented 
> features:
> 
> \usemodule[math-goodriddance] \goodriddancemath
> 
> (no need to enable tagging as that does it sort of)
> 
> 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
> -----------------------------------------------------------------
> ___________________________________________________________________________________
> If your question is of interest to others as well, please add an entry to the 
> Wiki!
> 
> maillist : ntg-context@ntg.nl / 
> https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
> webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
> archive  : https://github.com/contextgarden/context
> wiki     : https://wiki.contextgarden.net
> ___________________________________________________________________________________

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________

Reply via email to