Publish to md.page
Publish any markdown as a beautiful, shareable web page with one API call. No accounts, no API keys, no setup.
API
POST INLINECODE0
CODEBLOCK0
Response 201 Created:
{
"url": "https://md.page/a8Xk2m",
"expires_at": "2026-03-29T12:00:00.000Z"
}
| Error | Cause |
|---|
| INLINECODE2 | Missing or invalid markdown field, or invalid JSON body |
| INLINECODE4 |
Content exceeds 500KB |
Workflow
- 1. Prepare the markdown content:
- If the user wants to publish an
existing file, use the Read tool to read it first, then publish its contents.
Before publishing, scan the content for secrets (API keys, tokens, passwords, credentials, private keys,
.env values). If any are found, warn the user and do NOT publish until they confirm.
- If generating new markdown, start with a
# Title for proper page titles and link previews. Never include secrets or credentials in generated content.
- 2. Use the Bash tool with
curl to POST the markdown. - To safely handle special characters (quotes, apostrophes, newlines), use Python to JSON-encode the payload, then pipe it to curl:
CODEBLOCK2
- 4. Parse the JSON response and return the
url to the user. Mention the page expires in 24 hours. - If the request fails, check the error status code against the table above and inform the user.
Formatting tips
- - A first-line
# Heading becomes the page title in browser tabs and social previews. - Code blocks, tables, blockquotes, lists, images, and links all render with clean styling.
- Dark mode is automatic.
- Max content size: 500KB.
- URLs are private, unguessable 6-character IDs.
发布到 md.page
通过一次API调用,将任意Markdown内容发布为美观、可分享的网页。无需注册账号、无需API密钥、无需任何配置。
API
POST https://md.page/api/publish
bash
curl -X POST https://md.page/api/publish \
-H Content-Type: application/json \
-d {markdown: # 你好\n\n你的内容在这里}
响应 201 Created:
json
{
url: https://md.page/a8Xk2m,
expires_at: 2026-03-29T12:00:00.000Z
}
| 错误码 | 原因 |
|---|
| 400 | 缺少或无效的 markdown 字段,或无效的JSON主体 |
| 413 |
内容超过500KB |
工作流程
- 1. 准备Markdown内容:
- 如果用户想要发布
现有文件,先使用读取工具读取文件内容,然后发布其内容。
发布前,扫描内容中的机密信息(API密钥、令牌、密码、凭证、私钥、.env值)。如果发现任何机密信息,警告用户,并在用户确认前不要发布。
- 如果生成新的Markdown,以 # 标题 开头,以确保页面标题和链接预览正常。生成的内容中绝不包含机密信息或凭证。
- 2. 使用带 curl 的Bash工具发送POST请求。
- 为安全处理特殊字符(引号、撇号、换行符),使用Python对负载进行JSON编码,然后通过管道传递给curl:
bash
curl -s -X POST https://md.page/api/publish \
-H Content-Type: application/json \
-d $(python3 -c
import json
md = 你的Markdown内容在这里
print(json.dumps({markdown: md}))
)
- 4. 解析JSON响应,将 url 返回给用户。告知用户页面将在24小时后过期。
- 如果请求失败,对照上表检查错误状态码并告知用户。
格式提示
- - 第一行的 # 标题 将成为浏览器标签页和社交预览中的页面标题。
- 代码块、表格、引用、列表、图片和链接均以简洁样式渲染。
- 自动适配深色模式。
- 最大内容大小:500KB。
- URL为私密、不可猜测的6字符ID。