{"uid":"cap_LAXYEsLRe7yII68b7fFBM","slug":"402utils-markdown-to-safe-html-converter-492d3698","name":"402utils Markdown to Safe HTML Converter","description":"Convert Markdown to sanitized HTML that is safe to embed directly in a page, email or app. GFM supported: tables, task lists, strikethrough, fenced code. Output passes a strict tag/attribute allowlist: scripts, styles, iframes, event handlers and javascript: URLs are removed; links keep only http(s)/mailto targets, images only http(s) or base64 image data URIs. Send JSON {markdown} or a raw text/markdown body, max 2 MB. Returns {html}.","url":"https://402utils.com/v1/md-to-html?utm_source=zero.xyz","method":"POST","headers":{},"bodySchema":{"type":"object","properties":{"markdown":{"type":"string","description":"Markdown source (GitHub Flavored Markdown). Max 2 MB UTF-8."}}},"responseSchema":{"type":"json","example":{"html":"<h1>Release notes</h1>\n<ul>\n<li><input checked=\"\" disabled=\"\" type=\"checkbox\"> Ship the <em>v2</em> API</li>\n<li><input disabled=\"\" type=\"checkbox\"> Update docs</li>\n</ul>\n<table>\n<thead>\n<tr>\n<th align=\"left\">Feature</th>\n<th align=\"right\">Status</th>\n</tr>\n</thead>\n<tbody><tr>\n<td align=\"left\">Auth</td>\n<td align=\"right\">done</td>\n</tr>\n</tbody></table>\n<p><del>Old plan</del> — see <a href=\"https://example.com/docs\">the docs</a>.</p>\n"}},"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.002","displayCostAsset":"USDC","priceDynamic":false,"priceHint":null,"priceStatus":"priced","priceSource":"probe","requiresHandshake":false,"reviewCount":0,"rating":{"score":"0.00","successRate":"0.00","reviews":0,"stars":null,"state":"unrated"},"availabilityStatus":"unknown","priceObserved":{"p10Cents":"0.2000","medianCents":"0.2000","p90Cents":"0.2000","minCents":"0.2000","maxCents":"0.2000","p95Cents":"0.2000","sampleCount":1,"varies":false,"failureChargeRate":1},"sessionDeposit":null,"pricing":{"kind":"static","summary":"$0.002/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.002","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.002","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_9bFl_akdVX_UhmJ0Cb7Xb","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.002","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Converts GitHub Flavored Markdown to sanitized, XSS-safe HTML with a strict tag/attribute allowlist, removing scripts, styles, iframes, and dangerous URLs.","exampleAgentPrompt":"Convert this markdown to safe HTML I can embed directly in an email — it includes a table, some task list items, and fenced code blocks: '## Summary\\n| Col1 | Col2 |\\n|------|------|\\n| A | B |\\n\\n- [x] Done\\n\\n```js\\nconsole.log(\"hi\");\\n```'","exampleUseCases":[{"title":"Render user-submitted markdown safely","prompt":"A user just submitted a markdown comment on our platform with some tables and code snippets. Can you convert it to HTML I can safely inject into the page without worrying about XSS attacks? Here's their input: '## Feedback\n\nGreat product! Here's a comparison:\n\n| Feature | Rating |\n|---------|--------|\n| Speed | ⭐⭐⭐⭐⭐ |\n| UI | ⭐⭐⭐⭐ |\n\n```python\nprint(\"works great\")\n```'"},{"title":"Sanitize markdown for email newsletters","prompt":"I'm building an email newsletter where editors write content in GitHub Flavored Markdown, including task lists and strikethrough text. Before I inject their draft into the HTML email template, convert this to sanitized HTML with all dangerous tags stripped out: '## This Week\n\n~~Old pricing~~ New pricing is live!\n\n- [x] Feature shipped\n- [ ] Docs updated\n\n> Check the release notes for details.'"},{"title":"Embed documentation markdown in web app","prompt":"We pull README files straight from GitHub repos and display them inside our app's UI. I need to convert this GFM markdown to HTML that passes our security review — no scripts, no iframes, nothing unsafe. Can you run it through the sanitizer? '# Getting Started\n\nInstall with:\n\n```bash\nnpm install mylib\n```\n\n| Step | Action |\n|------|--------|\n| 1 | Clone repo |\n| 2 | Run install |'"}],"resultDescription":"Returns a JSON object {html} containing the sanitized HTML string derived from the input markdown, with scripts, styles, iframes, event handlers, and javascript: URLs removed, and links/images restricted to safe URL schemes.","failureModes":["Input exceeds 2 MB limit — request rejected","Malformed JSON body without 'markdown' key — parsing error","Invalid Content-Type not matching JSON or text/markdown — may cause parse failure","Payment not included or insufficient USDC — 402 payment required response","Network timeout for very large markdown inputs near the size limit"],"whenToPreferThis":"Use this endpoint when you need to safely render user-generated or untrusted markdown into HTML for embedding in web pages, emails, or apps, and XSS safety is a requirement. Ideal when GitHub Flavored Markdown features like tables, task lists, strikethrough, and fenced code blocks need to be supported. Prefer over generic markdown libraries when you need a server-side, hosted, pay-per-call solution with a strict security allowlist already built in.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-10-11T00:42:15.595Z","isFirstParty":false,"canonicalSlug":"402utils-markdown-to-safe-html-converter-492d3698"}