Skip to content
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

Mathjax contextual menu and accessibility #392

Open
mcmahanp opened this issue Dec 26, 2024 · 2 comments
Open

Mathjax contextual menu and accessibility #392

mcmahanp opened this issue Dec 26, 2024 · 2 comments

Comments

@mcmahanp
Copy link

Currently, it seems that Mathjax in marp renders math output as plain embedded SVG, disabling the contextual (right click) menu and most of the accessibility features.

Accessibility for screen readers is one of the major benefits of Mathjax. Accessibility is important for any public-facing web content, but especially so for teaching slides (which is my main use of marp).

The options in the contextual menu in Mathjax are also a huge feature of the library. Beyond adding even more accessibility, they let users zoom in on detailed equations and view the 'source' LaTeX for the equation -- both of these are huge benefits for slides distributed alongside a technical lecture.

It seems like some of these features are tied to rendering the math output as mathml versus SVG, but looking at the Mathjax documentation it seems many of the accessibility and context-menu features should also be possible with SVG.

Is it possible to enable these features (possibly as options) when using Mathjax in marp? Accessible math rendering should be the default, and having at least a configuration option to enable the contextual menu would be hugely helpful.

Apologies if I'm missing something here, I've looked pretty thoroughly through existing issues and done quite a bit of testing in both the VSCode addon and marp-cli.

Thanks! (And, while I'm here, thanks generally for the really fantastic framework. It's become an indispensable part of my workflow over the past couple of years!)

@yhatt
Copy link
Member

yhatt commented Dec 26, 2024

The rendering result by Marp Core excludes features that include the browser JavaScript, such as the MathJax context menu. This is to minimize the use of browser JavaScript in Marp Core's output, thereby reducing potential security issues that may bring from third-party libraries.

Additionally, as a core library, Marp Core must minimize situations where developers using it have to rely on specific JavaScript libraries. In this regard, the current design is reasonable because the output result is not required to rely on MathJax.js browser script.

The lack of accessibility in MathJax is indeed a problem, and if accessibility elements can be provided by the core by default without using browser JavaScript, it is worth considering.

Unfortunately, the maintainers are not experts in mathematics and MathJax, so I do not have sufficient knowledge on this issue (MathJax support is brought by a project contributor: #165). Any information to achieve this is welcome.

@mcmahanp
Copy link
Author

Thanks for the explanation. The tension between simplicity and features is tricky with something like marp, and I appreciate the need to keep javascript out of Marp Core. If I'm reading the accessibility documentation correctly, these features rely on javascript even for the SVG output.

I'll keep tinkering, possibly looking into having a more feature-full version of Mathjax in some kind of extension. I'll update here if I come up with anything useful :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants