# Markdown

Ask sites for markdown first, so your agent reads clean text.

## Any page as markdown

`markdown_output` converts the page Frankensurf got into markdown, whichever tool got it:
headings, paragraphs, nested lists, links and images (made absolute), bold and italics, code
blocks, tables and quotes. It comes back as `markdown`, next to the plain `text`. Scripts, styles
and forms are dropped; menus stay (add `main_content` for the article alone). A page the site
already served as markdown is passed through as it is.

```python

page = fs.read("https://docs.python.org/3/library/asyncio-task.html", markdown=True)
print(page.markdown[:500])
```

`--markdown-output` on the CLI, `markdown` in the MCP `read` tool. `frankensurf serve` always
returns it in Firecrawl's `markdown` field.

## Ask the site for markdown

With `prefer_markdown`, the first request asks for `text/markdown`. Sites that
support [Markdown for Agents](https://developers.cloudflare.com/fundamentals/reference/markdown-for-agents)
answer with markdown directly; everyone else gets the usual HTML route.

- No browser and no extra request when the site supports it.
- On by default in the MCP `read` tool.
- [Jina Reader](/docs/integrations/jina-reader/) returns markdown for sites that don't.

## Usage

```python
page = await web.read("https://developers.cloudflare.com/fundamentals/reference/markdown-for-agents/",
                      policy_overrides={"prefer_markdown": True})
```

```bash
frankensurf read https://developers.cloudflare.com/fundamentals/reference/markdown-for-agents/ --markdown
```

```json
{ "tool": "read", "arguments": { "url": "https://developers.cloudflare.com/fundamentals/reference/markdown-for-agents/" } }
```

```json title="Response"
{
  "title": "Markdown for Agents",
  "content_type": "text/markdown; charset=utf-8",
  "text": "---\ndescription: Cloudflare's Markdown for Agents converts HTML to Markdown at the edge…",
  "structured": { "format": "markdown" },
  "receipt": { "method": "http", "latency_ms": 261 }
}
```

## When to turn it off

Markdown keeps links and headings, so it is not always shorter than
Frankensurf's extracted text. If you need the page's HTML structure, pass
`prefer_markdown: false` (over MCP, in `acquisition_policy`).
