A esm-native library that converts HTML to Markdown & Useful Utilities with simple, lightweight and epic quality.
npm
npm i webforai
# or just run
npx webforai@latestTry it
Paste a URL and get the Markdown webforai produces — converted live by the hosted webforai platform.
Rate-limited public demo (5 requests / 10 min per IP) running the Webshare
proxy-fetch engine. No API key required.Overview
import { htmlToMarkdown, htmlToMdast } from "webforai";
import { loadHtml } from "webforai/loaders/playwright";
// Load html from url
const url = "https://www.npmjs.com/package/webforai";
const html = await loadHtml(url);
// Convert html to markdown
const markdown = htmlToMarkdown(html, { baseUrl: url }); Features
- High-quality HTML to Markdown conversion with simple, customizable options
- ESM-native, compatible with various environments (browser, Cloudflare Worker, Node.js, etc.)
- Lightweight (only 146kb minified and gzipped)
- Flexibility because it's built on Syntax Tree ecosystem.
- MathML to LaTeX with mathml-to-latext package.
- Out-of-the-box loaders such as fetch, playwright, puppeteer.
- CLI tool
npx webforaifor quick HTML to Markdown conversion
Hosted platform
Don't want to run the browsers, proxies and queues yourself? webforai platform is an OSS, self-hostable
crawl→Markdown API built on this library — scrape, batch and crawl over four engines
(fetch / proxy-fetch / proxy-browser / cf-browser, 1 / 2 / 5 / 5 credits per page),
with 500 credits per month free.


