Convert documents to Markdown using Cloudflare Workers AI toMarkdown.
Project description
anything2md
Python package and CLI for converting URLs or local documents into Markdown using Cloudflare Workers AI toMarkdown().
Install
From GitHub:
pip install "git+https://github.com/herrkaefer/anything2md.git"
Cloudflare Token Setup
Create a Cloudflare API Token for the target account and include these permissions:
Workers AIBrowser Rendering - Edit
Library Usage
import anything2md
mdconverter = anything2md(account_id="xxx", api_token="xxx")
result = mdconverter.convert("https://example.com")
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
Runtime check via API:
uv run python -c "from anything2md import MarkdownConverter; c=MarkdownConverter(account_id='<id>', api_token='<token>'); print([f.extension for f in c.supported_formats()])"
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
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
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file anything2md-0.1.0.tar.gz.
File metadata
- Download URL: anything2md-0.1.0.tar.gz
- Upload date:
- Size: 22.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1cd6f2467ac8e21691fedd749c29a7a79f1901d874cab3f7e336a2c52107100a
|
|
| MD5 |
906a97ada1752feedfabdeec5be910ce
|
|
| BLAKE2b-256 |
7a221f8d7410d88f5590e8ee40674783f2e41284d022fb5378d8b567407d1a6e
|
Provenance
The following attestation bundles were made for anything2md-0.1.0.tar.gz:
Publisher:
publish.yml on herrkaefer/anything2md
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
anything2md-0.1.0.tar.gz -
Subject digest:
1cd6f2467ac8e21691fedd749c29a7a79f1901d874cab3f7e336a2c52107100a - Sigstore transparency entry: 1004003360
- Sigstore integration time:
-
Permalink:
herrkaefer/anything2md@02a23eda9af6b617aa9d0c653a175f37170126dd -
Branch / Tag:
refs/heads/master - Owner: https://github.com/herrkaefer
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@02a23eda9af6b617aa9d0c653a175f37170126dd -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file anything2md-0.1.0-py3-none-any.whl.
File metadata
- Download URL: anything2md-0.1.0-py3-none-any.whl
- Upload date:
- Size: 12.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a10e525fbf1222cceecdcbc0804c52635ccf175e2676a04698babdb02e07b6c9
|
|
| MD5 |
0d21601441ada0d0f6f303eb872ab16c
|
|
| BLAKE2b-256 |
50ba613d7de089b24159a1f17c44ee6d12670c977f7c96e0e061c531eeed2e9d
|
Provenance
The following attestation bundles were made for anything2md-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on herrkaefer/anything2md
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
anything2md-0.1.0-py3-none-any.whl -
Subject digest:
a10e525fbf1222cceecdcbc0804c52635ccf175e2676a04698babdb02e07b6c9 - Sigstore transparency entry: 1004003383
- Sigstore integration time:
-
Permalink:
herrkaefer/anything2md@02a23eda9af6b617aa9d0c653a175f37170126dd -
Branch / Tag:
refs/heads/master - Owner: https://github.com/herrkaefer
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@02a23eda9af6b617aa9d0c653a175f37170126dd -
Trigger Event:
workflow_dispatch
-
Statement type: