Mammoth converts semantically marked up .docx documents to simple and clean HTML, allowing pasting from Word documents without the usual mess.
Mammoth is designed to convert .docx documents,
such as those created by Microsoft Word,
and convert them to HTML.
Mammoth aims to produce simple and clean HTML by using semantic information in the document,
and ignoring other details.
Mammoth converts any paragraph with the style
rather than attempting to exactly copy the styling (font, text size, colour, etc.) of the heading.
This allows you to paste from Word documents without the usual mess.
There's a large mismatch between the structure used by .docx and the structure of HTML, meaning that the conversion is unlikely to be perfect for more complicated documents. Mammoth works best if you only use styles to semantically mark up your document.
The following features are currently supported:
Tables. The formatting of the table itself, such as borders, is currently ignored, but the formatting of the text is treated the same as in the rest of the document.
Footnotes and endnotes.
Bold, italics, superscript and subscript.
Text boxes. The contents of the text box are treated as a separate paragraph that appears after the paragraph containing the text box.
Mammoth maps some common .docx styles to HTML elements.
a paragraph with the style name
Heading 1 is converted to a
If you have a document with your own custom styles,
you can use an embedded style map to tell Mammoth how those styles should be mapped.
For instance, you could convert paragraphs with the style named
h1 elements with
class="warning" with the style mapping:
p[style-name='WarningHeading'] => h1.warning:fresh
An online tool can be used to embed style maps into an existing document. Details of how to write style maps can be found on the mammoth.js documentation.
Requires: 3.5 or higher
Compatible up to: 4.6.1
Last Updated: 3 weeks ago
Active Installs: 3,000+
0 of 1 support threads in the last two months have been marked resolved.
Got something to say? Need help?