Mammoth

github.com ↗

Convert DOCX structure into semantic HTML

SI Score
80/100
Pricing
Open Source AI reading, not confirmed
Free plan
Not confirmed
Sign-up required
Not confirmed

Ask SI about Mammoth

Answers use saved listing facts and recorded sources.

What it does

Mammoth converts DOCX documents to HTML using semantic styles rather than reproducing every visual formatting detail. It offers a command-line interface and several language implementations.

Map a document's meaningful styles to HTML elements before conversion. Heading styles can become headings, while custom mappings handle project-specific conventions. The output is an HTML fragment, and complex layouts will not match Word exactly; this is useful for publishing structured content rather than preserving a page image. Mammoth performs no sanitization, so HTML generated from untrusted documents needs sanitization before it is embedded in a website.

The JavaScript API accepts a DOCX path or buffer in Node, and an ArrayBuffer in a browser. The CLI writes HTML and can export images to a chosen directory. External file access is disabled by default; enabling it changes what a trusted conversion may read. Keep that separate from sanitizing HTML, which Mammoth does not do. Its document-transform API is explicitly unstable, and direct Markdown output is deprecated.

Strengths

  • Provides explicit style mappings for semantic HTML output.

Watch out for

  • Intentionally ignores some visual formatting and can struggle with complex documents.
  • Does not sanitize untrusted document content for web embedding.

Best for

  • Publishing structured Word content on the web

Sources