DeMark provides a native Cloudflare Pages Function at /api/demark powered by Cloudflare Workers V8 runtime and standard Web Request / Response APIs.
cURL Example:
curl -X POST https://demark-3pj.pages.dev/api/demark \
-H "Content-Type: application/json" \
-d '{
"markdown": "# 标题\n好的,以下是为您整理的内容:**高可用**。\n希望对您有所帮助!",
"options": {
"outputMode": "plain",
"stripHeadings": true,
"stripEmphasis": true,
"cleanAIFluff": true
}
}'
JavaScript / Fetch Example:
const response = await fetch('/api/demark', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
markdown: rawAIText,
options: { outputMode: 'plain', cleanAIFluff: true }
})
});
const { success, result, stats } = await response.json();
console.log(result);
Response Schema:
{
"success": true,
"result": "标题\n高可用。",
"stats": {
"inputLength": 38,
"outputLength": 8,
"charReductionPercent": 78.9,
"strippedCounts": { "headings": 1, "emphasis": 1, "fluff": 2 }
}
}