Skip to main content

Module html

Module html 

Source
Expand description

The mark of a formula on the HTML backend: what tells a stylesheet or a script of the page that an element is a formula, whichever processing feature wrote it.

Each processing feature (the module documentation of math, Processing mathematics) writes a formula into the page its own way: the TeX that a renderer in the reader’s browser typesets, MathML, text, a drawing. Whatever element it writes as a formula’s outermost element, that element carries the mark, and nothing is written around it for the mark’s sake:

  • the class of the role FORMULA_ROLE, flm-math-formula, after the feature’s own classes;
  • data-flm-display, inline or display;
  • for a display-math environment, data-flm-env, the environment’s name.

A stylesheet selects a formula as .flm-math-formula and a displayed one as .flm-math-formula[data-flm-display="display"]; a script finds the formula around an element with closest('.flm-math-formula'). The mark says what an element is and nothing of how it is written: whether a script of the page still has to transform the formula is that script’s business, under the conventions for a page updated in place (a page updated in place).

A feature that writes the outermost element as HTML tags (flm.pres.html.tag) gives it the attributes formula_attributes answers. The formulas of math-passthrough are flm.pres.math-passthrough nodes whose payload carries the role, and the HTML contract writes the role’s class and the payload’s display and env as these same attributes.

Constants§

FORMULA_ROLE
The role of a formula’s outermost element, flm.math.formula, whose class flm-math-formula marks a formula in an HTML page.

Functions§

formula_attributes
The attributes that mark the outermost element of a formula written as HTML tags: class, holding classes (the writer’s own classes, separated by spaces; empty for none) followed by the class of FORMULA_ROLE; data-flm-display, the name of display; and, when env names the display-math environment the formula is written as, data-flm-env.