
igorsaevets/page2ai-core
Browser automation이 페이지는 AI로 자동 번역되었습니다. 기술적인 세부 사항은 원문을 확인하세요. 원문 보기
Extract clean Markdown from any web page HTML. Node.js (linkedom) + browser adapters. Powers Page2AI extension and @page2ai/mcp server.
개요
Webpage-to-Markdown extraction engine for LLM context (ChatGPT, Claude, Gemini). Same engine that powers the Page2AI Chrome & Firefox extensions and the @page2ai/mcp server. Preserves code blocks with language hints, tables, and reading structure. Zero telemetry, MIT-licensed. Works in Node.js (via linkedom) and in browsers. - : htmlToMarkdown(html, opts) or fetchAndConvert(url, opts) — zero external API calls, uses linkedom for parsing - : exports BrowserAdapter and the PageAdapter interface; the full extract pipeline lives in the extension repo (planned for v0.2 migration) - : no telemetry, no analytics, no third-party calls - licensed Converts an HTML string to Markdown. Synchronous. - html (string) — the HTML to parse: a whole document or a fragment (an HTMX partial, a template snippet, plain text) - opts.baseUrl (string) — URL used to resolve relative links (default: 'about:blank') - opts.
README
원문 README의 일부입니다. 원문 보기.
@page2ai/core
Webpage-to-Markdown extraction engine for LLM context (ChatGPT, Claude, Gemini). The engine of the
@page2ai/mcpserver. The Page2AI Chrome & Firefox extensions run their own pipeline in the browser (see below). Preserves code blocks with language hints, tables, and reading structure. Zero telemetry, MIT-licensed.
Works in Node.js (via linkedom) and in browsers.
- Node.js:
htmlToMarkdown(html, opts)orfetchAndConvert(url, opts)— zero external API calls, uses linkedom for parsing - Browser: exports
BrowserAdapterand thePageAdapterinterface; the full extract pipeline lives in the extension repo (a migration is planned) - Zero data collection: no telemetry, no analytics, no third-party calls
- MIT licensed
Install
npm install @page2ai/core
Quick start
import { htmlToMarkdown, fetchAndConvert } from '@page2ai/core';
// From an HTML string
const html = `HelloWorld`;
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);
API
htmlToMarkdown(html, opts?)
Converts an HTML string to Markdown. Synchronous.
html(string) — the HTML to parse: a whole document or a fragment (an HTMX partial, a template snippet, plain text)opts.baseUrl(string) — URL used to resolve relative links (default:'about:blank')opts.profile(string) — accepted, but ignored by the Node build in this version:'dashboard','marketing'and the rest produce the same output here. The profiles switch the browser extension’s live-page pipeline (clicking tabs, waiting for lazy content), which the Node renderer does not runopts.includeFrontmatter(boolean) — emit YAML frontmatter block (default:true)opts.includeImages(boolean) — emit image links (default:true). Inside a table cell, a layout table’s included, an image is written as its alt text either way, and an image with an empty alt oraria-hidden="true"adds nothing
설치
This server does not publish a one-line install command.
Open the repository installation guide MCP 초보자라면? mcpskill.org 가이드부터 시작하세요 →