Command-line tools that turn a URL into Markdown
pandoc does it in one line: pandoc -f html -t gfm "https://example.com/post" -o post.md, though it converts the whole page, menus included. For the main text only, use a reader service from curl. Our page reader works from a shell too, but paying its $0.02 needs an x402 client, so wrap it in a short script; the free tries on the listing page need no setup at all.
Try it free Read Any Web Page, PDF or Doc — clean Markdown for AI agents · $0.02 / call
One-liners
# whole page, pandoc fetches the URL itself
pandoc -f html -t gfm --wrap=none "https://example.com/post" -o post.md
# whole page, html2text reads from a pipe (pip install html2text)
curl -sL "https://example.com/post" | html2text --body-width=0 > post.md
# main text only, Jina Reader
curl -s "https://r.jina.ai/https://example.com/post" > post.md
Flags that save clean-up
- pandoc --wrap=none stops pandoc from breaking lines at 72 characters, which makes diffs and LLM input cleaner.
- pandoc -t gfm writes GitHub-flavoured Markdown, so tables come out as pipe tables instead of grid tables.
- html2text --body-width=0 turns off line wrapping; --ignore-images drops image links.
- curl -L follows redirects. Without it you may save a "moved permanently" page.
The page reader from a shell
A plain curl call shows you the price, not the page: the first answer is HTTP 402 with a JSON body listing the amount in USDC units, the network (Base) and the address to pay. curl can't sign that payment.
curl -si -X POST https://iamai.markets/api/x402/services/XyehnOmhOzAF \
-H "Content-Type: application/json" \
-d '{"url": "https://example.com/post"}' | head -20
A 10-line wrapper
There is no official iamai command-line tool. A short Node script does the job: payFetch is the paying fetch from any x402 v2 client.
// md.mjs, usage: node md.mjs https://example.com/post > post.md
const r = await payFetch("https://iamai.markets/api/x402/services/XyehnOmhOzAF", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ url: process.argv[2] }),
});
if (!r.ok) { console.error(r.status, await r.text()); process.exit(1); }
const { result } = await r.json();
process.stdout.write(result.markdown + "\n");
# then in your shell profile:
alias md="node ~/bin/md.mjs"
Which one to install
| Tool | Removes menus | Needs |
|---|---|---|
| pandoc | No | pandoc installed (brew, apt or the installer) |
| html2text | No | Python and pip |
| Jina Reader via curl | Yes | Only curl |
| Page reader via a script (iamai.markets) | Yes | Node, an x402 client and USDC on Base |
The product
Questions
Does pandoc run the page's JavaScript?
No. It converts the HTML the server sends. A JavaScript app gives pandoc an almost empty page.
How do I convert a list of URLs?
Loop over a text file in the shell: while read u; do node md.mjs "$u" > "$(echo "$u" | tr -c "a-zA-Z0-9" "_").md"; done < urls.txt
Can an AI agent use it without a script?
An agent still needs an x402 client to pay, but it doesn't need your wrapper: our MCP server's get_marketplace_info tool gives it the reader's address, price and request format. See /agents.
Related
Updated 2026-12-01
