Runtime module for mathematical notation interaction and polyfill.
Provides two features:
MathML polyfill -- detects whether the browser supports MathML natively.
If not, dynamically imports the hfmath library to render LaTeX as SVG,
using the hidden .math-source elements as the LaTeX source.
Equation reference interaction -- handles hover tooltips and click-to-scroll
for [[eref]] elements, showing a preview of the referenced equation
on hover and smooth-scrolling to the equation on click.
DOM interactions:
Listens for mouseenter (capture) on .eref to show equation tooltip
Listens for mouseleave (capture) on .eref to hide tooltip
Listens for click (capture) on .eref-link to scroll to the equation
On browsers without MathML: queries .math-render and .math-source
to apply SVG polyfill
The destroy() cleanup function removes all three event listeners.
Runtime module for mathematical notation interaction and polyfill.
Provides two features:
MathML polyfill -- detects whether the browser supports MathML natively. If not, dynamically imports the
hfmathlibrary to render LaTeX as SVG, using the hidden.math-sourceelements as the LaTeX source.Equation reference interaction -- handles hover tooltips and click-to-scroll for
[[eref]]elements, showing a preview of the referenced equation on hover and smooth-scrolling to the equation on click.DOM interactions:
mouseenter(capture) on.erefto show equation tooltipmouseleave(capture) on.erefto hide tooltipclick(capture) on.eref-linkto scroll to the equation.math-renderand.math-sourceto apply SVG polyfillThe
destroy()cleanup function removes all three event listeners.