---
title: "markdown-crawler"
type: "tool"
slug: "paulpierre-markdown-crawler"
canonical_url: "https://www.graphcanon.com/tools/paulpierre-markdown-crawler"
github_url: "https://github.com/paulpierre/markdown-crawler"
homepage_url: "https://pypi.org/project/markdown-crawler/"
stars: 456
forks: 54
primary_language: "Python"
license: "MIT"
categories: ["llm-frameworks", "developer-tools"]
tags: ["html-to-markdown", "markdown", "llm", "rag", "web-scraper"]
updated_at: "2026-07-07T18:50:10.447502+00:00"
---

# markdown-crawler

> A multithreaded web crawler that converts websites to markdown files for LLM RAG

markdown-crawler is a Python-based tool that recursively crawls through specified URLs or domains and converts the content of each page into a structured Markdown file. It includes features such as multi-threading, URL validation, configurable depth limits, support for tables and images, browser-like User-Agent headers, and more.

## Facts

- Repository: https://github.com/paulpierre/markdown-crawler
- Homepage: https://pypi.org/project/markdown-crawler/
- Stars: 456 · Forks: 54 · Open issues: 5 · Watchers: 5
- Primary language: Python
- License: MIT
- Last pushed: 2026-06-26T14:23:38+00:00

## Categories

- [LLM Frameworks](/categories/llm-frameworks.md)
- [Developer Tools](/categories/developer-tools.md)

## Tags

html-to-markdown, markdown, llm, rag, web-scraper

## Related tools

- [ECC](/tools/affaan-m-ecc.md) - The agent harness performance optimization system (★ 226,962)
- [AutoGPT](/tools/significant-gravitas-autogpt.md) - AutoGPT: Build, Deploy, and Run AI Agents (★ 185,417)
- [ollama](/tools/ollama-ollama.md) - Get up and running with Kimi-K2.6, GLM-5.1, MiniMax, DeepSeek, gpt-oss, Qwen, Gemma and other models. (★ 175,659)
- [prompts.chat](/tools/f-prompts-chat.md) - The world's largest open-source prompt library for AI (★ 165,019)
- [transformers](/tools/huggingface-transformers.md) - 🤗 Transformers: the model-definition framework for state-of-the-art machine learning models (★ 162,347)
- [JavaGuide](/tools/snailclimb-javaguide.md) - Snailclimb/JavaGuide: 面试 & 后端通用面试指南，覆盖计算机基础、数据库、分布式、高并发、系统设计与 AI 应用开发 (★ 156,863)
- [open-webui](/tools/open-webui-open-webui.md) - User-friendly AI Interface (Supports Ollama, OpenAI API, ...) (★ 144,575)
- [awesome-llm-apps](/tools/shubhamsaboo-awesome-llm-apps.md) - 100+ AI Agent & RAG apps you can actually run — clone, customize, ship. (★ 116,702)

## README (excerpt)

```text
```
                |                                     |             
 __ `__ \    _` |        __|   __|   _` | \ \  \   /  |   _ \   __| 
 |   |   |  (   |       (     |     (   |  \ \  \ /   |   __/  |    
_|  _|  _| \__._|      \___| _|    \__._|   \_/\_/   _| \___| _|    

---------------------------------
markdown_crawler - by @paulpierre
---------------------------------
A multithreaded 🕸️ web crawler that recursively crawls a website and creates a 🔽 markdown file for each page
https://github.com/paulpierre
https://x.com/paulpierre                                                        
```
<br><br>

# 📝 Overview
This is a multithreaded web crawler that crawls a website and creates markdown files for each page.
It was primarily created for large language model document parsing to simplify chunking and processing of large documents for RAG use cases.
Markdown by nature is human readable and maintains document structure while keeping a small footprint.
<br>

# ✨ Features include

> - 🧵 Threading support for faster crawling
> - ⏯️ Continue scraping where you left off
> - ⏬ Set the max depth of children you wish to crawl
> - 📄 Support for tables, images, etc.
> - ✅ Validates URLs, HTML, filepaths
> - ⚙️ Configure list of valid base paths or base domains
> - 🚫 Exclude specific paths from crawling (`--exclude-paths`)
> - 🎨 Configurable markdown heading style (`--heading-style`)
> - 🌐 Browser-like User-Agent to bypass JS checks
> - 🍲 Uses BeautifulSoup to parse HTML
> - 🪵 Verbose logging option
> - 👩‍💻 Ready-to-go CLI interface
> - 🧪 Comprehensive test suite (95% coverage)
<br>

# 📦 What's New in v0.0.9

This release resolves **6 open issues** and introduces several community-requested features:

| Issue | Fix |
|-------|-----|
| #7 | UnicodeEncodeError on non-ASCII content — UTF-8 encoding on all file writes |
| #8 | Bypass JavaScript checks — browser-like User-Agent header on all requests |
| #9 | Exclude paths from crawling — new `--exclude-paths` / `-x` CLI flag |
| #10 | target_content CSS selector handling — null href links now skipped |
| #11 | UnboundLocalError fix in get_target_content |
| #17 | Dependencies added to pyproject.toml for uvx support |
| #20 | Configurable heading_style for markdownify (`ATX`, `UNDERLINE`, etc.) |

Also includes a comprehensive test suite — 60 tests, 95% coverage. See the [CHANGELOG.md](CHANGELOG.md) for full details.
<br>

# 🏗️ Use cases
- RAG (retrieval augmented generation) - my primary usecase, use this to normalize large documents and chunk by header, pargraph or sentence
- LLM fine-tuning - Create a large corpus of markdown files as a first step and leverage `gpt-3.5-turbo` or `Mistral-7B` to extract Q&A pairs
- Agent knowledge - Leverage this with [autogen](https://github.com/microsoft/autogen) for expert agents, for example if you wish to reconstruct the knowledge corpus of a videogame or movie, use this to generate the given expert corpus
- Agent / LLM tools - Use this for online RAG learning so your chatbot continues to learn. Use SERP and scrape + index top N results w/ markdown-crawler
- many more ..

<br><br>

# 🚀 Get started

If you wish to simply use it in the CLI, you can run the following command:

Install the package
```
pip install markdown-crawler
```

Execute the CLI
```
markdown-crawler -t 5 -d 3 -b ./markdown https://en.wikipedia.org/wiki/Morty_Smith
```

To run from the github repo, once you have it checked out:
```
pip install .
markdown-crawler -t 5 -d 3 -b ./markdown https://en.wikipedia.org/wiki/Morty_Smith
```

Or use the library in your own code:
```
from markdown_crawler import md_crawl
url = 'https://en.wikipedia.org/wiki/Morty_Smith'
md_crawl(url, max_depth=3, num_threads=5, base_path='markdown')
```
<br><br>

# ⚠️  Requirements
- Python 3.x
- BeautifulSoup4
- requests
- markdownify

<br><br>
# 🔍 Usage

The following arguments are supported
```
usage: markdown-crawler [-h] [--max-depth MAX_DEPTH] [--num-threads NUM_THREADS] [--base-dir
```

---

**Machine-readable endpoints**

- JSON: [`/api/graphcanon/tools/paulpierre-markdown-crawler`](/api/graphcanon/tools/paulpierre-markdown-crawler)
- LLM index: [/llms.txt](/llms.txt)
- Full corpus: [/llms-full.txt](/llms-full.txt)

_GraphCanon - The knowledge graph for AI development. https://www.graphcanon.com/_
