Convert a web page to Markdown
flatmark does not fetch URLs. Download the page yourself, then send the HTML to /v1/convert.
Last updated
flatmark converts HTML that you send and does not fetch URLs. Download the page with your own client, then send the HTML to POST /v1/convert.
curl
curl -sL https://example.com/ -o article.html
curl -F "file=@article.html;type=text/html" https://api.flatmark.dev/v1/convert
Or in one pipe, with the HTML read from stdin:
curl -sL https://example.com/ | \
curl -F "file=@-;type=text/html;filename=article.html" https://api.flatmark.dev/v1/convert
Python
import httpx
html = httpx.get("https://example.com/", follow_redirects=True).text
resp = httpx.post(
"https://api.flatmark.dev/v1/convert",
files={"file": ("article.html", html.encode(), "text/html")},
timeout=60,
)
resp.raise_for_status()
print(resp.json()["markdown"])
Before you send
- Navigation, headers and footers stay in the output. Send only the main element if you want the article alone.
- A page that builds its content with JavaScript has little HTML to convert. Render it in a headless browser first and send the result.
Next step
Paste a page's HTML into the free tool and check the output before you automate it.
FAQ
- Can flatmark fetch a URL for me?
- No. flatmark converts files and HTML that you send. Fetch the page with your own client, headers and cookies, then send the HTML.
- What about pages that load their content with JavaScript?
- flatmark converts only the HTML you send and runs no JavaScript. Render the page in a headless browser first, then send the result.