/api/v1/convert/html-to-markdownHTML → Markdown API
Convert any HTML snippet into clean CommonMark + GFM.
POST /api/v1/convert/html-to-markdown turns HTML — from CMS exports, WYSIWYG editors, scraped pages, or LLM outputs — into clean, deterministic CommonMark + GFM. Pure server-side, no jsdom required.
Overview
Server-side HTML to Markdown converter — no jsdom, no headless browser. Handles headings, paragraphs, lists, tables, blockquotes, links, images, fenced code blocks, and basic inline formatting. Strips `<script>`, `<style>`, and `<noscript>` automatically.
Request
Authenticate with Authorization: Bearer YOUR_API_KEY and send a JSON body containing the parameters below. Pick your language:
curl -X POST 'https://trymarkdownviewer.com/api/v1/convert/html-to-markdown' \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"html":"<h1>Hello</h1><p>Welcome to <strong>Markdown Viewer</strong>.</p>"}'Body parameters
| Field | Type | Required | Description |
|---|---|---|---|
| html | string | required | HTML source. Max 512 KiB. |
Response
Success responses are wrapped in a data field. Errors use { error: { code, message } } with an appropriate HTTP status — see the error reference.
{
"data": {
"markdown": "# Hello\n\nWelcome to **Markdown Viewer**.\n",
"characters": 47
}
}Use cases
CMS / WYSIWYG migrations
Convert WordPress, Contentful, or Notion HTML exports to portable markdown.
Smart paste in editors
Strip rich text from the clipboard and store markdown instead.
Scraping pipelines
Normalise scraped pages to markdown for downstream LLM workflows.
Production tips
- Run output through /api/v1/format to normalise bullet style and whitespace.
- Strips dangerous tags (<script>, <style>) automatically — no extra sanitisation step needed.
HTML → Markdown FAQ
- Yes. Tables, task lists, strikethrough, and fenced code with language hints round-trip cleanly.
- Unknown tags are rendered inline as their text content. Use the browser-side turndown wrapper if you need exotic tag preservation.
Does the converter handle GitHub Flavored Markdown features?
Will custom HTML tags survive?
Related endpoints
Try in browser
Free tools that run the same logic locally — no API key, no upload.
Try it
Send a real request against your account in the API playground. Errors there link straight back to the error reference.