Convert Page to Markdown
page_to_markdownConverts web pages or supplied HTML into clean Markdown for LLM context, preserving headings, code blocks, links, and tables while removing navigation, headers, and footers.
Instructions
Fetch a web page URL and convert it to clean Markdown optimized for LLM context. Preserves headings, code blocks (with language hints), links, and tables; keeps the main content and drops navigation, headers, footers, and sidebars. It fetches without cookies and runs no page scripts, so a page behind a sign-in or one rendered only by JavaScript comes back as its login page or with no content. For those, pass the page HTML you already have from a browser tool as html (with its url, relative links resolve and nothing is fetched), or ask the user to turn on Agent Bridge in the Page2AI browser extension 1.6.0 or later (if its popup has no Agent Bridge switch, that install is an older store version and the extension must be updated first): while it is connected, url pages open in the user's own browser with its cookies and scripts, and a page the extension declines is fetched by the server, with a note saying why. It requests only the URL given, as a browser opens a page, so docs sites return the page itself, not a Markdown copy of it; a URL that names a Markdown or text file (a raw GitHub README.md, an llms.txt) comes back as written. A long page comes back in parts (max_length, start_index), the first part listing the page's sections, and a page the server cannot read comes back with the next step to take. Discovers tab groups statically and emits each panel as a ### Tab: {label} section instead of concatenating (prevents Python+TypeScript examples merging into one broken block). Zero external API calls: pages are parsed locally (linkedom) or in the user's browser.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| url | No | Absolute HTTP or HTTPS URL of the web page to convert. Blocks private ranges, loopback, and cloud metadata endpoints. Given with `html`, it is not fetched: it names the page the HTML came from, and relative links resolve against it. | |
| html | No | Raw HTML of the page to convert instead of fetching it, e.g. from a browser tool. Pass the page's `url` with it so relative links resolve. Either `url` or `html` is required. | |
| max_length | No | Return at most this many characters of the page's Markdown. A longer page comes back in parts: each part names the start_index of the next one, and the first part lists the page's sections with their start_index. Range: 100-1000000. | |
| timeout_ms | No | Abort the fetch after N milliseconds. Range: 1000-60000. | |
| start_index | No | Character offset to read from: the start_index a part named for the next one, or a section's from the list on the first part. Later parts come from the text the first part was cut from, kept for 10 minutes. | |
| include_images | No | Include image references () in the output. Applies on every path, including through Agent Bridge. | |
| include_frontmatter | No | Prepend a YAML frontmatter block with title, source URL, capture timestamp, language, description, and canonical URL. Applies on every path, including through Agent Bridge. |