Search

PythonReactSEOPDF
GitHub Skill

md2we-render-markdown

Render Markdown into WeChat-ready HTML with MD2WE themes, code highlighting, font size, and background options. Use when the user asks to convert Markdown to styled HTML, preview theme output, or generate WeChat-compatible article HTML from a file or draft.

zuoa☆ 2 Repository stars1 Repository forks

Installation

Follow the repository instructions for this skill and your agent. Review the files and dependencies before adding it to your workflow.

View source ↗Guides

Skill instructions

md2we-render-markdown

Use MD2WE's online /api/convert endpoint to render Markdown into styled HTML.

When To Use

Use this skill when the user wants to:

  • Convert a Markdown file into WeChat-compatible HTML
  • Compare MD2WE theme variants
  • Render with a specific code theme, font size, or background
  • Save rendered HTML to disk for later publishing

Service Check

Default base URL:

export MD2WE_BASE_URL="${MD2WE_BASE_URL:-https://md2we.com}"

Before rendering, verify the service:

curl -sS "${MD2WE_BASE_URL}/api/health"

If the service is unavailable and the current repo is MD2WE, start it from the repo root:

python3 app.py

Then point the base URL to the local service and retry /api/health:

export MD2WE_BASE_URL="http://127.0.0.1:5566"
curl -sS "${MD2WE_BASE_URL}/api/health"

API Call Pattern

Basic render:

curl -sS "${MD2WE_BASE_URL}/api/convert" \
  -H "Content-Type: application/json" \
  -d @<(jq -Rs '{
    markdown: .,
    theme: "default",
    code_theme: "github",
    font_size: "medium",
    background: "warm"
  }' article.md)

Choose render options:

curl -sS "${MD2WE_BASE_URL}/api/convert" \
  -H "Content-Type: application/json" \
  -d @<(jq -Rs '{
    markdown: .,
    theme: "tech",
    code_theme: "monokai",
    font_size: "large",
    background: "warm"
  }' article.md)

Render from stdin:

cat article.md | jq -Rs '{
  markdown: .,
  theme: "default",
  code_theme: "github",
  font_size: "medium",
  background: "warm"
}' | curl -sS "${MD2WE_BASE_URL}/api/convert" \
  -H "Content-Type: application/json" \
  -d @-

Write the returned html field to a file:

response=$(curl -sS "${MD2WE_BASE_URL}/api/convert" \
  -H "Content-Type: application/json" \
  -d @<(jq -Rs '{
    markdown: .,
    theme: "default",
    code_theme: "github",
    font_size: "medium",
    background: "warm"
  }' article.md))

echo "$response" | jq -e '.success == true' >/dev/null || {
  echo "$response" | jq .
  exit 1
}

echo "$response" | jq -r '.html' > article.html

Supported Values

theme: default|sport|chinese|cyberpunk|ocean|forest|sunset|lavender|coffee|minimalist|tech|retro|government|finance
code_theme: github|monokai|dracula|atom-one-dark|atom-one-light|vs|xcode|stackoverflow-light
font_size: small|medium|large
background: warm|grid|none

Result Handling

  • Read the html field from the JSON response.
  • If the user asked for a file, write only the html field to disk.
  • If the user asked for a quick preview only, inspect the JSON response and summarize the chosen settings.
  • If rendering fails, surface the server error directly. Do not guess at broken HTML.

Examples

Read the usage examples in the source repository.

View source ↗

Source history

Indexed on
2026-03-11
Index updated
2026-03-11
Branch
main

Index and sync dates describe this directory. View the source repository for code history.

GitHub ↗

chat Comments (0)

chat_bubble_outline

No comments yet. Be the first to share your thoughts!