-
MathType
-
WirisQuizzes
-
Nubric
-
CalcMe
-
MathPlayer
-
Store FAQ
-
MathFlow
-
BF FAQ
-
Miscellaneous
-
Wiris Integrations
Migrate image formulas to MathML
Reading time: 1minMigrate existing MathType formulas stored as image elements to native MathML. MathType image formulas already contain their original MathML in the data-mathml attribute. Migrating to MathML consists of extracting this information, decoding it, and replacing the image element with the corresponding MathML.
After completing this guide, your content will store formulas as MathML instead of image elements.
Before you begin
Requirements
Make sure you have:
- Access to the HTML content containing MathType image formulas.
- Image formulas that include the
data-mathmlattribute. - A deployment configured to display MathML content.
Applies to
Legacy MathType integrations using image formulas · Content being migrated to Full MathML mode
Steps
Locate MathType image formulas
Find all image elements with the Wirisformula class. For example:
<img class="Wirisformula" ... data-mathml="...">Each image contains the original MathML in its data-mathml attribute.
Extract the MathML
Read the value of the data-mathml attribute. The stored MathML uses an encoded representation that must be decoded before it can be used.
Decode the MathML
Apply the following character replacements:
| Replace | With |
|---|---|
« |
< |
» |
> |
§ |
& |
¨ |
" |
` |
' |
After decoding, the result is valid MathML.
Replace the image formulas
Replace each image element with the decoded MathML. For example:
- Instead of:
«mi»x«/mi»- Use:
<mi>x</mi>Repeat the process for every MathType image formula in your content.
Apply the migration
Save the updated content in your application. If your deployment uses WIRISplugins.js, ensure that it is loaded on pages displaying the migrated content.
Verify the configuration
Verify that your deployment is configured to display MathML content.
See Full MathML mode for additional information.
Verify it worked
Open a page containing migrated formulas. Confirm that:
- Formulas are stored as MathML.
- The original image elements have been removed.
- Formulas render correctly.
- Formulas can be reopened and edited in MathType.
Common issues
No MathML is available
Verify that:
- The image contains the
data-mathmlattribute. - The content was originally generated by MathType.
The migrated MathML is invalid
Verify that:
- Every replacement character has been decoded correctly.
- The extracted MathML has not been modified during processing.
Formulas do not render after migration
Verify that:
- Your deployment is configured for Full MathML mode.
-
WIRISplugins.jsis loaded on the page displaying the content. - The generated MathML is valid.