# Turn Python documentation pages into clean Markdown for RAG

**Use case:** 

Converts three pages of the official Python tutorial into clean Markdown and plain text, one row per page, with headings, code blocks, tables and links kept and the menus, sidebars and footers dropped. Each row also has the page title, language, character count and the links found in the content. Replace the URLs with any documentation or article pages to build a RAG corpus.

## Input

```json
{
  "urls": [
    "https://docs.python.org/3/tutorial/introduction.html",
    "https://docs.python.org/3/tutorial/controlflow.html",
    "https://docs.python.org/3/tutorial/datastructures.html"
  ],
  "maxItems": 3,
  "maxCharsPerPage": 40000,
  "includeLinks": true,
  "respectRobotsTxt": true,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

## Output

```json
{
  "url": {
    "label": "Page",
    "format": "string"
  },
  "title": {
    "label": "Title",
    "format": "string"
  },
  "status": {
    "label": "Status",
    "format": "string"
  },
  "charCount": {
    "label": "Characters",
    "format": "integer"
  },
  "truncated": {
    "label": "Truncated",
    "format": "boolean"
  }
}
```

## How it works

### 1. Sign up on Apify or log in

The URL to Markdown: Clean Text for RAG & LLMs Actor is ready to run with the inputs already set for "Turn Python documentation pages into clean Markdown for RAG". [Sign up or log in](https://console.apify.com/create-task-from-example/yZX7hTclKWT64wa9y) and you'll land in Apify Console with a copy of this exact task.

### 2. Start the "Turn Python documentation pages into clean Markdown for RAG" task

The URL to Markdown: Clean Text for RAG & LLMs Actor will start running based on the input automatically. You can also change all the input fields, like page urls, maximum pages, and more, to match your specific use case.

### 3. Receive the "Turn Python documentation pages into clean Markdown for RAG" output

Monitor the progress in real time. You will be notified as soon as your dataset is complete and ready for review. Each result includes data such as page, title, status, and more.

### 4. Integrate into your workflow

The final output is delivered in JSON, CSV, or Excel format, ready to be plugged into your workflow. You can also [run the "Turn Python documentation pages into clean Markdown for RAG" task via API](https://apify.com/kizukidata/url-to-markdown.md).

## FAQ

### What does the docs to Markdown task return?

The docs to Markdown task returns one row per page: the main content as Markdown and as plain text, the title, description, language, character count, whether the page was cut, and the absolute links in the content.

### Can I convert other pages?

Replace Page URLs in the docs to Markdown task with any public HTML pages, up to 200 per run, and raise Maximum pages to match. Pages that need JavaScript to show content write no row and are not charged.

### What is left out of the Markdown?

The docs to Markdown task keeps headings, links, tables, lists, code blocks and blockquotes, and drops menus, cookie banners, sidebars and footers, so a RAG chunk quotes the page and not its navigation.

### Does the task need an account or a browser?

The docs to Markdown task needs no login and no browser. It reads each page's HTML, respects robots.txt, charges only for pages that produced content, and is not affiliated with the Python Software Foundation.

## About this Actor

This example demonstrates how to use [URL to Markdown: Clean Text for RAG & LLMs](https://apify.com/kizukidata/url-to-markdown.md) with a specific input configuration. Visit the [Actor detail page](https://apify.com/kizukidata/url-to-markdown.md) to learn more, explore other use cases, and run it yourself.


## How to integrate an Actor?

This Task's input is already configured above. Use it as-is rather than inventing a new one.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For full API examples (JavaScript, Python, CLI, MCP, OpenAPI), see this Task's Actor page: https://apify.com/kizukidata/url-to-markdown.md

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).
