Interface MmlFormatOptions

Options that affect MathML conversion with Editor.toMml.

Hierarchy

Index

Properties

Optional declarations

declarations: "xml" | "doctype" | "both" | "none"

Controls which declarations will be included at the top of the document, if any. Possible values:

  • "xml" to produce an XML declaration;
  • "doctype" to produce a doctype declaration;
  • "both" to produce both; or
  • "none" to produce no declarations.

The default is usually "none". If the dialect is "xml", the default is "both".

Optional dialect

dialect: "xml" | "html" | "jax"

The dialect to target. This value shapes the generated code towards specific applications. It affects the defaults for other options and may cause certain structures or concepts to be expressed differently. Possible values:

  • "xml" to produce a standalone XML document.
  • "html" to produce HTML5-style MathML (with no namespace attribute).
  • "jax" to produce MathML more compatible with MathJax.

The default value is "html".

Optional display

display: "auto" | "block" | "inline"

A hint as to whether to prefer treating document lines as inline or block content. Possible values:

  • "auto" to decide how to format each line based on its content.
  • "block" to display each line on its own, similar to how a figure or diagram might be included between surrounding text.
  • "inline" to display the line as part of the surrounding text without setting it off in a separate paragraph. Some content may be formatted differently in order to minimize the effect on the line height. For example, large operators like sum may be somewhat smaller and their details may appear beside the operator rather than above and below it.

The default is "auto".

Optional encoding

encoding: string

If an XML declaration is specified, setting this will produce an encoding attribute for the specified charset. The default is null, which does not produce anything.

Optional entityEscaping

entityEscaping: "minimal" | "numeric" | "named"

Controls the degree to which characters are replaced by entities, and the type of entities used. Possible values:

  • "minimal" to escape only required characters (safe as long as the document encoding is handled properly);
  • "numeric" to escape characters outside of basic ASCII with numeric escapes (safest for XML);
  • "named" to escape characters outside of basic ASCII with named escapes when possible, and otherwise with numeric escapes (safe for inline HTML, and easier to read than numeric escapes).

The default is usually "named". If the dialect is "xml", the default is "numeric".

Optional invisibleOperators

invisibleOperators: ("plus" | "separator" | "applyFunction" | "times")[]

Controls which invisible operators are included. Invisible operators can make otherwise implicit operations explicit in the generated MathML without affecting how the content is rendered visually. Using invisible operators can help processing tools and screen readers to interpret content as intended. This value is set using an array of zero or more of the following strings to indicate which operators are desired:

  • "applyFunction" to insert an apply function operator (U+2061) before function parentheses;
  • "plus" to mark implicit addition (as between the 3 and ½ of 3½) with an invisible plus operator (U+2064);
  • "times" to mark implicit multiplication (as between the 3 and x of 3x) with an invisible times operator (U+2062);
  • "separator" to separate generated lists with an invisible separator operator (U+2063).

The default is to include all invisible operators.

This API is still under development and is subject to change. Copyright © Math I Can Do Solutions Incorporated and/or its licensors.