Skip to main content

Convert documents to Markdown using Cloudflare Workers AI toMarkdown.

Project description

anything2md

CI PyPI version Python License: MIT

Python package and CLI for converting URLs or local documents into Markdown using Cloudflare Workers AI toMarkdown().

Install

From PyPI with uv:

uv add anything2md

Or from PyPI (pip):

pip install anything2md

Cloudflare Token Setup

Create a Cloudflare API Token for the target account and include these permissions:

  • Workers AI -- Read
  • Browser Rendering -- Edit

Usage

import anything2md

mdconverter = anything2md(account_id="xxx", api_token="xxx")
result = mdconverter.transform("https://example.com")
result = mdconverter.transform("https://pub-979cb28270cc461d94bc8a169d8f389d.r2.dev/somatosensory.pdf")
result = mdconverter.transform("https://pub-979cb28270cc461d94bc8a169d8f389d.r2.dev/cat.jpeg")
print(result.markdown)

Supported Formats

Based on Cloudflare docs, current supported extensions include:

pdf, jpeg/jpg, png, webp, svg, html/htm, xml, csv, docx, xlsx, xlsm, xlsb, xls, et, ods, odt, numbers

url via Browser Rendering Markdown endpoint.

Local Usage

Install dependencies:

uv sync
export CLOUDFLARE_ACCOUNT_ID="your_account_id"
export CLOUDFLARE_API_TOKEN="your_api_token"

uv run anything2md https://pub-979cb28270cc461d94bc8a169d8f389d.r2.dev/somatosensory.pdf
uv run anything2md https://pub-979cb28270cc461d94bc8a169d8f389d.r2.dev/cat.jpeg -o output.md
uv run anything2md https://example.com

Integration Test (Real Cloudflare)

If both CLOUDFLARE_ACCOUNT_ID and CLOUDFLARE_API_TOKEN are set, integration tests automatically run real Cloudflare calls and validate that:

  • result.error is empty
  • result.markdown is non-empty

Optional test URL overrides:

  • ANYTHING2MD_TEST_PDF_URL
  • ANYTHING2MD_TEST_IMAGE_URL
  • ANYTHING2MD_TEST_WEB_URL

References

Cloudflare docs:

License

MIT

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

anything2md-0.1.1.tar.gz (22.7 kB view details)

Uploaded Source

Built Distribution

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

anything2md-0.1.1-py3-none-any.whl (12.5 kB view details)

Uploaded Python 3

File details

Details for the file anything2md-0.1.1.tar.gz.

File metadata

  • Download URL: anything2md-0.1.1.tar.gz
  • Upload date:
  • Size: 22.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for anything2md-0.1.1.tar.gz
Algorithm Hash digest
SHA256 0a5d426c0bcfd381a292f678b7b7d5a9c6eb478a2eb248c8b237d65657592924
MD5 1032d394d634ab423105915986b6ed7e
BLAKE2b-256 d9e0936d4e84e64f5f0c900be8660dcaf29449cb77d35d9aed76ade16378d1cd

See more details on using hashes here.

Provenance

The following attestation bundles were made for anything2md-0.1.1.tar.gz:

Publisher: publish.yml on herrkaefer/anything2md

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file anything2md-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: anything2md-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 12.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for anything2md-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 9ca7d58696b54a8cb4859695c034d8c1447d29e696f20372d757097dae1ee497
MD5 0d7d74320fdc862f7fe6ab5e02799ac4
BLAKE2b-256 a5e41d7709c8328a1a1b912baa2bec31d55b9a6292539b4decb26e07c0aa3e59

See more details on using hashes here.

Provenance

The following attestation bundles were made for anything2md-0.1.1-py3-none-any.whl:

Publisher: publish.yml on herrkaefer/anything2md

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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