# Docs-to-Markdown Crawler with llms.txt (`brotherly_elm/docs-to-markdown-crawler`) Actor

Build llms.txt and convert public documentation, knowledge-base, and product pages to Markdown. Set scope, depth, and page limits. HTTP(S) only; robots.txt obeyed; no JavaScript rendering or login.

- **URL**: https://apify.com/brotherly_elm/docs-to-markdown-crawler.md
- **Developed by:** [Iris](https://apify.com/brotherly_elm) (community)
- **Categories:** Developer tools, AI, Automation
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.00 / 1,000 content page rows

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?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
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.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## 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.

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 examples already wired to this Actor's own input schema, see the [API](#api) section below.

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`).

# README

## Docs-to-Markdown Crawler with llms.txt

Create an `llms.txt` index and Markdown page records from public documentation, knowledge-base, and product pages. Choose the sites and URLs you are permitted to crawl. The Actor fetches HTTP(S) content, always obeys robots.txt, and does not log in, send cookies, or render JavaScript.

### What it does

Provide one or more start URLs, then choose how far the crawl may travel. The crawler follows in-scope links, can discover URLs from a sitemap, and converts fetched HTML into Markdown or plain text. Use include and exclude path globs to focus the crawl. When `llmsTxt` is enabled, the Actor saves `llms.txt` and `llms-full.txt` to the key-value store: the first is a sectioned list of page links and the second joins the extracted page Markdown.

Crawl scope can stay on the same host or be limited to the starting path prefix. The crawler checks robots.txt for the requested pages and redirect destinations. It refuses private, loopback, and link-local destinations; redirects are followed only after URL checks. A 5 MB response-body limit applies. Responses that are not HTML are skipped, and pages without extracted content do not become dataset rows. The `SKIPPED` and `SUMMARY` key-value records contain skip details and run counts/reason.

### What you get

Each dataset row describes a fetched page that produced content. `outputFormat` selects which content format appears in the main `content` field; Markdown and text fields are also present in the output schema.

| Field | Meaning |
| --- | --- |
| `url` | Page URL that was fetched |
| `canonicalUrl` | Canonical URL, when the page provides one |
| `title` | Extracted document title |
| `description` | Meta description, when available |
| `content` | Content in the format selected by `outputFormat` |
| `markdown` | Extracted page represented as Markdown |
| `text` | Plain-text rendering of extracted content |
| `wordCount` | Number of extracted words |
| `depth` | Link distance from a supplied start URL |
| `httpStatus` | HTTP response status |
| `fetchedAt` | Fetch time in UTC |

The `llms.txt` index uses a `# ` title, a `> ` summary, and `## ` sections with Markdown link entries. It is intended as a compact index of the pages actually returned by a crawl, not a guarantee of complete site coverage. `llms-full.txt` contains page Markdown joined for convenient reading or downstream processing.

### How to use

1. Add the public pages you want to crawl in `startUrls`.
2. Set `maxPages` and `maxDepth` to bound the run.
3. Choose `sameHost` or `samePathPrefix` for `scope`; optionally set include/exclude path globs.
4. Enable `useSitemap` to discover URLs from sitemap.xml, if useful.
5. Select `markdown` or `text`; set `llmsTxt` to save the two index files.
6. Inspect dataset rows and the `SUMMARY` and `SKIPPED` key-value records.

You choose the sites. Check that you have permission to access them and that the site's robots.txt policy and terms allow crawling. Robots handling fails closed when the robots request fails or returns an HTTP error; a robots.txt 404 is treated as no published policy. A site returning 403 or 429 is not retried.

### Input reference

| Input | Type | Default | Description |
| --- | --- | --- | --- |
| `startUrls` | URL list | Python docs URL | One or more HTTP(S) starting URLs; required. |
| `maxPages` | Integer, 1–500 | 50 | Maximum number of URLs to visit. |
| `scope` | `sameHost` or `samePathPrefix` | `sameHost` | Boundary for discovered pages. |
| `useSitemap` | Boolean | `false` | Discover URLs from sitemap.xml. |
| `includeGlobs` | String list | `[]` | Optional path patterns to include. |
| `excludeGlobs` | String list | `[]` | Path patterns to skip. |
| `maxDepth` | Integer, 0–20 | 3 | Maximum link distance from each start URL. |
| `outputFormat` | `markdown` or `text` | `markdown` | Format selected for the `content` value. |
| `llmsTxt` | Boolean | `false` | Save `llms.txt` and `llms-full.txt` in the key-value store. |
| `selfTest` | Boolean | `false` | Run the embedded synthetic offline fixture instead of fetching sites. |

### Input example

This uses a real public documentation page that returned 20 rows in a local crawl. The example caps this run at 10 pages and requests the two key-value files:

```json
{"startUrls":["https://docs.python.org/3/library/index.html"],"maxPages":10,"llmsTxt":true}
```

### Output example

Excerpt from a real page sample collected in the local documentation crawl. This page came from the Kubernetes documentation site; the Markdown excerpt preserves the page headings and links.

```markdown
## Kubernetes Documentation | Kubernetes

Source: https://kubernetes.io/docs/home/

Kubernetes is an open source container orchestration engine for automating deployment, scaling, and management of containerized applications.

### Understand Kubernetes

Learn about Kubernetes and its fundamental concepts.

- [Why Kubernetes?](https://kubernetes.io/docs/concepts/overview/#why-you-need-kubernetes-and-what-can-it-do)
- [Components of a cluster](https://kubernetes.io/docs/concepts/overview/components/)
```

### Measured coverage (November 2026)

In a 300-host sample frozen on 2026-11-21 before target requests, 50 hosts returned a complete Markdown-classified `/llms.txt` body and 18 did so for `/llms-full.txt`. “Markdown” means a non-HTML response whose first nonblank line begins with a Markdown heading; this is a syntax check, not a quality judgment. Hosts came in rank order from the 2026-11-01 30-day PyPI ranking, preferring documentation URLs then home/project URLs. Intended exclusions covered code-hosting and package-index hosts, duplicates, and selected personal/vanity hosts. Yet legacy code-hosting hostname `code.google.com` remained in the denominator; neither target path was queried because its robots.txt specified `Crawl-delay: 120`, above the skip threshold. This ranking-derived convenience sample is not random.

| Per-host outcome | `/llms.txt` | `/llms-full.txt` |
|---|---:|---:|
| Markdown body | 50 | 18 |
| 404 | 150 | 178 |
| Redirect not followed | 1 | 5 |
| HTML | 2 | 3 |
| Other response | 2 | 1 |
| Not queried: robots unavailable | 90 | 90 |
| Not queried: disallowed by robots | 4 | 4 |
| Not queried: crawl-delay skip | 1 | 1 |
| Requests made | 205 | 205 |

Requests ran sequentially from 2026-11-21 21:13:55 to 21:29:33 UTC; the collector checked robots.txt first and requested only allowed paths, without redirects or retries. Each path’s 300-host denominator includes all 95 unqueried hosts. A 404 at these exact paths does not establish that equivalent guidance is absent elsewhere; robots-blocked or unavailable hosts are missing observations. This one convenience sample cannot estimate prevalence across the web, and the syntactic classification does not assess usefulness.

### Price

The configured charge is $0.001 for each page row written to the default dataset, plus a $0.00005 start event for a run. A 100-page run is calculated as **$0.001 × 100 = $0.10**, plus **$0.00005**, for **$0.10005** in event charges. A 1,000-page run is **$0.001 × 1,000 = $1.00**, plus **$0.00005**, for **$1.00005**. These estimates assume every page produces a row and one start event. Skipped or empty pages do not produce dataset rows. Separate platform usage, if any, is not included in these event arithmetic examples. Live charging for this Actor has not been verified.

### Limits

The crawler uses ordinary HTTP(S) requests and parses returned HTML. It has no JavaScript rendering, browser automation, login, cookies, or PDF extraction. It always obeys robots.txt, including on redirect destinations. You choose the sites; crawl only where you are permitted and where the site's policy allows it. A 5 MB body limit and the input page/depth caps bound individual runs. Some navigation text may remain in extracted Markdown, depending on the page's HTML structure. In the saved Requests quickstart capture, the word-overlap audit retained 2,280 of 2,550 source-main words. It does not promise that every page will be discovered or yield a dataset row.

### Limits and FAQ

**Does it execute JavaScript or handle pages that require a login?**

No. It downloads HTML over HTTP(S) without a browser engine, credentials, or cookies. Content that only appears after JavaScript runs is not rendered, and authenticated pages are not accessible through this Actor.

**Will it obey robots.txt?**

Yes. It checks robots.txt before page requests and redirect destinations. Policy errors and request failures block the origin; a 404 is treated as no published robots policy. You are responsible for choosing sites you may crawl and following applicable terms.

**Why are some navigation links or labels in my Markdown?**

The extractor removes common structural and navigation elements, but page templates vary. Some navigation text may remain if it is embedded in content or uses markup the extractor cannot identify as navigation.

**Why did a URL not appear as a dataset row?**

Only fetched pages with extracted content become rows. A URL may be outside the selected scope, excluded by a path glob, disallowed by robots.txt, unreachable, non-HTML, or empty after extraction. Check `SKIPPED` for recorded reasons and `SUMMARY` for the run's counts and stop reason.

**Where are the index files?**

Set `llmsTxt` to true. The Actor writes `llms.txt` and `llms-full.txt` to the run's key-value store. The compact file contains sectioned page links; the full file joins extracted Markdown for the pages returned.

**Can I crawl any site?**

You choose the sites and start URLs, subject to permission, site policy, and the crawler's public HTTP(S), scope, and robots.txt rules. The Actor refuses private-network destinations and does not bypass access controls.

# Actor input Schema

## `startUrls` (type: `array`):

One or more HTTP or HTTPS pages to crawl. Robots.txt is always obeyed.

## `maxPages` (type: `integer`):

Maximum number of URLs to visit.

## `scope` (type: `string`):

Restrict discovered pages to the same host or starting path prefix.

## `useSitemap` (type: `boolean`):

Discover additional same-scope URLs from sitemap.xml.

## `includeGlobs` (type: `array`):

Optional path patterns to include.

## `excludeGlobs` (type: `array`):

Path patterns to skip.

## `maxDepth` (type: `integer`):

Maximum link depth from each start URL.

## `outputFormat` (type: `string`):

Choose Markdown or plain text for each row.

## `llmsTxt` (type: `boolean`):

Save llms.txt and llms-full.txt in the key-value store.

## `selfTest` (type: `boolean`):

Run the embedded synthetic fixture without network access.

## Actor input object example

```json
{
  "startUrls": [
    {
      "url": "https://docs.python.org/3/"
    }
  ],
  "maxPages": 50,
  "scope": "sameHost",
  "useSitemap": false,
  "includeGlobs": [],
  "excludeGlobs": [],
  "maxDepth": 3,
  "outputFormat": "markdown",
  "llmsTxt": false,
  "selfTest": false
}
```

# Actor output Schema

## `dataset` (type: `string`):

No description

## `summary` (type: `string`):

No description

## `skipped` (type: `string`):

No description

## `llmsTxt` (type: `string`):

No description

## `llmsFullTxt` (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 = {};

// Run the Actor and wait for it to finish
const run = await client.actor("brotherly_elm/docs-to-markdown-crawler").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 = {}

# Run the Actor and wait for it to finish
run = client.actor("brotherly_elm/docs-to-markdown-crawler").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 '{}' |
apify call brotherly_elm/docs-to-markdown-crawler --silent --output-dataset

```

## MCP server setup

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

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/qSQ3VkatLSjE5Eadb/builds/dSpP59r35edEQkMIC/openapi.json
