Repository navigation
Releases
v0.4.0: undici 7, proxy support, Node >=20.18.1
Breaking
- Node.js >=20.18.1 required. The
engines.nodefield is raised from>=18.17.0to>=20.18.1. Node 18 has been end-of-life since April 2025.
Features
- Proxy support:
fetchProtectedhonoursHTTPS_PROXY,HTTP_PROXYandNO_PROXYenvironment variables. Requests route through an undiciProxyAgentwhen a proxy is configured. SSRF string checks and advisory DNS resolution still run.getProxyForUrl(url)is exported.
Dependencies
- undici 6.29.1 → 7.30.1 (major). Fixes CVE-2026-87018 (High: DoS via TLS 1.2 renegotiation). The
Agent({ connect: { lookup } })API for DNS pinning is unchanged.
npm: npm install @page2ai/core@0.4.0
v0.3.1
Fixed
- A layout table (
<table role="presentation">orrole="none") converts as the blocks in its cells, not as one Markdown table cell (P2A-024). HTML e-mails built from nested layout tables came out as one cell on one line. Images in a layout table keep the cell rule: a spacer or open-tracking pixel (empty alt) adds nothing.
Full changelog: https://github.com/igorsaevets/page2ai-core/blob/main/CHANGELOG.md#031---2026-10-20
🤖 Generated with Claude Code
v0.3.0: SSRF guard hardening: DNS pinning, wider blocklists (BL-22)
SSRF guard hardening (BL-22): closes the DNS rebinding window on the public endpoint and extends
the IP blocklists to cover every range the T99 audit flagged. htmlToMarkdown is unchanged;
fetchProtected is the only affected entry point.
Security
- DNS pinning:
fetchProtectednow resolves DNS once, validates every returned address, and
pins the TCP connection to those addresses via an undiciAgent. Previously, Node'sfetch()
re-resolved the hostname independently, so a DNS record that flipped between the guard's lookup
and the connect (DNS rebinding) could reach an internal address. The check-then-connect window
is closed. - Extended IPv4 blocklist: multicast (224.0.0.0/4), reserved/broadcast (240.0.0.0/4),
TEST-NET-1/2/3 (192.0.2.0/24, 198.51.100.0/24, 203.0.113.0/24), benchmarking (198.18.0.0/15),
IETF Protocol Assignments (192.0.0.0/24), deprecated 6to4 relay anycast (192.88.99.0/24). - Extended IPv6 blocklist: NAT64 well-known and local-use (64:ff9b::/96, 64:ff9b:1::/48),
6to4 (2002::/16), documentation (2001:db8::/32), Teredo (2001::/32), discard-only (100::/64).
Added
undici^6.29.1 is now a runtime dependency (zero transitive dependencies).- Minimum Node version raised from 18.0 to 18.17 (undici 6.x requirement).
resolveAndValidate(hostname, rawUrl)is exported fromssrf-guardfor callers that need the
validated addresses (e.g. to build their own pinned dispatcher).
v0.2.2: buttons in linear time, accordion questions kept (P2A-019 review)
Only the Node renderer's button rule changes, so htmlToMarkdown and fetchAndConvert change the same way. A review
of the 0.2.1 rule (P2A-019) by three external models, each shape run on npm 0.2.0, 0.2.1 and a build that drops every
button. The 53-page corpus converts as in 0.2.1, byte for byte apart from extractor_version, with default options,
includeImages: false and includeHidden: true.
- Fixed: a page with thousands of sibling buttons took seconds: every button scanned its whole run of siblings, so
3,000 buttons in one paragraph took 4 to 5 s (0.2.0: about 30 ms). The run is now computed once per container. - Fixed: 0.2.1 dropped the text of buttons that hold it: an accordion question with neither
aria-expandednor a heading
(<button>Question?</button><div><p>Answer.</p></div>, also in a list item), a definition term, a question under
role="heading", a link written inside a button, and a command whose button is named "Copy command: ". - Fixed: a custom element is a block unless its container has text of its own, as the converter already renders it,
so a card's action row (<mat-card-actions><button>LIKE</button>) no longer counts the card's text as its sentence. - Still dropped, as in 0.2.1: buttons with no text of the page around them that hold options, cards or a value in a
<span>or<div>(sizes, quiz answers, chapter lists, card grids), a question in a wrapper of its own before the
answer, a title button beside a heading's link, and a copy-the-command button that carries its command only as its
own text: the neon.com page named in 0.2.1 still losesnpx neon@latest init.
v0.2.1: interface buttons no longer print as text (P2A-019)
Only the Node renderer changes, in how it treats <button>, so htmlToMarkdown and fetchAndConvert change the
same way. Measured on npm 0.2.0 against this release's code with default options, includeImages: false and
includeHidden: true; each changed line was read.
Fixed
- Interface buttons no longer print as paragraphs (P2A-019). Since 0.2.0 converts the pages of Mintlify, Vercel and the Claude docs, their output carried the header's «Copy page» twice, the code-sample switcher («cURL CLI Python TypeScript C# Go Java PHP Ruby») and icon-font glyphs. A
<button>is now treated as a control: its label is left out, and so is anaria-hiddenicon inside a button that is kept. A button stays when it holds the page's text: all the text of a heading or a table cell (an accordion's question, a sortable column's name), block content or an image that is notaria-hidden(a zoomable image, a video card), a link around it, a disclosure's label (aria-expandedwithoutaria-haspopup: a changelog's «Fixes» above its list), a word of a sentence (a tooltip), and the selected tab of a tab list whose panels the converter cannot pair with it. Measured on 53 saved pages (the 21-page corpus, 17 server snapshots of docs sites, 15 pages saved from live sites on 2026-10-17 and 2026-10-18): 34 change, 399 lines go out and 114 come in (a heading without its glyph, «Python» for the tab strip); every heading and code block stays, and the private-use glyphs fall from 153 to 24 (the 24 left are outside buttons: breadcrumb separators and callout icons on the Claude docs). A build that dropped every button lost 27 headings, a table column's name, a word of a sentence and a changelog's section labels; this one keeps them. Known cost: a copy-the-command widget that shows its command in a<span>inside the button (neon.com) loses the command.
v0.2.0: only the page you name (no .md twin, a browser's Accept), text files as written
htmlToMarkdown is unchanged: on the 21 corpus pages its output is byte-identical to 0.1.13. What
changes is what fetchAndConvert reads, measured live on 2026-10-17 with npm 0.1.13 against this
release's code. On seven documentation platforms (Fumadocs, Mintlify, Vercel, Supabase, Cloudflare,
Stripe, the Claude docs) 0.1.13 returned the site's .md copy of the page and 0.2.0 converts the
page itself, 1,301 to 57,887 characters. Every heading and code block of those copies is in the
0.2.0 output, except a «Related pages» list on Vercel, an «On this page» list and the page's JSON-LD
on Cloudflare, and the [#anchor] suffixes of Fumadocs headings.
On the Claude docs the copy was 160,435 characters with 36 headings and 6 code blocks; the page
gives 57,887 with 59 and 20. A README.md from raw.githubusercontent.com now comes back as the file,
11,408 of 11,408 characters (0.1.13: 3,468 characters, no heading), and an llms.txt you name keeps
its 235 lines.
Changed (breaking)
fetchAndConvertreads only the page you name (BL-49). It no longer asks for<url>.mdfirst, and its Accept header is now the one Firefox sends when it opens a page,text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8: notext/markdownand notext/plain, because servers match those words and ignore q-values (measured 2026-10-17:text/html,text/markdown;q=0still got Markdown from platform.claude.com, andtext/html,text/plaingot it from fumadocs.dev). Fumadocs, Mintlify, Vercel, Supabase, Stripe and the Claude docs now answer with the HTML page instead of their own Markdown copy, which can be older than the page, and the output on those sites is converted from the page. Content shown only to agents (Mintlify<Visibility for="agents">) is no longer there, and what the page shows people is.- Markdown sent for a page address is refused with
FetchProtectionError("the server answered with Markdown ... for a page address"). The request asks for HTML as a browser does, so a server that still answers Markdown chose its copy by something else (User-Agent, a cache). 0.1.13 returned it as the page. FetchAndConvertOptions.tryMdSuffixFirstis removed; a value passed anyway is ignored (TypeScript reports it on an object literal).- The official-Markdown settings are gone from the shared exports (
@page2ai/core/shared/types,@page2ai/core/shared/profiles):OfficialMarkdownMode,OfficialMarkdownResult, theExtractorConfigfieldsofficialMarkdownMode,trustedOfficialMarkdownHostsandofficialMarkdownMinRatio(and so the profiles'officialMarkdownMode), theExtractStatusvalue'official-md', andExtractResult.officialMarkdownUrlandofficialMarkdownRatio. No code in core read them; they described the extension's own lookup, which its next release removes too. ConversionResult.sourceis'html-parse' | 'markdown-response':'md-suffix'and'content-negotiation'are gone, and so is'llms-txt', which nothing ever returned. The frontmatter of a Markdown response saysextractor_source: "markdown-response".
Fixed
- A Markdown or text file comes back as written. A URL whose path names a Markdown or text file (
.md,.markdown,.mdown,.mkd,.mdx,.txt) is returned as is whether it is served astext/markdown,text/x-markdown,text/plainorapplication/octet-stream. In 0.1.13 aREADME.mdfrom raw.githubusercontent.com (text/plain) went through the HTML parser and came out as one line that began in the middle of the file, with no heading and no code block: 3,035 characters of 10,940. Anllms.txtyou named lost its line breaks, andtext/x-markdownandapplication/octet-streamwere refused. A body with a NUL byte is refused as not text.
v0.1.13: React streaming pages, hidden text in code, table spans
Output changes on 4 of the 21 corpus pages, measured on npm 0.1.12 against the release build with
default options, includeImages: false and includeHidden: true; each change was read and each is
one of the fixes below. On the 14-page benchmark corpus f_score moves from 0.916 to 0.933 and
f_prose from 0.842 to 0.859, all of it on one page, Anthropic's extended-thinking docs
(docs.anthropic.com, which redirects to platform.claude.com; 0.000 to 0.233). That
page's ground truth was made by a static pass that never saw its article and counts the article's
text as boilerplate, so the score understates the change. No code block, table, heading or list
item of the 0.1.12 output is lost. The words that go are 16 Loading... placeholders, Emotion CSS
that a <style> put inside a docs.sentry.io code block, and cd my-websitenpx, two Docusaurus
code lines that 0.1.12 printed as one.
Fixed
- React streaming pages print the article instead of its loading placeholder (#31, #32). React
streaming SSR (Next.js App Router, Remix, Mintlify) sends a Suspense fallback where late content
goes, then the content, hidden at the end of<body>, with an inline$RC("B:0","S:0")that
moves it into place. The converter runs no scripts, so the root printed the fallback: the
Anthropic page gave 212 characters ofLoading...for a 12,270-character article. The
$RC,$RRand$RScalls are now replayed in document order before the root is picked, and
only where a browser runs them: in a classic inline script (nosrc,nomodule, module, JSON or
text type, nothing inside<template>or<noscript>), at a statement start, on a segment,
boundary and placeholder parsed before the script, on React's own segment wrappers.$RXkeeps
the fallback, and a segment whose boundary is gone is dropped, as React drops it. Chromium,
running only each saved page's inline scripts, gave the converter the same page as the replay,
byte for byte, on 8 of 8 streaming pages; 25 of 28 adversarial cases from a review equal the
browser, and the other 3 redefine or omit$RC(see the README). A page with 16,000 calls
converts in 0.12 s. - Hidden text no longer reaches the output through code, link names or the content root
(#29, #30). On 0.1.12 a link whose content rendered empty took its name fromtextContent,
hidden spans included; inline code and code blocks readtextContenttoo, so a hidden span or a
<style>inside code printed (two lines of Emotion CSS on the docs.sentry.io corpus page); a
hidden<main>became the root and printed its whole text; a hidden block kept for its<pre>
printed all its prose. Code, link names and tab labels now take no text from a hidden element of
any kind, nor from<style>,<noscript>,<canvas>fallbacks or SVG<defs>/<desc>, and
<br hidden>breaks no line. The root is the first<main>under nohidden(one inside a
React segment only when there is no other, never one in a hidden tab panel or anuntil-found
section). A hidden block that holds code gives its code blocks and no prose, and a tab panel
outside the root is not printed. A hidden block is kept as a React streaming segment only when
it is one, React's wrapper with an id ending inS:and a hex number:S:eviland
<img hidden id="S:0">no longer pass. - Table cells stay under their headers (#29, #30).
colspanandrowspanare laid out as the
HTML table model lays them out, so the cells after a span keep their columns; a span ends with
its row group androwspan="0"spans the rest of it; columns where no cell starts are dropped
(colspan="100"adds no empty columns); past a budget of covered slots the plain layout is used.
An empty cell under a header row keeps its place in a nested table. - Line breaks in code survive (#29). A
<br>in code is a line break: every Docusaurus code
block ends each line with a<br>and no newline, socd my-websiteandnpx docusaurus start
printed as one line. A<pre>in a table cell keeps its lines, one code span per line (8 cells
on the Wikipedia corpus page). A<br>in a heading is a space. - An image in a table cell is written as its alt text (#29), which also names an image-only
link there; 0.1.12 left such a cell empty (2 cells on the Wikipedia corpus page). An image with
aria-hidden="true"adds nothing to its cell. fetchAndConverthonoursincludeFrontmatter: falseon its Markdown fast paths (#26). The
.md-suffix andtext/markdownpaths prepended the frontmatter whatever the option said and
counted only the body (charCount144 for a 336-character result), so the MCP server's
include_frontmatter: falsewas ignored on every docs site that answerstext/markdown. Both
paths now honour the option and count the returned Markdown, ashtmlToMarkdowndoes.
Docs
- README: what
includeImagesdoes in a table cell; whatincludeHiddenconverts either way, and
that the default is not a security boundary (a page's own attributes decide the kept kinds, and
no CSS is read);tryMdSuffixFirst; thetext/markdownpass-through; how React streaming
content is placed and when a page keeps its fallback; the content-root rule as the code applies
it; spanning cells; a closed<details>needs no clicking.
Tests
- The package root's exports and its
exportsmap are pinned (P2A-009), and the P2A-001 key/value
grid is pinned exactly. The streaming tests run React 19.2.0's and React 18's own inline
runtimes; 14 of 14 rule mutations fail a test.
v0.1.12: text in bare divs, blocks in list items, tables, hidden content
Output changes on most pages; the extension, the MCP server and the benchmark numbers move with it.
On the 14-page benchmark corpus f_score stays 0.916 and no code block, table or heading of the
0.1.11 output is lost. The words that go are <br> markup 0.1.11 left in table cells; the one list
item that goes (MDN) was a * in the page's text, now escaped. On 7 more pages the other words that
go are CSS from <style> elements inside Wikipedia's table cells and letter-spaced text now joined
into its word (a d v e r t i s e m e n t s). A six-model review of the first change found the
defects listed after the first five entries; each was reproduced on the build before it was fixed,
and Markdown claims were checked with a CommonMark parser.
Fixed
- Text outside a recognised block tag is no longer dropped. The Node renderer walked element
children only, so text sitting directly in a<div>,<section>,<span>or<blockquote>,
beside a<br>, or in a<dt>,<figcaption>or<summary>vanished while every heading and
table survived: on a server-rendered admin page 25 of 26 key/value labels and 10 of 12 metric
tiles were missing. Such text now renders as its own paragraph. A row of links or images with no
text between them still renders one per line, as before. <dl>renders as definition-list Markdown (**term**, then: definition), the format the
extension uses. A<dd>that holds blocks (paragraphs, code, tables, as in every Sphinx API
entry) is walked, not flattened. A<dl>with no<dt>/<dd>is treated as a plain container.- Entities inside words no longer split them. linkedom yields
account'sas three text
nodes and the inline renderer joined parts with a space, givingaccount ' s; the same broke
AT&T,caféand every quote entity. Inline parts now keep the source's whitespace,
which also removes the space before punctuation after a link ([docs](url) .). Emphasis moves
its edge whitespace outside the delimiters. - HTML fragments convert. Input without
<html>(an HTMX partial,<h1>T</h1><p>x</p>, a
snippet starting with<style>) came back as an empty string, and plain text or""came back
as "extraction failed" with a linkedom TypeError. Such input is now parsed inside an html/body
shell. - An empty extraction now says
<!-- AI: page has no extractable body content -->instead of
returning nothing. - A
<dl>no longer drops its other children. With any<dt>/<dd>present, a note, heading
or bare text inside the list vanished, text 0.1.11 had printed. It now renders in place. - Page text that looks like Markdown stays text. A line starting with
#,>,1.,-,
---,<tagor a code fence became that block; an unclosed fence in a<div>put the rest of
the page inside a code block. Such line starts are escaped. - Adjacent elements are no longer spaced inside a token.
$+19.99,19+.99,
user+@x.testand CJK characters came out as$ 19.99,19 .99,user @x.test,東 京.
Words in a flex row (Plan+starter) still get their space. - Markup glued to text parses as written.
Hey!before a link made an image, a backslash before
one broke it, and bold ending in punctuation before a letter (**Note:**text) was literal stars. - Link text is Markdown. Code, bold and images inside a link were escaped into literal
backticks, stars and brackets ([\x`](u)`), which also put backslashes into image URLs; only the
brackets and backslashes of the link's own text are escaped now. - Code spans holding a backtick use a longer fence (
a`b) instead of closing early. - Table cells: template indentation no longer becomes
<br>in every cell,a<br>band two
<div>lines no longer glue into one word,<script>and icon<title>text stay out, and the
<caption>is printed. - A custom element between words (
<relative-time>) stays in its sentence; a tab panel nested in a
<span>prints once;aria-hidden="True"is honoured like"true"; an icon's<svg><title>is
no longer taken for the page title; a fragment with<body>in the middle keeps the text before it. - SSRF guard: link-local is
fe80::/10. Only thefe80:prefix was blocked, sofe90::1
throughfebf::passed. - Blocks inside a list item stay in the item. A code block, table,
<dl>, quote or paragraph
group inside an<li>started at column 0 after a blank line, which ends the list in CommonMark:
the command of every numbered "1. Install:" step left its step and the numbering restarted, an
item that starts with a block printed a bare-and a blank line (an empty item), list items
after a callout became an indented code block, and text above a nested item that starts with a
block turned into a##heading. Each item now indents what it holds under its marker, a block
that opens the item goes on the marker line (- ```js), and a list nests under10.and later
(four spaces). Checked with micromark 4 + GFM: on 7 step-by-step pages (GitHub, Docker,
Kubernetes, ArchWiki docs among them) 81 code blocks are back inside their steps and no code
text or word changed; of the 14 benchmark pages only python-docs changes (5 code blocks). - Link destinations with an unpaired
(or)are percent-encoded (https://x.test/a)bended
the link aftera, an image with such asrcdid not render at all); only the unpaired
parenthesis is encoded, so/wiki/Foo_(bar)stays as written even with a stray)later in the
URL. ASCII control characters in a destination that cannot be resolved are encoded too. - Text after a stray
</body>or</html>is kept, as a browser keeps it: what linkedom leaves
beside<body>or<html>is moved into the body after parsing. The same characters inside a
<title>or<xmp>stay text. - Paragraphs inside a list item stay separate.
<li><p>A</p><p>B</p></li>printed- Aand
Bwith no blank line, which a parser reads as one paragraph "A B"; text before or after a
<p>in an item was joined the same way. On 21 pages 4 change, by blank lines only. - A rule that opens a bulleted item printed
- ---, which is a thematic break, so the item's
content left the list; it is written- ***. A block after a nested list in the same item (a
figure, for one) is separated by a blank line instead of joining that list's last item. Both
checked on GitHub's renderer and pandoc. - A table nested in a cell stays in that cell. The outer table took every descendant row and
cell, so the inner rows came out again as outer rows and the row holding the inner table widened by
its cells: a 2-column table became 5 columns, one row printed the inner text twice. The inner table
now becomes lines of its cell,k: v<br>k2: v2for header/value rows,·between other cells.
A nested table's<caption>no longer becomes the outer table's caption. - Table cells keep their links, code and emphasis. A cell was plain text, so every row of a users
list lost its link and API tables lost their code formatting (flex-<number>even read as an HTML
tag). Cells now render inline Markdown like a paragraph,|escaped as\|; images stay out of
cells and adjacent elements get no added space, as before. On the benchmark corpus 3 pages gain
links and code in cells,f_scoreis unchanged.
Changed
-
Content under the
hiddenattribute is left out, as a browser and the extension leave it out
(a details-on-demand grid printed all 30 closed detail rows; hidden text is also a way to put
instructions in front of a model that the person reading the page never sees). Kept: tab panels,
hidden="until-found"sections, hidden blocks holding code (unmarked code tabs such as the yarn and
pnpm variants on docs.sentry.io), and React streaming segments (<div hidden id="S:0">). A hidden
list item takes no number.includeHidden: truerestores the old behaviour. On the 21-page corpus
no page changes from this rule. -
Two changes a downstream Markdown renderer can show. A code block inside a list item now stays
in the item, indented under it; Python-Markdown (MkDocs without SuperFences) renders such a fence
as inline code, because itsfenced_codeextension works only at the document root (0.1.11 put
the fence outside the list). An<li>whose only block renders empty is left out instead of
printed as an empty item, so a renderer numbers the items after it one lower; the Markdown keeps
the source numbers. -
<select>,<datalist>,<textarea>,<iframe>,<object>,<embed>,<audio>and
<video>are skipped: option lists and "your browser does not support" fallbacks are not page
text. Elements that render empty no longer fall back to their rawtextContent(except a link's
name), which had let script, style and SVG title text into paragraphs.
Added
assertSafeUrlResolvedandfindIpBlockReasonare exported: the exact checkfetchAndConvert
runs on a URL and on each redirect hop, so a caller can learn before fetching whether a URL will
be refused. Both were already in the published type declarations without being importable.
Docs
- README:
profileis accepted but ignored by the Node build in this version; the fetch's blocked
address ranges are listed, CGNAT100.64.0.0/10(Tailscale) included.
v0.1.11 — first release through npm trusted publishing
Changed
- Releases are published through npm trusted publishing (OIDC). The
publish workflow no longer reads a stored npm token: npm trusts
.github/workflows/publish.ymlof this repository, exchanges the job's
GitHub OIDC token for a short-lived publish token, and records GitHub
Actions as the publisher. A post-publish step fails the release when the
registry shows any other publisher. Provenance attestations continue as
before. - README header leads with the LLM context use case (ChatGPT, Claude,
Gemini) and names the extraction features.
Extraction is unchanged; only the extractor_version reported in
frontmatter moves to 0.1.11.
Published by GitHub Actions through npm trusted publishing, with SLSA provenance for
.github/workflows/publish.yml at refs/tags/v0.1.11.
v0.1.7
What's Changed
- chore(deps): bump actions/checkout from 5 to 7 by @dependabot[bot] in #2
- chore(deps): bump actions/setup-node from 5 to 7 by @dependabot[bot] in #3
- chore(deps-dev): bump vitest from 3.2.7 to 4.1.10 by @dependabot[bot] in #5
- chore(deps-dev): bump @types/node from 22.20.1 to 26.2.0 by @dependabot[bot] in #6
New Contributors
- @dependabot[bot] made their first contribution in #2
Full Changelog: v0.1.6...v0.1.7