An online Markdown to HTML converter with multiple themes and syntax highlighting support.
- Multiple Themes: 20+ built-in themes including GitHub, Nord, Monokai, Tokyo Night, and more
- Syntax Highlighting: Code block highlighting with multiple style options
- Math Support: KaTeX for mathematical formulas
- Diagrams: Mermaid diagram support
- Custom Styling: Color customization and spacing adjustments
- REST API: Programmable API for integration
- Export: Download as standalone HTML file
- GitHub Light
- Academic
- One Light
- Gruvbox Light
- Catppuccin Latte
- Material Light
- Ayu Light
- Quiet Light
- GitHub Dark
- GitHub Dimmed
- Nord
- Monokai
- One Dark
- Tokyo Night
- Gruvbox Dark
- Catppuccin Mocha
- Material Dark
- Ayu Dark
- Night Owl
- Panda
- GitHub / GitHub Dark
- Monokai
- Atom One Dark / Atom One Light
- Nord
- Tokyo Night
# Install dependencies
npm install
# Start local development server
npm run dev
# Deploy to Cloudflare Pages
npm run deploy在线 Markdown 转 HTML 工具,支持多主题和语法高亮。
- 内置 20+ 主题,包括 GitHub、Nord、Monokai、Tokyo Night 等
- 代码块高亮,支持多种样式
- 支持 KaTeX 数学公式
- 支持 Mermaid 图表
- 颜色自定义和间距调整
- 可编程 API 便于集成
- 下载为独立 HTML 文件
- GitHub Light
- Academic
- One Light
- Gruvbox Light
- Catppuccin Latte
- Material Light
- Ayu Light
- Quiet Light
- GitHub Dark
- GitHub Dimmed
- Nord
- Monokai
- One Dark
- Tokyo Night
- Gruvbox Dark
- Catppuccin Mocha
- Material Dark
- Ayu Dark
- Night Owl
- Panda
- GitHub / GitHub Dark
- Monokai
- Atom One Dark / Atom One Light
- Nord
- Tokyo Night
# 安装依赖
npm install
# 启动本地开发服务器
npm run dev
# 部署到 Cloudflare Pages
npm run deployMarkHTML provides a REST API for converting Markdown to HTML programmatically.
MarkHTML 提供 REST API 接口,支持通过 HTTP 请求将 Markdown 转换为 HTML。
POST /api/convert
Content-Type: application/json
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
markdown |
string | Yes | - | Markdown text to convert |
theme |
string | No | github |
Theme name |
highlightStyle |
string | No | github |
Code highlight theme |
showLineNumbers |
boolean | No | true |
Show line numbers in code blocks |
includeKaTeX |
boolean | No | true |
Include KaTeX math support |
enableMermaid |
boolean | No | true |
Enable Mermaid diagrams |
wrapHtml |
boolean | No | true |
Generate complete HTML document |
styleScheme |
object | No | null |
Custom style scheme object |
| 参数 | 类型 | 必填 | 默认值 | 说明 |
|---|---|---|---|---|
markdown |
string | 是 | - | 要转换的 Markdown 文本 |
theme |
string | 否 | github |
主题名称 |
highlightStyle |
string | 否 | github |
代码高亮主题 |
showLineNumbers |
boolean | 否 | true |
是否显示代码行号 |
includeKaTeX |
boolean | 否 | true |
是否包含 KaTeX 数学公式支持 |
enableMermaid |
boolean | 否 | true |
是否启用 Mermaid 图表 |
wrapHtml |
boolean | 否 | true |
是否生成完整 HTML 文档 |
styleScheme |
object | 否 | null |
自定义样式方案对象 |
Light / 浅色: github, academic, one-light, gruvbox-light, catppuccin-latte, material-light, ayu-light, quiet-light
Dark / 深色: github-dark, github-dimmed, nord, monokai, one-dark, tokyo-night, gruvbox-dark, catppuccin-mocha, material-dark, ayu-dark, night-owl, panda
github, github-dark, monokai, atom-one-dark, atom-one-light, nord, tokyo-night
Content-Type: application/json
| Field | Type | Description |
|---|---|---|
css |
string | Generated CSS styles |
html |
string | Converted HTML content |
fullHtml |
string | Complete HTML document (when wrapHtml=true) |
| 字段 | 类型 | 说明 |
|---|---|---|
css |
string | 生成的 CSS 样式 |
html |
string | 转换后的 HTML 内容 |
fullHtml |
string | 完整的 HTML 文档(当 wrapHtml=true 时) |
curl -X POST https://your-domain/api/convert \
-H "Content-Type: application/json" \
-d '{
"markdown": "# Hello\n\nThis is **bold** text.",
"theme": "github",
"wrapHtml": false
}'const response = await fetch('/api/convert', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
markdown: '# Hello\n\nThis is **bold** text.',
theme: 'github-dark',
highlightStyle: 'github-dark',
wrapHtml: true
})
});
const { css, html, fullHtml } = await response.json();const response = await fetch('/api/convert', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
markdown: '# Custom Theme',
styleScheme: {
colors: {
base: { bg: '#1e1e1e', textBase: '#d4d4d4' },
accent: { primary: '#569cd6' }
},
layout: {
font: { baseSize: 16, lineHeight: 1.7 }
}
},
wrapHtml: true
})
});{
"error": "Error description"
}| Status Code | Description |
|---|---|
| 400 | Bad request (missing required fields) |
| 500 | Server error |
| 状态码 | 说明 |
|---|---|
| 400 | 请求参数错误(缺少必填字段) |
| 500 | 服务器内部错误 |
The API supports CORS with the following header:
API 支持 CORS,响应头包含:
Access-Control-Allow-Origin: *