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@latest
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 webforai
for quick HTML to Markdown conversion