formats.markdown and read markdown.data. Headings, lists, tables, and code retain Markdown formatting. YouTube URLs return a video or channel document.
Request Markdown
Options
Choose the Markdown source
Many docs sites, including GitHub Docs, Mintlify, and GitBook, publish a Markdown version of each page. It often leads to a cleaner markdown than an HTML conversion, but some sites leave content out of it, such as extra code tabs.markdownParams.sourcePreference lists the sources to try, in order. The first usable one wins.
- The default,
["html-conversion", "markdown-direct"], converts the HTML and falls back to published Markdown only for near-empty conversions. ["markdown-direct", "html-conversion"]prefers published Markdown and converts the HTML when there is none.["markdown-direct"]fails withNO_PUBLISHED_MARKDOWNwhen the page publishes no Markdown. Failed requests are not billed.["html-conversion"]never uses published Markdown.
includeLinks, includeImages, and inlineImages only apply to html-conversion; requests that set them without listing html-conversion are rejected. Requests with sharedParams.includeSelectors or sharedParams.excludeSelectors never use markdown-direct, so they must include html-conversion. Crawl and batches accept the same sourcePreference.
Prepare text for embeddings
markdownParams.includeImages to true. To capture matching text and a screenshot, request both formats and set maxAgeMs: 0.
An empty string can mean content filters matched nothing. Check the selected content before retrying. See limits and errors for failed outputs.