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 🙏

© 2025 – Pkg Stats / Ryan Hefner

docx-to-html-converter

v1.0.2

Published

Converte DOCX para HTML no navegador. Usa jszip e fast-xml-parser internamente, com override opcional do ParserClass.

Readme

DOCX to HTML Converter

Convert .docx (Microsoft Word) documents directly to HTML in the browser.
Built on top of JSZip and fast-xml-parser, bundled as a standalone library or installable via npm.


Features

  • 📄 Parse DOCX files in the browser (no server required).
  • 🖋️ Preserves styles: paragraphs, headings, lists, tables, inline formatting.
  • 🎨 Extracts page size and margins as CSS @page rules (optional).
  • 🖼️ Supports embedded images.
  • 🔗 Handles hyperlinks (internal and external).
  • 🔧 Available as:
    • ESM/CJS package (for bundlers and Node.js).
    • IIFE build (global window.DocxToHtmlConverter for CDN usage).

Installation

Via npm

npm install docx-to-html-converter
import { DocxToHtmlConverter } from "docx-to-html-converter";

// arrayBuffer from a File, fetch(), etc.
const buffer = await file.arrayBuffer();

const converter = await DocxToHtmlConverter.create(buffer);
const { html, pageStylesCss } = await converter.convert({
  extractPageStyles: true,
});

document.body.innerHTML = html;

Via CDN

<script src="https://cdn.jsdelivr.net/npm/docx-to-html-converter/dist/index.iife.js"></script>
<script>
  async function demo(file) {
    const buf = await file.arrayBuffer();
    const conv = await window.DocxToHtmlConverter.create(buf);
    const { html } = await conv.convert();
    document.querySelector("#preview").innerHTML = html;
  }
</script>

Demo

Clone the repository and open index.html in a browser.
You can drag & drop a .docx file and preview the converted HTML side by side.


API

DocxToHtmlConverter.create(arrayBuffer, ParserClass?)

Create a new converter from a DOCX ArrayBuffer.
Optionally pass a custom XML parser class (defaults to fast-xml-parser).

converter.convert(options)

Convert the document to HTML.

  • options.extractPageStyles (boolean, default: true)
    Extracts @page CSS with margins and page size.

Returns an object:

{
  html: string;          // HTML content
  pageStyles?: object;   // Page style object
  pageStylesCss?: string // CSS string with @page
}

Development

Build outputs:

  • dist/index.js → ESM
  • dist/index.cjs → CommonJS
  • dist/index.iife.js → Standalone browser build (global)
# build all targets
npm run build

# clean dist/
npm run clean

License

MIT © 2025 Your Name