Markdown to HTML
Convert Markdown text to HTML in a single API call. Optionally sanitize the output to strip unsafe tags and prevent XSS.
Vue d'ensemble
Cas d'utilisation
- 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
Fonctionnalités
Points de terminaison de l'API
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.
https://requiems.xyz/v1/technology/markdown
Paramètres
| Nom | Type | Requis | Description |
|---|---|---|---|
| markdown | string |
Requis | The Markdown text to convert. |
| sanitize | boolean |
Facultatif | When true, sanitizes the HTML output to remove unsafe tags and attributes. |
Essayez-le
Démo en directRequête
The Markdown text to convert.
When true, sanitizes the HTML output to remove unsafe tags and attributes.
Champs de réponse
| Champ | Type | Description |
|---|---|---|
| html | string |
The rendered HTML output |
Exemples de code
curl -X POST https://requiems.xyz/v1/technology/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://requiems.xyz/v1/technology/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://requiems.xyz/v1/technology/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://requiems.xyz/v1/technology/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']
Réponses d'erreur
unprocessable_entity
Convert Markdown Batch
Converts multiple Markdown strings into HTML in a single request. Results are returned in the same order as the input array. Supports optional sanitization to remove unsafe HTML tags such as script and iframe.
https://requiems.xyz/v1/technology/markdown/batch
Paramètres
| Nom | Type | Requis | Description |
|---|---|---|---|
| markdowns | array<string> |
Requis | Array of Markdown strings. Min: 1, Max: 50. |
| sanitize | boolean |
Facultatif | When true, sanitizes HTML output to remove unsafe tags and attributes. |
Essayez-le
Démo en directRequête
Array of Markdown strings. Min: 1, Max: 50.
When true, sanitizes HTML output to remove unsafe tags and attributes.
Champs de réponse
| Champ | Type | Description |
|---|---|---|
| results | array<object> |
One HTML result per Markdown input, preserving input order |
| results[].html | string |
Rendered HTML output for each Markdown string |
Exemples de code
curl -X POST https://requiems.xyz/v1/technology/markdown/batch \
-H "requiems-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"markdowns": ["# Hello", "**bold**", "- item"],
"sanitize": true
}'
import requests
url = "https://requiems.xyz/v1/technology/markdown/batch"
headers = {
"requiems-api-key": "YOUR_API_KEY",
"Content-Type": "application/json"
}
payload = {
"markdowns": ["# Hello", "**bold**", "- item"],
"sanitize": True
}
response = requests.post(url, json=payload, headers=headers)
results = response.json()["data"]["results"]
for r in results:
print(r["html"])
const response = await fetch(
"https://requiems.xyz/v1/technology/markdown/batch",
{
method: "POST",
headers: {
"requiems-api-key": "YOUR_API_KEY",
"Content-Type": "application/json"
},
body: JSON.stringify({
markdowns: ["# Hello", "**bold**", "- item"],
sanitize: true
})
}
);
const { data } = await response.json();
console.log(data.results);
require 'net/http'
require 'json'
uri = URI('https://requiems.xyz/v1/technology/markdown/batch')
request = Net::HTTP::Post.new(uri)
request['requiems-api-key'] = 'YOUR_API_KEY'
request['Content-Type'] = 'application/json'
request.body = {
markdowns: ["# Hello", "**bold**", "- item"],
sanitize: true
}.to_json
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
http.request(request)
end
results = JSON.parse(response.body)['data']['results']
puts results
Réponses d'erreur
Body is invalid: empty array, more than 50 items, or invalid Markdown entry.
Missing or malformed request body.
Unexpected server error.