API & MCP

Everything a person can do on Safe Markdown Preview, a program or AI agent can do with the same inputs and get the identical result.

HTTP API

Safe Markdown Preview

Renders Markdown with headings, emphasis, lists, task lists, code, GFM tables, links, images, blockquotes and footnotes into HTML built from a strict allow-list. Raw HTML can be escaped, stripped or sanitised; scripts, event handlers, style attributes and javascript:/vbscript:/data: URLs are removed and listed in a security report. Shows a preview, the sanitised HTML source and a plain-text version.

Inputs of Safe Markdown Preview
FieldTypeDefaultDescription
markdowntextarea—Markdown
filefile—Or upload a Markdown file
rawHtmlselect (sanitize, escape, strip)"sanitize"Raw HTML in the Markdown
gfmbooleantrueGitHub extensions (tables, task lists, strikethrough, bare URLs)
footnotesbooleantrueFootnotes ([^1])
allowDataImagesbooleanfalseAllow base64 data: images (PNG/JPEG/GIF/WebP/AVIF; never SVG)

Example request

Release notes with table, tasks and footnote

curl -X POST https://safemarkdownpreview.usefulweb.site/api/v1/calculate -H 'content-type: application/json' -d '{"markdown":"# Release notes\n\nVersion **2.4** brings _faster_ parsing, `inline code` and ~~old bugs~~ fixes.[^perf]\n\n- [x] Tables (GFM)\n- [ ] Footnotes\n- Links: [docs](https://example.com/docs \"Documentation\") and <https://usefulweb.site>\n\n| Feature | Status | Notes |\n|:--------|:------:|------:|\n| Tables  | ✓      | GFM   |\n| Images  | ✓      | allow-listed |\n\n> Quote with a [reference link][ref].\n\n```js\nconsole.log(\"code is escaped: <b>\");\n```\n\n[ref]: https://commonmark.org/\n[^perf]: Measured on a 1 MB document.\n"}'

Every result contains

inputs (normalised, defaults applied), summary, result (validated against the published schema), units, assumptions, sources, warnings, computedAt and links.

MCP (Model Context Protocol)

{
  "mcpServers": {
    "safe-markdown-preview": { "type": "http", "url": "https://safemarkdownpreview.usefulweb.site/mcp" }
  }
}