Markdown to HTML API

Render GitHub-flavored Markdown to HTML with tables and strikethrough. Output is sanitized by default to strip scripts and event handlers.

GETPOSThttps://apibox.io.vn/v1/markdown-to-html
Content & HTML▶ Try it online

Send Markdown in the markdown field (JSON, form or query string) or as a raw text body and receive the rendered HTML in html. Rendering uses the marked parser with GitHub-flavored Markdown enabled: tables, strikethrough, autolinks and fenced code blocks are supported. Set breaks=true to turn single line breaks into <br>.

Because Markdown can contain raw HTML, the output is sanitized by default: script, style, iframe, object, embed, form and similar elements are removed, as well as on* event handlers, style attributes and javascript: / vbscript: / data:text URLs. Pass sanitize=false only when the Markdown comes from a trusted source.

The request body is limited to 1 MB and the markdown field to 2,000,000 characters.

Parameters

NameInTypeRequiredDefault
markdownbody|querystringyesMarkdown source (max 2,000,000 characters). Can also be sent as a raw text body.
breaksbody|querybooleannofalseConvert single line breaks to <br>.
sanitizebody|querybooleannotrueRemove scripts, event handlers, style attributes and dangerous URLs from the output.

Example

curl -X POST "https://apibox.io.vn/v1/markdown-to-html" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"markdown":"# Release notes\n\nVersion **2.0** adds [dark mode](https://example.com/dark).\n\n- Faster builds\n- ~~Old API~~ removed\n\n| Plan | Price |\n| --- | --- |\n| Free | $0 |"}'

Response

{
  "html": "<h1>Release notes</h1>\n<p>Version <strong>2.0</strong> adds <a href=\"https://example.com/dark\">dark mode</a>.</p>\n<ul>\n<li>Faster builds</li>\n<li><del>Old API</del> removed</li>\n</ul>\n<table>\n<thead>\n<tr>\n<th>Plan</th>\n<th>Price</th>\n</tr>\n</thead>\n<tbody><tr>\n<td>Free</td>\n<td>$0</td>\n</tr>\n</tbody></table>\n"
}

Use cases

  • Render README or documentation files on your own website
  • Display user comments written in Markdown without XSS risk
  • Generate HTML email bodies or newsletters from Markdown drafts
  • Preview Markdown in a CMS or static site generator pipeline

FAQ

Is the generated HTML safe to insert into a page?

By default yes for common attacks: scripts, iframes, forms, event handlers, style attributes and javascript: links are removed. Disable with sanitize=false only for trusted input.

Does it support GitHub-flavored Markdown tables?

Yes. GFM is enabled, so pipe tables, ~~strikethrough~~ and autolinks are rendered.

How do I keep single line breaks?

Set breaks=true. Each newline inside a paragraph then becomes a <br> tag, like on GitHub comments.

Related APIs

Start with 1,000 free requests every month. Get free API key →