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

@docx-editor.dev/docx-to-markdown

v2.27.0

Published

Convert DOCX to Markdown with layout-derived pages, headers, footers, comments, and tracked changes.

Readme

DOCX to Markdown

Use @docx-editor.dev/docx-to-markdown to convert DOCX files to Markdown. The result includes the body, pages, headers, footers, comments, and tracked changes.

Try the DOCX to Markdown demo or read the Markdown export guide.

Before you begin

For Node.js, use version 20.16.0 or later in the 20.x release line, or version 22.3.0 or later. The converter requires WebAssembly and uses bundled fonts by default.

Install the package

npm install @docx-editor.dev/docx-to-markdown @docx-editor.dev/core

@docx-editor.dev/core is a required peer dependency. Install a version that satisfies the converter's peer dependency range and commit your lockfile.

Convert a DOCX file

The following example reads a local file in Node.js:

import { readFile } from 'node:fs/promises';
import { exportMarkdown } from '@docx-editor.dev/docx-to-markdown';

const docxBytes = await readFile('document.docx');
const result = await exportMarkdown(docxBytes);
console.log(result.markdown);

Include images

Set images: true to include image links and extracted bytes:

const result = await exportMarkdown(docxBytes, { images: true });

result.media contains image bytes and their page occurrences. See image workflows to save a folder, download a ZIP, or return hosted URLs.

Preserve displayed image sizes

Use images: { syntax: 'html' } to include displayed sizes in generated <img> tags. Dimensions use whole CSS pixels. Configure your renderer to allow sanitized HTML and retain width and height. The default Markdown syntax has no size attributes.

For custom previews, use displayWidthPx and displayHeightPx. Asset pixelWidth and pixelHeight describe the image file. The converter omits crop, rotation, and floating text wrapping. See Preserve displayed image sizes.

Read page output

The document layout engine calculates page breaks.

for (const page of result.pages) {
  console.log(page.number, page.markdown);
  console.log(page.headerMarkdown, page.footerMarkdown);
}

result.markdown contains continuous document text without page separators. Use it for an unpaged .md download. Headers and footers stay in result.pages.

For search and AI ingestion, use { displayMode: 'proposed' } to show pending insertions and hide pending deletions. The default, 'all-markup', shows both.

Configure fonts for accurate layout

Fonts determine line wrapping, table row heights, and the page boundaries in result.pages. Markdown does not preserve the DOCX font family, but the converter needs font measurements to calculate layout.

Start with the bundled substitutes for common document fonts. Use fonts to supply the author's licensed fonts or override a substitute. Use fallbackFonts: googleFonts() to load missing faces from Google Fonts; it requires network access and does not override faces already resolved by earlier sources.

See font setup and troubleshooting for runnable examples, resolution reports, and guidance on matching page references to the source document.

Runtime and output

For Next.js, use the Node.js runtime and server package configuration. Edge runtimes are not supported.

Page breaks depend on fonts, document features, and revision mode; they can differ from the application that created the document. Store the document version with page citations. result.warnings reports omitted content and font problems. Images are omitted unless enabled. See output limits before using the output as a complete transcription.

The package uses the Apache 2.0 license, including comment and tracked-change extraction. Bundled fonts retain their own open-source licenses.

Next steps