Migrating a CMS export into a static site
WordPress and Contentful export HTML; Astro, Hugo and Next.js content pipelines want Markdown. Converting in bulk gets you 90% there, with tables and embeds needing manual review.
Converts simple HTML into clean Markdown.
Converts simple HTML into clean Markdown.
<h1>Title</h1><p>Hello <strong>world</strong></p>
# Title Hello **world**
Headings, bold, links and lists map to Markdown syntax.
The output is a best-effort Markdown representation of the semantic content.
Your input is sent to YAS infrastructure because the tool requires server-side processing or public network queries. Input is not stored.
curl -X POST "https://yas.sh/api/v1/tools/html-to-markdown" \
-H "Content-Type: application/json" \
-d '{"input":"<h1>Title</h1><p>Hello</p>"}'const res = await fetch("https://yas.sh/api/v1/tools/html-to-markdown", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
"input": "<h1>Title</h1><p>Hello</p>"
}),
});
const data = await res.json();import requests
r = requests.post("https://yas.sh/api/v1/tools/html-to-markdown", json={"input":"<h1>Title</h1><p>Hello</p>"})
data = r.json()| Field | Type | Required | Description |
|---|---|---|---|
| input | string | Yes | HTML text |
{ "result": "# Title\n\nHello\n\n" }Convert simple HTML into Markdown.
400 VALIDATION_ERROR — invalid input or unsupported option.413 PAYLOAD_TOO_LARGE — input exceeds the 64 KB limit.429 RATE_LIMIT_EXCEEDED — rate limit exceeded (60 req/min).The HTML is parsed into a DOM and walked depth-first, mapping each element to its Markdown equivalent: h1–h6 to ATX headings, strong/b to double asterisks, ul/ol to list markers, pre/code to fenced blocks, a to inline links. Elements with no Markdown equivalent are either unwrapped (their children are kept) or dropped, depending on whether they carry content or only presentation.
The lossy direction is deliberate. HTML expresses arbitrary structure and styling; Markdown expresses a small fixed vocabulary. A div with a class, a span with a colour, a table with merged cells and a figure with a caption have no Markdown representation, so the converter preserves the text and discards the presentation rather than emitting raw HTML that would defeat the purpose of converting.
WordPress and Contentful export HTML; Astro, Hugo and Next.js content pipelines want Markdown. Converting in bulk gets you 90% there, with tables and embeds needing manual review.
Copying rendered HTML into a Markdown field produces escaped tag soup. Converting first yields clean, editable source.
Markdown keeps the heading hierarchy and link targets that plain-text extraction throws away, which matters when the structure is the information.
Storing Markdown instead of editor-specific HTML makes content portable when you replace the editor — and you will replace the editor.
What this tool deliberately does not do, and where it will disagree with other implementations.