mdgate converters

XHTML to Markdown in your browser.

Convert XHTML files to GitHub-Flavored Markdown directly in your browser.

Your XHTML stays on your device. No upload. No account.

Starting local converter

Use XHTML to Markdown in your app

$ npm install @mdgate/html

import { toMarkdown } from '@mdgate/html';

const markdown = await toMarkdown(bytes);

Pure TypeScript, Node.js, Cloudflare Workers, Edge, Browser, No Python, No native addons, No WASM, Zero third-party runtime dependencies

How XHTML to Markdown works

  1. XHTML
  2. HTML tree parsing
  3. headings · lists · tables · links
  4. GitHub-Flavored Markdown

Built for JavaScript runtimes

Node.js

Read local files, uploads, S3/R2 objects, and other byte sources.

Cloudflare Workers

Parse HTML directly inside Workers without a browser engine or native binary.

Browser

Convert XHTML locally without uploading it to a server.

Edge

Run the same TypeScript converter in compatible Edge runtimes.

What @mdgate/html extracts

  • Headings, paragraphs, and block quotes
  • Bold, italic, strikethrough, and inline code
  • Links and relative URLs
  • Ordered, unordered, and nested lists
  • Tables, including spanning cells
  • Code blocks
  • MHTML / MHT archives
  • XHTML

Why @mdgate/html

Runs where your JavaScript runs

No separate processing service. The converter is TypeScript you can call from Node.js, Cloudflare Workers, Edge runtimes, and browsers.

Local conversion

XHTML files can stay inside your application or browser.

Content detection

Recognizes XHTML files from their contents, not only the filename.

Deterministic parsing

The same XHTML file produces repeatable Markdown without model inference.

Small runtime surface

No Python. No native addons. No WASM. No third-party runtime dependencies.

XHTML for AI agents

Turn XHTML files into content your agent can actually work with.

  1. XHTML
  2. Markdown
    • grep
    • search
    • chunk
    • index
    • cache
    • cite
    • reason

Need more than XHTML?

One format

@mdgate/html

Your own set

@mdgate/core
+ @mdgate/html
+ @mdgate/pdf
+ @mdgate/docx

Broad file support

@mdgate/converters

FAQ

Can I convert XHTML to Markdown without uploading it?

Yes. XHTML files can be converted locally in the browser.

Does XHTML to Markdown work in Cloudflare Workers?

Yes. @mdgate/html runs directly in Cloudflare Workers.

Does it require Python?

No.

Does it require native addons or WASM?

No.

What does it output?

GitHub-Flavored Markdown.

Can I install only the XHTML converter?

Yes. Install @mdgate/html instead of the complete converter set.