anything2md
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-- ReadBrowser 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")
# Browser Rendering advanced options for webpage URLs
result = mdconverter.transform(
"https://example.com",
url_strategy="browser",
wait_until="networkidle2",
reject_request_pattern=["/^.*\\.(css)$/", "/analytics/"],
)
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
uv run anything2md https://example.com --url-strategy browser --wait-until networkidle2 --reject-request-pattern '/^.*\.(css)$/' --reject-request-pattern '/analytics/'
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.erroris emptyresult.markdownis non-empty
Optional test URL overrides:
ANYTHING2MD_TEST_PDF_URLANYTHING2MD_TEST_IMAGE_URLANYTHING2MD_TEST_WEB_URL
References
Cloudflare docs:
- Markdown Conversion overview: https://developers.cloudflare.com/workers-ai/features/markdown-conversion/
- API reference (
toMarkdown): https://developers.cloudflare.com/api/resources/ai/methods/run/#to-markdown-conversion-to-markdown - API reference (
supported formats): https://developers.cloudflare.com/api/resources/ai/methods/run/#to-markdown-conversion-supported-formats - Browser Rendering Markdown endpoint (URL input): https://developers.cloudflare.com/browser-rendering/rest-api/markdown-endpoint/
- Markdown for Agents (
Accept: text/markdown): https://developers.cloudflare.com/fundamentals/reference/markdown-for-agents/
License
MIT
Metadata
Release files for anything2md 0.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| anything2md-0.1.3.tar.gz | 24.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| anything2md-0.1.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 37.5 kB
Release files / anything2md-0.1.3.tar.gz
| Download URL | anything2md-0.1.3.tar.gz |
|---|---|
| Size | 24.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9df030cf300167e14fdada354be32be819bac05e343813644ad9f2a47691eebd
|
|
BLAKE2b-256 checksum How to use checksums |
f87a005db29885eede9c3fb80fff15f7400876f7dbda5c803ac128f7778f3634
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Feb 27, 2026.
Transparency logRelease files / anything2md-0.1.3-py3-none-any.whl
| Download URL | anything2md-0.1.3-py3-none-any.whl |
|---|---|
| Size | 13.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
06dc1f6f4d5d29d6d101da9553e7e909cd273719163dbb5827611b794203f53b
|
|
BLAKE2b-256 checksum How to use checksums |
4313ef99965ee71e674a98462929b72d2c817ea086a5b420264d544197753bce
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Feb 27, 2026.
Transparency log