Markdown to HTML
Convert Markdown text to HTML in a single API call. Optionally sanitize the output to strip unsafe tags and prevent XSS.
Overview
Use Cases
- Rendering user-generated Markdown content safely in web apps
- Converting README files or documentation to HTML
- Building rich-text editors with Markdown input and HTML preview
- Preprocessing Markdown before storing rendered HTML
Features
Full CommonMark Markdown support
Optional HTML sanitization to strip unsafe tags and attributes
Returns ready-to-render HTML string
API Endpoints
Convert Markdown to HTML
Converts a Markdown string to HTML. Pass sanitize true to strip potentially unsafe tags like script and iframe from the output.
POST
https://api.requiems.xyz/v1/convert/markdown
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| markdown | string |
Required | The Markdown text to convert. |
| sanitize | boolean |
Optional | When true, sanitizes the HTML output to remove unsafe tags and attributes. |
Try it out
Live DemoRequest
The Markdown text to convert.
When true, sanitizes the HTML output to remove unsafe tags and attributes.
Sending request...
Response Fields
| Field | Type | Description |
|---|---|---|
| html | string |
The rendered HTML output |
Code Examples
curl -X POST https://api.requiems.xyz/v1/convert/markdown \
-H "requiems-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"markdown": "# Hello\n\nThis is **bold** text.", "sanitize": true}'
import requests
url = "https://api.requiems.xyz/v1/convert/markdown"
headers = {
"requiems-api-key": "YOUR_API_KEY",
"Content-Type": "application/json"
}
payload = {
"markdown": "# Hello\n\nThis is **bold** text.",
"sanitize": True
}
response = requests.post(url, json=payload, headers=headers)
print(response.json()['data']['html'])
const response = await fetch(
'https://api.requiems.xyz/v1/convert/markdown',
{
method: 'POST',
headers: {
'requiems-api-key': 'YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
markdown: '# Hello\n\nThis is **bold** text.',
sanitize: true
})
}
);
const { data } = await response.json();
console.log(data.html);
require 'net/http'
require 'json'
uri = URI('https://api.requiems.xyz/v1/convert/markdown')
request = Net::HTTP::Post.new(uri)
request['requiems-api-key'] = 'YOUR_API_KEY'
request['Content-Type'] = 'application/json'
request.body = {
markdown: "# Hello\n\nThis is **bold** text.",
sanitize: true
}.to_json
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
http.request(request)
end
puts JSON.parse(response.body)['data']['html']
Error Responses
422
unprocessable_entity
Frequently Asked Questions
The converter follows CommonMark β the standardized Markdown specification used by GitHub, GitLab, and most modern platforms.
Enable sanitize whenever the Markdown input comes from untrusted sources (user input, third-party content). It strips tags like script, iframe, and on* event attributes to prevent XSS attacks.
No. Standard Markdown output (headings, paragraphs, bold, links, code blocks, etc.) is not affected by sanitization. Only raw HTML embedded in the Markdown is filtered.