Reading Web Pages as Markdown
Give your AI assistant clean Markdown from any URL. It can read a page, pull only the passages that answer a question, split a page into chunks, or list its headings, links and images, all through one tool: getOgMarkdown.
Works with either connection method. Sign in with your account or use an API key; the tool is also available when you run the server locally. See Signing In and Installation.
Overview
getOgMarkdown calls the URL to Markdown API. It fetches the page, strips navigation, ads and boilerplate, and returns the main content as Markdown with its headings, links and images intact. Your assistant decides when to call it; you just ask about a page.
Four things it is good at:
- Reading a page: an article, a docs page or a changelog, as clean text instead of raw HTML
- Answering from a long page: only the passages that match a question, ranked, instead of the whole page
- Chunking for embeddings: the page split at its headings, each chunk with its heading path
- Reading structure: the heading outline, every link or every image, with or without the prose
Read a page
Ask for a page by URL and the assistant gets its main content as Markdown, along with the page title, description, language and canonical URL.
Read https://www.opengraph.io/docs/api/markdown and summarize what the chunking options do.The text your assistant sees is capped at 6,000 characters; the full Markdown is always in the structured markdown field. For a long page, ask a question instead, as below, so the assistant gets the relevant part rather than the first 6,000 characters. Set max_chars only when you want a hard cap on the prose.
Answer a question from a long page
Set query and the tool splits the page into chunks and returns only the passages that best match, ranked. query_top_k sets how many come back (default 5, up to 25). Chunking turns on by itself when a query is set.
On https://www.opengraph.io/docs/api/markdown, what is the default max_chunks and what happens when a page produces more chunks than that?Ranking is keyword based (BM25), so passages that use the words in the question score highest. It ranks passages within one page; it does not search across pages or replace a vector index. To ask a question that needs a written answer rather than passages, use getOgQuery.
The passages your assistant sees share the same 6,000 character cap, and five chunks of 2,000 characters can pass it. If later passages come back cut off, lower query_top_k or chunk_size.
Split a page into chunks for embeddings
Set chunking and the response includes the page split into chunks. Each chunk carries its heading path and position, so a passage retrieved later still says where it came from.
chunk_size: target characters per chunk, 200 to 20,000 (default 2,000, roughly 500 tokens)chunk_overlap: characters repeated from the previous chunk, up to half ofchunk_size(default 0)heading_awareandheading_aware_level: start a new chunk at every heading down to that level (default on, at H1 and H2)max_chunks: how many chunks to return, 1 to 2,000 (default 500)include_markdown: false: return the chunks without the full prose
Split https://www.opengraph.io/docs/api/markdown into chunks of about 1,500 characters at each H2, and list each chunk's heading path and character count.For choosing a chunk size and overlap, and for storing the source with each chunk, see URL to Markdown for RAG.
Read a page's structure
include_headings, include_links and include_images return the heading outline, every link with its text and rel attributes, and every image with its alt text. Add include_markdown: false when you only want the structure. This saves a separate scrape just to list links.
List every heading on https://example.com/pricing as an outline, and every link that goes off the site.Pages that need JavaScript
Pages detected as JavaScript apps are rendered in a browser automatically. When the Markdown still comes back short or empty, these options help:
full_render: always render in a browser firstwait_for_selector: wait for an element that signals the content is readyscroll_to_bottom: scroll to load content that appears as you scrollload_more_selectorandload_more_clicks: click a "load more" button up to 10 times before converting
wait_for_selector and scroll_to_bottom turn on rendering by themselves.
Pages you don't trust
The tool fetches whatever URL it is given, and a page can contain text written to instruct an AI. Every result already comes back labeled as untrusted page content, so your assistant is told to treat it as data rather than instructions.
Set ai_sanitize: true to add a scan for prompt injection, for 1 extra credit. ai_sanitize_mode chooses what happens: sanitize removes what it finds and returns a safety report, warn returns the page unchanged with the report, and block returns an error instead of a risky page.
The scan is best effort: it looks for known injection patterns and can miss new ones. If it can't finish, the page comes back unscanned with risk_level: unknown and sanitizer_error: true. Either way, keep treating the content as untrusted.
Which tool to use
| You want | Tool |
|---|---|
| Readable page content, passages for a question, chunks or structure | getOgMarkdown |
| A written answer to a question about a page | getOgQuery |
| Title, description and image for a social preview | getOgData |
| Raw HTML to parse yourself | getOgScrapeData |
| Specific elements by tag or CSS selector | getOgExtract |
| What the page looks like | getOgScreenshot |
Parameter Reference
Only url is required. The options below are the ones most worth knowing; the tool also accepts the cache, proxy, retry and language options of the Markdown API.
| Parameter | Default | What it does |
|---|---|---|
| url | required | The page to convert |
| only_main_content | true | Strip navigation, header, footer and ads; false converts the whole page |
| include_tags / exclude_tags | none | CSS selectors to keep, or to remove, before converting |
| max_chars | none | Truncate the Markdown to this many characters |
| query | none | Return only the passages that best match this question, ranked |
| query_top_k | 5 | How many passages to return for a query (1 to 25) |
| chunking | false | Split the page into chunks; on automatically with a query |
| chunk_size | 2000 | Target characters per chunk (200 to 20,000) |
| chunk_overlap | 0 | Characters repeated between chunks, up to half of chunk_size |
| heading_aware / heading_aware_level | true / 2 | Start a new chunk at every heading down to this level |
| max_chunks | 500 | Most chunks to return (1 to 2,000) |
| include_chunks | same as chunking | False returns chunk counts without the chunk text |
| include_headings / include_links / include_images | false | Return the outline, links or images as structured data |
| include_markdown | true | False leaves out the prose, for structure or chunks only |
| include_metadata | true | Page title, description, language and canonical URL |
| full_render | false | Always render in a browser before converting |
| wait_for_selector | none | Wait for this CSS selector before reading the page |
| scroll_to_bottom | false | Scroll to load content that appears as you scroll |
| load_more_selector / load_more_clicks | none / 3 | Click a "load more" button this many times (1 to 10) |
| ai_sanitize / ai_sanitize_mode | false / sanitize | Best effort prompt injection scan (1 extra credit), then sanitize, warn or block |