Convert Markdown into beautifully typeset HTML compatible with multiple platforms. Suitable for any AI Agent. Integrates best practices from mdnice, baoyu, wechat-format, md2wechat, and others.
This Skill is a pure Markdown instruction set and does not depend on any specific Agent's proprietary API.
| Agent | Loading methods |
|---|---|
| Claude Code | ~/.claude/skills/ directory, automatically registered as /typeset |
| Codex | Project root directory or via AGENTS.md reference |
| Gemini CLI | Via GEMINI.md reference or loaded as context |
| Other | Load SKILL.md as a system prompt or context |
Reference files (read on demand, not preloaded):
references/platform-rules.md— Detailed constraint rules for each platformreferences/element-specs.md— HTML element rendering templatesreferences/code-themes.md— Code highlighting color table + token rulesreferences/humanizer.md— De-AI-flavor processing module
Invocation format
/typeset <文件路径或内容> [--platform wechat|zhihu|juejin|medium|linkedin|x|blog] [--theme default|elegant|tech|minimal|vibrant] [--humanize] [--code-theme github|one-dark|kimbie]
Default value: platform=wechat, theme=minimal, code-theme=github
Workflow
Step 1: Confirm input
- File format detection:
- Markdown (.md) → use directly
- Other formats → convert via MarkItDown (
markitdown <file> -o <output.md>) - Inline text → use directly
- Confirm target platform (default WeChat) and theme (default minimal)
MarkItDown supported formats: PDF, DOCX, PPTX, XLSX, HTML, CSV, JSON, XML, images (OCR), audio (transcription), Jupyter Notebook, ZIP
Installation: pipx install 'markitdown[all]' --python python3.12
Step 2: Preprocessing
- Frontmatter: Parse YAML, extract title/author/description/tags
- CJK spacing: automatically add spaces between Chinese and English (Pangu spacing)
- Heading cleanup: remove H1 for the WeChat platform (WeChat uses a separate title field)
- Link preprocessing: for the WeChat platform, convert external links to plain-text footnotes; keep them on other platforms
Step 3: Optional — humanization processing
If --humanize, read references/humanizer.md and perform de-AI-flavor processing.
Step 4: Render HTML
Core step. In the following order:
- Read theme:
{{SKILL_DIR}}/themes/<theme>.md - Render elements: read
references/element-specs.md, convert each Markdown element into inline-styled HTML according to the specification - Apply platform rules: read
references/platform-rules.mdfor the target platform's constraints - Code highlighting: read
references/code-themes.mdfor the color table corresponding to code-theme - Assemble document: generate the complete HTML
Step 5: Output
- Write the HTML file (same directory as the input,
.htmlextension) - Report the path
- Suggest the paste method: open in browser → select all → copy → paste into the editor
- For the WeChat platform, additionally note that images must be uploaded separately
Theme system
Four-layer architecture
| Layer | Purpose |
|---|---|
| Base layer | Container, typography foundation (shared by all themes) |
| Content layer | Visual styles for headings, paragraphs, lists, etc. |
| Code layer | Code highlighting (independently toggleable) |
| Font layer | Font family override (optional) |
Built-in themes
| Theme | Style | Use case |
|---|---|---|
minimal (Default) |
Minimalist, generous whitespace | General articles, short pieces |
default |
Professional, blue tones | Formal reports, technical articles |
elegant |
Literary, warm tones | Humanities/Business/Narrative |
tech |
Modern, cool tones | Technical tutorials, development docs |
vibrant |
Energetic, green tones | Brand content/Marketing |
dark |
Dark, easy on the eyes | Tech communities, night reading |
notion |
Notion style | Knowledge bases, internal docs |
newspaper |
Newspaper print style | In-depth coverage, long-form articles |
gradient |
Modern gradient | Product launches |
Theme file: {{SKILL_DIR}}/themes/<name>.md
Theme preview: {{SKILL_DIR}}/themes/preview.html
Custom themes: Create a .md file in the same format under themes/
Platform routing
Before rendering, read the rules for the corresponding platform in references/platform-rules.md .
| Platform | CSS method | Links | Code blocks | Tables | Key constraints |
|---|---|---|---|---|---|
| Fully inline | Plain text footnotes | section+span | Scroll container | No #000, no pre, no external-link a tags | |
| zhihu | Inline | Preserve | pre/code | Normal | Use data-eeimg for formulas |
| juejin | Inline | Preserve | pre/code | Normal | — |
| medium | Inline | Preserve | pre (no highlighting) | Not supported | H1+H2 only, Medium overrides styles |
| Inline | Preserve | Not supported | Not supported | Images must be uploaded manually | |
| x | Inline | Preserve | pre (no highlighting) | Limited | Premium feature |
| blog | style tag | Preserve | pre/code+hljs | Normal | Full HTML document |
Output format
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>{标题}</title>
</head>
<body>
<section id="nice" style="...">
<!-- 渲染后的内联样式 HTML -->
</section>
</body>
</html>
File naming: article.md → article.html
Best practices
- Confirm the platform before choosing a theme
- Use the tech theme for technical articles
- Code blocks recommended to wrap at 80 characters
- Humanization processing is recommended before typesetting
- WeChat links are always plain text footnotes, do not use
<a>tags
Source attribution
| Source | Contribution |
|---|---|
| mdnice/markdown-nice | Four-layer themes, three-part headings, WeChat CSS |
| baoyu-markdown-to-html | Callout/footnotes/code highlighting, CJK preprocessing |
| wechat-format | Inline styles, list compatibility, subpixel borders |
| md2wechat-skill | Humanization module, image processing |
| obsidian-markdown | Callout taxonomy, Frontmatter specification |