# RAG-Ready Documentation Scraper (`alaricus/rag-docs-markdown-scraper`) Actor

Scrape documentation to framework-optimized Markdown. Features semantic chunking for LLM, vector database, and RAG pipelines. Parse XML sitemaps easily.

- **URL**: https://apify.com/alaricus/rag-docs-markdown-scraper.md
- **Developed by:** [Alaricus](https://apify.com/alaricus) (community)
- **Categories:** AI, Automation, Developer tools
- **Stats:** 3 total users, 1 monthly users, 100.0% runs succeeded, 1 bookmarks
- **User rating**: No ratings yet

## Pricing

from $3.99 / 1,000 results

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.
Actors are written with capital "A".

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

## RAG-Ready Documentation Scraper

[![RAG-Ready Documentation Scraper Actor](https://apify.com/actor-badge?actor=alaricus/rag-docs-markdown-scraper)](https://apify.com/alaricus/rag-docs-markdown-scraper)

### What does the RAG-Ready Documentation Scraper do?

The **RAG-Ready Documentation Scraper** is a high-performance web crawler and content parser designed specifically for LLM, vector database, and Retrieval-Augmented Generation (RAG) pipelines. It extracts clean, structured, framework-optimized Markdown text from documentation sites and standard websites, stripping out all clutter (navigation panels, header menus, search boxes, cookie consent forms, and footer noise) to leave only pure content body.

To make the outputs immediately ready for ingestion, the actor performs **semantic paragraph-based chunking** with configurable character sizes and contextual overlaps. It also parses XML sitemaps automatically to crawl entire documentation trees with zero extra configuration.

### Key Features

- 🧹 **Boilerplate Layout Scrubbing**: Automatically detects and isolates main documentation content layouts. Eliminates menus, headers, sidebars, footer links, and cookie alerts.
- 🧩 **Semantic Chunking**: Splits extracted Markdown documents cleanly on paragraph boundaries. If any single paragraph is too large, it is split sentences/character-wise, with a configurable context overlap to avoid losing context.
- 📄 **XML Sitemap Parsing**: Simply supply a `sitemap.xml` URL as a starting point and the scraper will auto-discover and queue all links in the sitemap.
- 📦 **Framework Adaptation**: Built-in optimized container detection for popular documentation builders:
  - **Docusaurus**
  - **GitBook**
  - **Sphinx**
  - **ReadTheDocs**
  - **Auto-Detect** (for any generic blog, API reference, or standard page)
- 🖼️ **Image & Link Toggles**: Include or strip images (`![alt](url)`) and hyperlinks (`[text](url)`) on demand depending on your RAG embedding requirements.

***

### Input Parameters

| Parameter | Type | Default | Description |
| :--- | :--- | :--- | :--- |
| **Start URLs** (`start_urls`) | `Array` | *Required* | List of documentation base URLs or XML sitemap URLs. |
| **Documentation Framework** (`framework`) | `String` | `auto` | Choose target framework (`auto`, `docusaurus`, `gitbook`, `sphinx`, `readthedocs`) to improve main content wrapper detection. |
| **Enable Semantic Chunking** (`enable_chunking`) | `Boolean` | `true` | When enabled, splits Markdown outputs into semantic chunks on paragraph boundaries. |
| **Chunk Size** (`chunk_size`) | `Integer` | `1500` | Target character size of each chunk. |
| **Chunk Overlap** (`chunk_overlap`) | `Integer` | `200` | Overlap character length between sequential chunks. |
| **Maximum Pages to Scrape** (`max_pages`) | `Integer` | `50` | Maximum number of pages the crawler will visit. |
| **Include Image Links** (`include_images`) | `Boolean` | `true` | Retain image Markdown tags in extracted text. |
| **Include Hyperlinks** (`include_links`) | `Boolean` | `true` | Retain anchor link Markdown tags in extracted text. |

#### Input Example

```json
{
  "start_urls": [
    {
      "url": "https://docusaurus.io/docs"
    }
  ],
  "framework": "docusaurus",
  "enable_chunking": true,
  "chunk_size": 1500,
  "chunk_overlap": 200,
  "max_pages": 100,
  "include_images": true,
  "include_links": true
}
```

***

### Output Data Structure

The results are pushed directly to your Apify dataset. Each item represents a scraped page and has the following schema:

```json
{
  "url": "https://docs.gitbook.com/",
  "title": "Overview | GitBook Documentation",
  "markdown": "# Overview\n\nWelcome to the GitBook documentation portal...",
  "chunks": [
    "# Overview\n\nWelcome to the GitBook documentation portal...",
    "To start configuring your docs, see the Git Sync integration guide..."
  ],
  "chunk_count": 2
}
```

***

### Pricing: Pay-Per-Event (PPE)

This Actor uses the transparent **Pay-Per-Event** pricing model, meaning you only pay for the pages you successfully scrape.

- **Price per 1,000 pages**: $3.99
- **Price per page**: $0.00399

***

### Feedback & Customizations

If you encounter any issues, need to request a specific feature, or require a custom scraping solution for your business, feel free to get in touch.

- **Developer**: bd.pascari@gmail.com

# Actor input Schema

## `start_urls` (type: `array`):

List of URLs of the documentation pages or XML sitemaps to start crawling.

## `framework` (type: `string`):

Select the documentation framework to scrape. 'auto' will attempt to auto-detect.

## `enable_chunking` (type: `boolean`):

Split the generated Markdown pages into smaller text chunks suitable for vector databases.

## `chunk_size` (type: `integer`):

Approximate character size for each semantic chunk.

## `chunk_overlap` (type: `integer`):

Overlap between consecutive chunks to maintain local context.

## `max_pages` (type: `integer`):

Limit the number of pages to scrape to prevent runaway runs and excessive compute usage.

## `include_images` (type: `boolean`):

Include image markdown syntax (e.g. ![Alt text](url)) in the output.

## `include_links` (type: `boolean`):

Include markdown hyperlinks (e.g. [Link Text](url)) in the output.

## Actor input object example

```json
{
  "start_urls": [
    {
      "url": "https://docusaurus.io/docs"
    }
  ],
  "framework": "auto",
  "enable_chunking": true,
  "chunk_size": 1500,
  "chunk_overlap": 200,
  "max_pages": 50,
  "include_images": true,
  "include_links": true
}
```

# Actor output Schema

## `results` (type: `string`):

No description

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "start_urls": [
        {
            "url": "https://docusaurus.io/docs"
        }
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("alaricus/rag-docs-markdown-scraper").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "start_urls": [{ "url": "https://docusaurus.io/docs" }] }

# Run the Actor and wait for it to finish
run = client.actor("alaricus/rag-docs-markdown-scraper").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "start_urls": [
    {
      "url": "https://docusaurus.io/docs"
    }
  ]
}' |
apify call alaricus/rag-docs-markdown-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,alaricus/rag-docs-markdown-scraper"
        }
    }
}

```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/6KqRVI1G6ZJU05U8p/builds/VKUDXVTY3Zk2Y2hmN/openapi.json
