Skip to content

Embedding MathML in the output

Peter Krautzberger edited this page Mar 25, 2015 · 2 revisions

For context: https://github.com/mathjax/MathJax/issues/938

Assistive technology (AT) tools (and potentially other tools) need to access MathJax's internal MathML more easily. In particular, AT usually cannot inject JavaScript into the page but can traverse the DOM.

Some background.

  • MathJax attaches ids to all elements of its output (for various reasons)
    • if the source includes an id (e.g., a MathML element), this id will be re-used for the corresponding element in the output.
  • The new CommonHTML output can be highlighted directly, a highlighting extension for the HTML-CSS output is in the works.

Proposal(s)

  • Structure of the exposed MathML

    • The exposed MathML will correspond to the internal MathML used to generate the output (not necessarily identical to the source)
    • Each MathML element will carry an id ( if preferred: a data-* attribute) corresponding to the id of the element corresponding to it in the output.
    • This allows AT to easily link the MathML structure with the output structure.
  • Options for embedding

    1. Add a data-mathml attribute with serialization of the MathML (with ids)
    • mapping to output
    • AT will serialize anyway (true?)
    • simpler implementation, better performance
    1. Add hidden MathML directly (without ids)
    • MathML is in the DOM
    • accessible to DOM exploration
    • no mapping to rendering
    • rendering needs to be hidden (or aria-describedby used but as discussed this has other problems)
    • could be made to work with VoicOver
    1. Add hidden <object> element containing the MathML (with ids).
    • MathML in the DOM
    • accessible to DOM exploration
    • retaining a direct mapping via the ids (since <object> elements are a separate document there is no conflict).

The team is leaning towards (i.) but we want to implement what works best for AT (or more pricesly, its users).

Clone this wiki locally