npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@origints/mammoth

v0.1.1

Published

DOCX to HTML conversion for Origins using mammoth.js

Readme

@origints/mammoth

DOCX to HTML/text conversion for Origins using mammoth.js.


Why

Word documents are everywhere in enterprise workflows, but extracting their content programmatically is challenging. You need to convert them to a usable format while preserving semantic structure.

This package wraps mammoth.js and exposes it as Origins transforms. Convert DOCX files to clean HTML or plain text, with full control over style mapping and conversion options.


Features

  • Convert DOCX to semantic HTML
  • Convert DOCX to plain text
  • Custom style mapping for headings, lists, and more
  • Configurable image handling
  • Conversion warnings and messages
  • Integrates with Origins transform registry

Quick Start

npm install @origints/mammoth @origints/core
import { Planner, loadFile, run, globalRegistry } from "@origints/core";
import { docxToHtml, registerMammothTransforms } from "@origints/mammoth";

registerMammothTransforms(globalRegistry);

const plan = Planner.in(loadFile("document.docx"))
  .mapIn(docxToHtml())
  .emit((out, $) => out.add("html", $.get("html").asString()))
  .compile();

const result = await run(plan, {}, globalRegistry);

if (result.ok) {
  console.log(result.value.html);
}

Expected output:

<h1>Document Title</h1><p>Content here...</p>

Installation

  • Supported platforms:
    • macOS / Linux / Windows
  • Runtime requirements:
    • Node.js >= 18
  • Package managers:
    • npm, pnpm, yarn
  • Peer dependencies:
    • @origints/core ^0.1.0
npm install @origints/mammoth @origints/core
# or
pnpm add @origints/mammoth @origints/core

Usage

Basic HTML conversion

import { Planner, loadFile, globalRegistry } from "@origints/core";
import { docxToHtml, registerMammothTransforms } from "@origints/mammoth";

registerMammothTransforms(globalRegistry);

const plan = Planner.in(loadFile("report.docx"))
  .mapIn(docxToHtml())
  .emit((out, $) => {
    out.add("html", $.get("html").asString());
    out.add("messages", $.get("messages").asArray());
  })
  .compile();

Custom style mapping

const plan = Planner.in(loadFile("document.docx"))
  .mapIn(
    docxToHtml({
      styleMap: [
        "p[style-name='Title'] => h1.document-title",
        "p[style-name='Heading 1'] => h1",
        "p[style-name='Heading 2'] => h2",
        "p[style-name='Quote'] => blockquote",
      ],
    })
  )
  .emit((out, $) => out.add("html", $.get("html").asString()))
  .compile();

Convert to plain text

import { docxToText } from "@origints/mammoth";

const plan = Planner.in(loadFile("document.docx"))
  .mapIn(docxToText())
  .emit((out, $) => out.add("text", $.get("text").asString()))
  .compile();

Image handling options

const plan = Planner.in(loadFile("document.docx"))
  .mapIn(
    docxToHtml({
      imageHandling: "omit", // or 'base64'
    })
  )
  .emit((out, $) => out.add("html", $.get("html").asString()))
  .compile();

Project Status

  • Experimental - APIs may change

Non-Goals

  • Not a DOCX writer/generator
  • Not a full Word document parser (no styles, comments, etc.)
  • Not a PDF converter

Documentation

  • See @origints/core for Origins concepts
  • See mammoth.js for conversion details

Contributing

  • Open an issue before large changes
  • Keep PRs focused
  • Tests required for new features

License

MIT