Skip to main content

A Python library for crawling web pages and converting them to markdown format

Project description

Web to Markdown

A Python library for crawling web pages and converting them to markdown format. This tool helps you easily convert web documentation, blogs, or any web content into clean markdown files while preserving the content structure.

Features

  • Depth-limited web crawling
  • Domain/path boundary respect
  • Smart content extraction using readability-lxml
  • Clean HTML to Markdown conversion
  • Metadata extraction
  • Command-line interface with configurable options

Installation

pip install web-to-markdown

Usage

Command Line Interface

# Basic usage
web-to-markdown -u https://example.com/docs -o output.md

# Specify crawl depth
web-to-markdown -u https://example.com/docs -d 2 -o output.md

# Enable verbose logging
web-to-markdown -u https://example.com/docs -v

Python API

from web_to_markdown import WebCrawler, MarkdownConverter

# Initialize crawler
crawler = WebCrawler(base_url="https://example.com/docs", max_depth=3)

# Crawl pages
pages = crawler.crawl()

# Convert to markdown
converter = MarkdownConverter()
markdown_content = converter.convert_to_markdown(pages)

# Save the result
converter.save_markdown(markdown_content, "output.md")

Command Line Options

  • -u, --url: Base URL to crawl (required)
  • -d, --depth: Maximum crawl depth (default: 3)
  • -o, --output: Output markdown file path (default: output.md)
  • -v, --verbose: Enable verbose logging

Dependencies

  • beautifulsoup4
  • requests
  • urllib3
  • markdown
  • readability-lxml
  • html2text

License

MIT License

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

web_to_markdown-0.1.0.tar.gz (6.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

web_to_markdown-0.1.0-py3-none-any.whl (6.9 kB view details)

Uploaded Python 3

File details

Details for the file web_to_markdown-0.1.0.tar.gz.

File metadata

  • Download URL: web_to_markdown-0.1.0.tar.gz
  • Upload date:
  • Size: 6.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for web_to_markdown-0.1.0.tar.gz
Algorithm Hash digest
SHA256 b4a8a8e195f32a919d799d67265953c60af26def8405480cf95b217cd1d51bcf
MD5 4da49ae30dc971fa4e64096fd7c5a4a1
BLAKE2b-256 de2768a1d4f84a611d45de11161ded883ccbfd0ebe211cfb525d384c27b1c17e

See more details on using hashes here.

File details

Details for the file web_to_markdown-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for web_to_markdown-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 894f35eda41cda35a31d7f0ede9669f9973dafde4f7cd6bc4dddba9fac52bd75
MD5 d72ac4eef89c0d47afbfaf35caf8b837
BLAKE2b-256 60e7cbc0672d5ffdfc04fb4f46b326d2fafede58b8babeec6e7c4f029957b8d9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page