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

mdize

v0.2.0

Published

Convert documents (PDF, DOCX, PPTX, XLSX, HTML, CSV, images, XML) to Markdown

Readme

Mdize

Convert documents to Markdown, preserving their structure (headings, lists, tables, links, images). The Markdown output is designed to be processed by AI, not humans.

An attempt to port to TypeScript markitdown Python library from Microsoft.

Supported Formats

| Format | Extensions | Notes | |--------|-----------|-------| | PDF | .pdf | Rich text (headings, bold, italic, links), borderless table detection | | DOCX | .docx | Via mammoth → HTML → Markdown | | PPTX | .pptx | Slides, tables, charts, images, notes | | XLSX | .xlsx | All sheets as Markdown tables | | HTML | .html, .htm | Strips scripts/styles, preserves structure | | CSV | .csv | Markdown table with charset auto-detection | | Images | .jpg, .png | EXIF metadata + optional OCR with table detection | | XML/RSS | .xml, .rss, .atom | RSS and Atom feed parsing | | Plain text | .txt, .md, .json | Passthrough with charset handling |

Installation

npm install mdize

Requires Node.js >= 18.

Usage

import { Mdize } from "mdize";

const converter = new Mdize();

// Convert a file
const result = await converter.convertFile("document.pdf");
console.log(result.markdown);

// Convert a buffer
import { readFile } from "node:fs/promises";
const buffer = await readFile("spreadsheet.xlsx");
const result2 = await converter.convertBuffer(buffer, { extension: ".xlsx" });
console.log(result2.markdown);

// Auto-detect: string = file path, Buffer = raw data
const result3 = await converter.convert("presentation.pptx");

Options

// Keep full data URIs (e.g. base64 images in DOCX/PPTX)
const result = await converter.convertFile("doc.docx", { keepDataUris: true });

// Enable OCR for images (requires tesseract.js)
const result = await converter.convertFile("invoice.jpg", { ocr: true });

// Provide charset hint for non-UTF8 files
const result = await converter.convertBuffer(csvBuffer, {
  extension: ".csv",
  charset: "cp932",
});

Custom Converters

import { Mdize, DocumentConverter, PRIORITY_SPECIFIC } from "mdize";

class MyConverter extends DocumentConverter {
  accepts(input, info) {
    return info.extension === ".custom";
  }

  async convert(input, info, options) {
    return { markdown: input.toString("utf-8") };
  }
}

const converter = new Mdize();
converter.register(new MyConverter(), PRIORITY_SPECIFIC);

API

Mdize

| Method | Description | |--------|-------------| | convert(source, options?) | Auto-detect: file path (string) or Buffer | | convertFile(path, options?) | Convert a local file | | convertBuffer(buffer, info?, options?) | Convert a Buffer with optional metadata | | register(converter, priority?) | Register a custom converter |

ConversionResult

interface ConversionResult {
  markdown: string;  // The converted Markdown
  title?: string;    // Document title (from HTML <title>, etc.)
}

StreamInfo

interface StreamInfo {
  filename?: string;
  extension?: string;  // e.g. ".pdf"
  mimetype?: string;   // e.g. "application/pdf"
  charset?: string;    // e.g. "utf-8", "cp932"
}

ConvertOptions

interface ConvertOptions {
  url?: string;          // URL context for the document
  keepDataUris?: boolean; // Keep full base64 data URIs
  ocr?: boolean;          // Enable OCR for images
}

Development

npm test          # Run tests
npm run build     # Build ESM + CJS
npm run typecheck # Type check

License

MIT