mathjax

Last modified by Lucas Charpentier on 2026/10/27 10:29

Audit

Macro ID
mathjax
Source
Mathjax Macro
Type
Wrapper
Classification reason
Wrapper: the output is the formula the user types, which MathJax typesets in the browser. The macro only marks the text for the JavaScript library and adds no decoration or generated content.
Status
Reviewed
Criteria version
15.20
XWiki version
18.8.0
Audit date
2026-10-20
Auditor
Compared macros
code html

Sources

Where to gather the information the criteria are checked against, see Gather the sources.

SourceWhat it givesUsed forWhere
DocumentationParameters, default values and examples, including the most common exampleL2, L3, and the criteria measured with the most common examplehttps://extensions.xwiki.org/xwiki/bin/view/Extension/MathJax/MathJaxMacro/#HUsage
Source codeHow the macro declares its parameters and content: types, groups, features, advanced and hidden flags, constraints, content type, inline supportC4, C5, C7, C8, C9, C13, E4, E6https://github.com/xwiki-contrib/macro-mathjax/blob/master/macro-mathjax-ui/src/main/resources/Macros/MathJaxMacro.xml
Macro descriptorWhat the Edit Macro dialog is built from, on design.xwiki.orgD1, D2, C1 to C9, E4Descriptor, list of macros with their categories
TranslationsThe name, description and parameter names in each languageD1, D2, D4, C1l10n.xwiki.org
Uses in XWiki pagesHow XWiki itself uses the macro, a realistic example when the documentation has noneL3, C2, C3, C6, C8, C9Search the xwiki organization on GitHub
Compared macrosThe audits of the macros of the same typeL1, D3code, html
Other sources specific to this macro
CriterionResultNotes
D1 wordingKO"MathJax" is the name of the JavaScript library that typesets the formulas, written in camelCase, not the word a user types for what the macro produces, like formula, equation or math. A user who does not know the library cannot guess what it does from the name, and the macro is not a product that XWiki defines. The documentation and the Confluence converter of xwiki-contrib/confluence call it "MathJax" too.
D2 summaryKO"Enter content supported by the MathJax javascript engine." repeats the name and describes an input, not what the macro adds to the page. It never says that it displays mathematical formulas, nor which notation to type, and "javascript engine" is technical wording. The French and German descriptions are the English text.
D3 categoryOKthe macro is in Content, while the compared macros code and html are in Formatting and Development. A formula is content the user inserts in the text, so Content is where a user looks, and a user could also look under Formatting, but a missing category there is not counted here.
D4 quick-actionKOQuick Actions finds the macro first for "mathjax", "MathJax" and "math", where the last one matches the name itself. The synonyms "formula", "latex", "equation" and "tex" do not find it: "formula" lists a Formula entry that belongs to another extension, "latex" lists Template, "equation" lists nothing and "tex" lists Context, Paragraph, Find and Replace and PlantUML. The French and German names are "MathJax", the same as the English one, so no language with a different name can be tested. The rule of html, a technical macro named after its technology, does not apply as is, since users type the notation or the result, not the library.
L1 consistencyOKcompared with code and html, the two wrappers whose content is technical text typed in the Edit Macro dialog: all three open the dialog from their Quick Action with a required Content text area and declare inline support. mathjax has no parameter besides the content, and its mandatory content makes sense, since an empty formula shows nothing. The differences are by design.
L2 doc-parametersKOthe macro is documented only on the legacy extensions.xwiki.org page, https://extensions.xwiki.org/xwiki/bin/view/Extension/MathJax/MathJaxMacro/, and a search of the new documentation tree by "mathjax", "latex" and "formula" finds only blog posts. The page has a Usage section but no parameter table: the content parameter, the only one, is not listed with its mandatory flag.
L3 doc-exampleOKthe Usage example, a page with a numbered eqnarray, references to its equations, an equation and an inline sentence, is used as the most common example. It can be copied into a page and renders without error, once the browser has typeset it, which takes a few seconds in view mode.
I1 patternKOthe reference wrapper, warning, is inserted by its Quick Action without a dialog. The MathJax Quick Action opens the Edit Macro dialog with an empty Content text area, like code, html and velocity, see I3.
I2 zero-configOKsubmitting the Edit Macro dialog with the default content does nothing, with no message, since the content is required: the generic behavior of the dialog, and an empty formula has no sensible result. {{mathjax/}} written in the source renders the error "Failed to execute the [mathjax] macro. Cause: [Missing macro content: this macro requires content (a body)]", which the editor never produces.
I3 instantKOinserting from the Quick Actions menu opens the Edit Macro dialog with an empty Content text area, and the macro is only inserted after typing a formula and submitting.
I4 cursorKOafter submitting the dialog, the macro widget is selected and the cursor is not in its content: typed text goes nowhere, and the content can only be changed through the dialog, see E6.
I5 focusN/A
E1 wysiwygKOthe editor shows the formulas as raw LaTeX, like \begin{equation} y = \frac{c}{cb-ad} \end{equation} , still after 30 seconds and after saving and reopening the page, while view mode shows them typeset, with numbered equations and fractions. The macro output depends on JavaScript that the editor does not run, and it has no edit representation that keeps the meaning of a formula. To reproduce: edit a page holding the Usage example, then view it.
E2 errorsKOa malformed formula is accepted silently: {{mathjax}}\(\frac{a}{\){{/mathjax}} is displayed as its raw source, with no message and no error style. An unknown command like $$\nosuchcommand{x}$$ is displayed in red by MathJax, which says what is wrong. The empty content gives the error described in I2, which names the missing content.
E3 nestingOKin a list item, a table cell and a box, the macro renders inside the text with its formula typeset and no error. A list, a table and a box written in the content are shown as raw text, like {{box}} Boxed formula ... {{/box}} , which is expected since the content is LaTeX, not wiki syntax. The content is never edited in place, at the top level or nested, see E6.
E4 inline-supportOKthe macro declares inline support, and an inline formula renders inside a sentence, as in Solving equation {{mathjax}}\ref{eq:second}{{/mathjax}} for {{mathjax}}x{{/mathjax}} . A display formula written with $$ in the content breaks the line, which is what MathJax does for display math.
E5 emptyKOthe content is never editable in place: the macro is a widget whose raw LaTeX is read-only, one click selects it and the cursor never enters it, so the content can only be typed in the Edit Macro dialog, see I4 and E6.
E6 inplaceKOthe content is never edited in place: the editor shows the raw LaTeX as a read-only widget, and changing it needs the Edit Macro dialog, where it is a plain text area with no formula editing aid and no preview, also when editing an existing macro.

Parameters

ParameterC1 clarityC2 mandatoryC3 defaultsC4 input-assistanceC5 groupsC6 orderC7 alternativesC8 advancedC9 technicalC13 constraintsNotes
$contentKOOKN/AOKN/AOKN/AN/AN/AN/A

C1: the name "Content" is clear, but the description "Macro content" is the generic one of every macro and says nothing about the expected text. The content must be LaTeX with MathJax delimiters, like \( ... \) for an inline formula and $$ ... $$ or an environment such as \begin{equation} for a display one, and a text without delimiters, like {{mathjax}}x{{/mathjax}} , is shown as plain text. The description is not translated in French and German.

C2: the content is mandatory, which is right since an empty formula shows nothing, and the dialog refuses an empty value.

C4: a text area is the field for LaTeX text. A formula editor or a preview would help, but that is an editing aid of the content, counted under E6.

C6: the content is the only parameter.

KOs and tickets

Every KO needs a ticket covering it, see Report the KOs. One ticket can cover several KOs. Known issues filed for this macro are suggested in italics: link them as existing tickets when they cover the KO.

KOCriterionExisting ticketsNew tickets
D1D1 wordingMATHJAX-38
D2D2 summaryMATHJAX-38
D4D4 quick-actionXWIKI-25444
L2L2 doc-parametersXINFRA-525
I1I1 patternXWIKI-25563
I3I3 instantXWIKI-25563
I4I4 cursorXWIKI-25569
E1E1 wysiwygXWIKI-25523 (partial), MATHJAX-39
E2E2 errorsXCOMMONS-3847 (partial), XRENDERING-823 (partial), MATHJAX-39 (partial)
E5E5 emptyMATHJAX-40
E6E6 inplaceMATHJAX-40
C1:$contentC1 clarity, $contentMATHJAX-38
Success

Every KO is covered by a ticket.

Tickets

TicketOriginKOs coveredKOs partly covered
XCOMMONS-3847NewE2
XRENDERING-823NewE2
XWIKI-25444NewD4
MATHJAX-38NewC1:$content D1 D2
XINFRA-525NewL2
XWIKI-25523NewE1
MATHJAX-39NewE1E2
XWIKI-25563NewI1 I3
MATHJAX-40NewE6 E5
XWIKI-25569NewI4

Known issues of this macro

No known issue is specific to this macro.
68 more known issues affect every macro: see the Known issues.

Get Connected