
Company News
Free Business Plan Upgrades for Open Source Maintainers
Open source maintainers are under more pressure than ever. We're raising our open source program from the Team plan to the Business plan, free.
@page2ai/core
Advanced tools
Extract clean Markdown from any web page HTML. Works in Node.js (via linkedom) and browsers. Powers the Page2AI extension and @page2ai/mcp server.
Extract clean Markdown from any web page HTML. Works in Node.js (via linkedom) and in browsers. Powers the Page2AI extension and the @page2ai/mcp server.
htmlToMarkdown(html, opts) or fetchAndConvert(url, opts) — zero external API calls, uses linkedom for parsingBrowserAdapter and the PageAdapter interface; the full extract pipeline lives in the extension repo (planned for v0.2 migration)npm install @page2ai/core
import { htmlToMarkdown, fetchAndConvert } from '@page2ai/core';
// From an HTML string
const html = `<article><h1>Hello</h1><p>World</p></article>`;
const { markdown, title, charCount } = htmlToMarkdown(html, {
baseUrl: 'https://example.com/hello',
includeFrontmatter: true,
});
console.log(markdown);
// From a URL
const result = await fetchAndConvert('https://docs.anthropic.com/en/api/messages', {
timeoutMs: 15000,
});
console.log(result.markdown);
htmlToMarkdown(html, opts?)Converts an HTML string to Markdown. Synchronous.
html (string) — the HTML to parseopts.baseUrl (string) — URL used to resolve relative links (default: 'about:blank')opts.profile (string) — extraction profile: 'auto' | 'docs' | 'marketing' | 'research' | 'dashboard' | 'wordpress-marketing' (default: 'auto', v0.2)opts.includeFrontmatter (boolean) — emit YAML frontmatter block (default: true)opts.includeImages (boolean) — emit image links (default: true)Returns { markdown, title, baseUrl, charCount, extractedAt }.
fetchAndConvert(url, opts?)Fetches a URL and converts it to Markdown. Async.
url (string) — the URL to fetchopts.timeoutMs (number) — abort after N ms (default: 15000)opts.userAgent (string) — custom user agent (default: page2ai-core/0.1)htmlToMarkdown optionsUses Node 18+ built-in fetch(). Follows redirects; passes the final URL to htmlToMarkdown as baseUrl unless overridden.
main article > article > main > [role="main"] > body)# ), paragraphs, lists (ordered/unordered, nested), links [text](url), images , code blocks (with language tag when detectable), tables (| a | b |), blockquotes, inline formatting (bold, italic, code)title, source, captured_at, language, description, canonical, og_title, og_description, author, published, extractor, extractor_version<details> auto-expansion::before / ::after contentAll the above ship with the Chrome/Firefox extension, which runs the full lib/core/* pipeline against a live browser DOM. See github.com/igorsaevets/page2ai-extension.
lib/core/html-to-md.ts via PageAdapter, browser entry migrated from extension repo<div id="root"> from static HTML currently produce a graceful fallback error under v0.1 — the SPA adapter in v0.3 will handle them.Two implementations behind a single PageAdapter interface:
src/
├── shared/ # No DOM assumptions — works with any adapter
│ ├── page-adapter.ts # PageAdapter interface + defaults + nodeCssEscape
│ ├── utils.ts # pure helpers (absUrl, escapeMd, etc.)
│ ├── md-postprocess.ts # pure string transforms
│ ├── types.ts # all TypeScript interfaces
│ ├── constants.ts # DEFAULTS, BLOCK_TAGS, PII patterns
│ └── profiles.ts # profile presets
├── node/ # LinkedomAdapter + htmlToMarkdown + basic-renderer
│ ├── index.ts
│ ├── linkedom-adapter.ts
│ └── basic-renderer.ts
└── browser/ # BrowserAdapter (v0.1) + extract() (v0.2)
├── index.ts
└── browser-adapter.ts
git clone https://github.com/igorsaevets/page2ai-core
cd page2ai-core
npm install
npm run build # tsc → dist/
npm test # vitest
npm run typecheck # tsc --noEmit
@page2ai/mcp — MCP server for Claude Desktop, Cursor, Windsurf, Zedswh:1:snp:05123c51ef9e7c0aeb06f42b1263c07a8d26999aReleases from v0.1.1 onward are published from GitHub Actions with npm provenance. Each published version carries a Sigstore attestation recording which commit and which workflow run produced the tarball, logged in the public Rekor transparency ledger. npmjs.com shows a provenance badge next to the version, linking to both.
Verify it yourself, without trusting this README:
npm audit signatures
npm view @page2ai/core --json | jq '.dist.attestations'
The point is that the link between the source you can read and the artifact you install is checkable by a third party rather than asserted here.
MIT — Copyright (c) 2026 Igor Saevets. See LICENSE.
FAQs
Extract clean Markdown from any web page HTML. Works in Node.js (via linkedom) and browsers. Powers the Page2AI extension and @page2ai/mcp server.
The npm package @page2ai/core receives a total of 220 weekly downloads. As such, @page2ai/core popularity was classified as not popular.
We found that @page2ai/core demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Company News
Open source maintainers are under more pressure than ever. We're raising our open source program from the Team plan to the Business plan, free.

Security News
The supply chain control that delays freshly published gems now covers lockfile generation and gem vendoring in Ruby projects.

Security News
During a UK cyber test, a Mythos 5 agent used sockpuppets, social engineering, and prompt injection to try to get a maintainer to merge malware.