--- name: md2wechat description: Convert Markdown to WeChat Official Account HTML. Supports API mode (fast) and AI mode (themed). Features writer style assistant, AI trace removal (humanizer), and draft upload. metadata: {"openclaw": {"emoji": "📝", "homepage": "https://github.com/geekjourneyx/md2wechat-skill", "requires": {"anyBins": ["curl", "wget"]}, "primaryEnv": "IMAGE_API_KEY"}} --- # MD to WeChat Converts Markdown articles to WeChat Official Account formatted HTML with inline CSS and optionally uploads to draft box. Supports two modes: - **API Mode**: Fast conversion using md2wechat.cn API - **AI Mode**: Beautiful themed layouts powered by Claude AI ## Quick Start ```bash # Preview HTML (API mode, fast) bash skills/md2wechat/scripts/run.sh convert article.md --preview # Preview HTML (AI mode, themed) bash skills/md2wechat/scripts/run.sh convert article.md --mode ai --theme autumn-warm --preview # Upload to WeChat draft box bash skills/md2wechat/scripts/run.sh convert article.md --draft --cover cover.jpg ``` ### Natural Language Image Generation You can also ask me to generate images using natural language: #### Generate Image for Article (Insert into Markdown) ``` "Help me generate a product concept image at the beginning of article.md" "Add an image showing the product features after the second paragraph" "Create a diagram for the comparison section in article.md" ``` I will: 1. Read the article to understand the context 2. Insert the AI image generation syntax at the appropriate location 3. Call the conversion command to generate and upload the image #### Generate Standalone Image (Not for Article) ``` "Generate an image of a cute cat sitting on a windowsill" "Create a product concept image: modern smart home device, white design" "Make a diagram showing the user flow" ``` I will: 1. Call the image generation command directly 2. Return the generated image URL and WeChat material ID ### Natural Language Writing Assistance You can also ask me to help write articles using creator styles: #### Write Article from Idea ``` "Write an article about self-discipline using Dan Koe style" "Help me write a post about productivity with a sharp, grounded tone" "Create a story-style article about my travel experience" ``` I will: 1. Understand your idea or topic 2. Use the appropriate writing style (default: Dan Koe) 3. Generate article structure and content 4. Extract memorable quotes 5. Optionally generate matching cover image #### Refine Existing Content ``` "Rewrite this article with a more engaging style" "Polish my article.md with Dan Koe's writing style" "Make this content more profound and sharp" ``` I will: 1. Read your existing content 2. Apply the selected writing style 3. Maintain original meaning while improving expression #### Generate Cover Only ``` "Generate a cover image for my article about self-discipline" "Create a Victorian woodcut style cover for my philosophy piece" ``` #### AI Writing Trace Removal (Humanizer) ``` "Remove AI traces from this article: article.md" "Humanize this text to make it sound more natural" "Remove AI writing traces with gentle intensity" "Rewrite this to sound less like AI generated" ``` I will: 1. Read the text to identify AI writing patterns (24 types) 2. Remove or rewrite problematic phrases 3. Inject natural human-like expressions 4. Preserve core meaning and tone 5. Return quality score (5 dimensions, /50) **Humanizer can be combined with writing styles:** ``` "Write with Dan Koe style and remove AI traces" "Use dan-koe style, then humanize the result" ``` #### List Available Styles ``` "Show me all available writing styles" "What writing styles can I use?" ``` **Available Writing Styles:** - **Dan Koe** (default): Profound, sharp, grounded - great for personal growth and opinion pieces Users can add custom styles in `writers/` directory. See `writers/README.md` for details. ## Workflow Checklist Copy this checklist to track progress: ``` Progress: - [ ] Step 1: Analyze Markdown structure and images - [ ] Step 2: Confirm conversion mode (API/AI) and theme - [ ] Step 3: Generate HTML with inline CSS - [ ] Step 4: Process images (upload to WeChat) - [ ] Step 5: Replace image URLs in HTML - [ ] Step 6: Preview or upload to draft ``` --- ## Step 1: Analyze Markdown Read the markdown file and extract: | Element | How to Extract | |---------|----------------| | **Title** | First `# heading` or filename | | **Author** | Look for `Author:` or `作者:` in frontmatter | | **Digest** | First paragraph or generate from content (max 120 chars) | | **Images** | Collect all `![alt](src)` references | | **Structure** | Headings, lists, code blocks, quotes, tables | **Image Reference Types**: | Type | Syntax | Processing | |------|--------|------------| | Local | `![alt](./path/image.png)` | Upload to WeChat | | Online | `![alt](https://example.com/image.png)` | Download then upload | | AI Generate | `![alt](__generate:prompt__)` | Generate via AI then upload | --- ## Step 2: Confirm Mode and Theme ### Conversion Mode | Mode | Speed | Style | Best For | |------|-------|-------|----------| | **API** | Fast (seconds) | Clean, standard | Quick publishing, technical content | | **AI** | Slower (10-30s) | Beautiful themed | Important articles, brand content | ### AI Themes | Theme | Description | Best For | |-------|-------------|----------| | **autumn-warm** | Warm orange tones, emotional, literary | Stories, lifestyle, essays | | **spring-fresh** | Fresh green tones, natural, vibrant | Travel, nature, outdoor | | **ocean-calm** | Calm blue tones, professional, rational | Tech articles, business analysis | | **custom** | Use custom prompt | Brand customization | ### API Themes (Fast) | Theme | Description | Best For | |-------|-------------|----------| | **default** | Default theme, clean and professional | General content | | **bytedance** | ByteDance style | Tech news | | **apple** | Apple minimalist style | Product reviews | | **sports** | Active sports style | Sports content | | **chinese** | Traditional Chinese culture style | Cultural articles | | **cyber** | Cyberpunk style | Frontier tech | **Ask the user**: "Which mode and theme would you like?" - Only ask if the user doesn't specify in their request. - **API mode** (fast): default, bytedance, apple, sports, chinese, cyber - **AI mode** (themed): autumn-warm, spring-fresh, ocean-calm **Default**: Use `API mode` if user doesn't specify. Read detailed style prompts from [references/themes.md](references/themes.md) --- ## Step 3: Generate HTML ### API Mode Call md2wechat CLI: ```bash bash skills/md2wechat/scripts/run.sh convert article.md --mode api ``` ### AI Mode Read the selected style prompt from `references/themes.md` and generate HTML with **inline CSS**. **Important Rules**: 1. All CSS must be **inline** (in `style` attributes) 2. No external stylesheets or scripts 3. Use WeChat-safe HTML tags only 4. Image placeholder format: ``, ``, etc. **Safe HTML Tags**: - `

`, `
`, ``, ``, ``, `` - `

` to `
` - `
    `, `
      `, `
    1. ` - `
      `, `
      `, ``
      - ``, ``, ``, ``, `
      `, `` - `
      `, `` (with inline styles) **Avoid**: - `