-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
text-anchor prevents MathML interpretation #3295
Comments
It is not clear what version of MathJax you are using (you didn't follow the instructions in the template for the issue you filed). So I can't tell if you are using v3 or v4. Version 3 doesn't implement HTML in MathML, but v4 does. However, because of the potential security issues of allowing unfiltered HTML in user-supplied expressions (either in TeX or MathML), MathJax v4 requires that you set a configuration option in order to enable this feature explicitly for MathML, and you have to load an extension for support in TeX. See the 4.0.0-alpha.1 release notes for details of this feature. Note, however, that your MathML would be better as <mtext href="#Sect.1">1</mtext> without the need for an HTML island inside the MathML. If you are using v3, it would probably be possible to make a MathML input jax pre-filter that transforms the |
Thanks for the tips about using v4. and (in the release notes) the
And here's a link to an example. Notice that there are 3 polyfills:
Now the Siteimprove validator complains about
An earlier devised polyfill Using these polyfills, as in the configuration given above, all seems good with Siteimprove That is, until one tries contracting and expanding mathematical expressions. When the input is from MathML, this issue does not occur. BTW, this explanation can be tested somewhat, using a local copy of the example. On a side note, after turning on Braille generation and reloading the page, Siteimprove now complains about the |
I think you are working harder than you need to, and are not taking advantage of the tools MathJax has for working with its output. A more straight-forward way to handle this would be to use the Here is an example configuration that does that. MathJax = {
mml: {
allowHtmlInTokenNodes: true
},
options: {
renderActions: {
adjust: [
250,
(doc) => {for (const math of doc.math) MathJax.config.adjustMath(math, doc)},
(math, doc) => MathJax.config.adjustMath(math, doc)
]
}
},
adjustMath(math, doc) {
const adaptor = doc.adaptor;
adaptor.setAttribute(math.typesetRoot, 'role', 'math');
for (const a of adaptor.tags(math.typesetRoot, 'a')) {
adaptor.setAttribute(a, 'tabindex', -1);
}
}
}; This sets up an action that comes after the math is typeset, inserted into the page, and has had the speech text attached. The Because this makes your code be part of the MathJax pipeline, you will get the proper result for both the initial typeset, and any subsequent typesetting, either from additional math added to the page, or if the renderer is changed, or if an expression is collapsed or reopened. So the timing of these actions is take care of automatically by using a render action. Not that the handling of the aria labels and roles may be changing in the next beta release, as there are other problems in addition to the missing role on the container, and we are trying to work out a solution that works more reliably in more screen-reader/browser/OS combinations. So some of this may need to be modified in the future. As for |
PS, you might also want to include <style>
mjx-container a * {
text-decoration: inherit;
}
</style> so that the usual underline will be used for the |
I really like it when you say I'm “working harder than I need to". :-) My overall aim is to get the best configuration for MathJax to handle TeX/LaTeX coding stored in Tagged PDF documents, when such structured documents are "derived" to HTML. There is a remaining problem with my example here, of an active link embedded in the math I don't see any easy way to avoid this, while maintaining the tree-like structure of the mathematical content. All the best. |
Not sure whether this is a bug-report, feature-request, or whether I've failed to find configuration options that handle the situation correctly.
MathJax fails to process this part of a MathML block, containing an HTML
<a href="..">
tag, which is otherwise handled correctly in modern browsers.Please see this GitHub site for a fuller discussion.
Scroll to the bottom to find images of both with and w/o using MathJax.
Conceptually this is about presenting mathematical content containing text snippets, particularly with hyperlinks and/or other HTML markup, within
<mtext>
content of a MathML block.It may require deeper analysis than just what is shown in this example.
The text was updated successfully, but these errors were encountered: