Markdown To Wechat
Paste the following prompt into your AI chat to install this skill:
Please install @user_5223609c/md-to-wechat according to https://skillhub.cn/install/skillhub.md.
About this skill
The Specific Problem Solved
When publishing content on WeChat Official Accounts, many authors prefer writing in Markdown for its simplicity and version control. However, the WeChat editor does not support native Markdown rendering. This leads to two main pain points: manually converting Markdown to rich text for WeChat is time-consuming and error-prone, and the publishing workflow involves tedious copy-pasting, formatting adjustments, and draft saving without automation. This skill aims to address this core issue by directly converting local Markdown files to WeChat Official Account styled HTML and automatically pushing to the drafts, reducing repetitive labor.
How the Skill Works
Core Capabilities
The core of this skill is automated rendering and pushing. It takes a Markdown file path, uses built-in scripts to parse Markdown syntax, applies WeChat Official Account style rules to generate HTML, and leverages the WeChat API for draft uploading. Key capabilities include:
- Style Adaptation: Automatically handles headings, lists, bold text, and other elements to ensure proper display in WeChat.
- Intelligent Cover Image Detection: Prioritizes images from the Markdown as the cover image; if none exist, falls back to a default cover configured via environment variables, preventing push failures.
- Configuration Management: Manages account information, theme IDs, and other settings through a .env file, simplifying initial setup.
Key Steps
The execution flow involves five necessary steps to ensure reliability and user confirmation:
1. Confirm Prerequisite Configuration: Reads the .env file to check if ACCOUNT, THEME_ID, WECHAT_APP_ID, and WECHAT_APP_SECRET are filled. If missing, prompts the user to complete configuration via references/setup.md.
2. Confirm MD File Path: Obtains the absolute path of the Markdown file from context or references, ensuring the file exists.
3. One-time IP and Article Info Confirmation: Runs the script to get the local IP, extracts information from the Markdown file and configuration, and presents it to the user for confirmation. Key points include cover image source (e.g., using the first image from MD or a default cover), collecting all feedback.
4. Formal Push: Runs the script with the --confirmed flag, passing optional parameters (like --title, --cover) based on user feedback to override defaults.
5. Push Success: Outputs results and guides the user to check the drafts in the WeChat Official Account backend.
Auxiliary Tools
The skill also provides auxiliary commands, such as:
- Query Theme List: Runs list_themes.cjs to fetch all theme names and IDs, helping users correctly set THEME_ID in .env.
Applicable Boundaries or Considerations
Configuration Requirements
- First-time Use Requires Configuration: Users must edit the
.envfile to fill in WeChat App ID, App Secret, and other details; otherwise, the skill cannot run. Refer toreferences/setup.mdfor the process. - IP Whitelist: WeChat API requires IP whitelisting. If the push fails with error code
40164, run the script to get the current IP and update the whitelist in the WeChat backend.
Error Handling
Common errors and handling methods include:
- missing_env: The .env file is not configured or missing fields; check the file.
- api_error: Account or theme ID error; run list_themes.cjs to confirm.
- file_not_found: Incorrect Markdown file path.
- cover_download_failed: Cover image download failed; ensure the image URL is accessible or use --cover to specify a local image.
Limitations
- This skill focuses solely on converting Markdown to WeChat Official Account style and pushing, not supporting other platforms or formats.
- Pushing relies on network connectivity and WeChat API availability; offline environments cannot use it.
- Cover image handling is based on auto-detection but may fail; users need to provide backup options manually if necessary.
Use Cases
- When a technical author writes tutorials in Markdown locally, they need to quickly convert them to WeChat-compatible format and push drafts for previewing and publishing.
- Content operations teams regularly push Markdown-formatted weekly reports or event announcements to Official Account drafts to ensure consistent formatting and reduce manual formatting time.
- After configuring WeChat App ID and theme ID, run the script to get the local IP and update the whitelist, enabling a secure automated content publishing workflow.
- When a Markdown article contains multiple images, automatically detect the first one as the cover to prevent push failures and simplify cover selection steps.
Best For
- Technical bloggers: Need to publish Markdown-written programming tutorials or technical articles to WeChat Official Account while avoiding formatting errors and saving time.
- Content operations specialists: Responsible for regularly pushing team Markdown-formatted weekly reports or marketing copy to Official Account drafts to ensure content consistency and publishing efficiency.
- Individual self-media creators: Accustomed to writing in Markdown, seeking to automate conversion and pushing to focus on content creation rather than formatting adjustments.
- Development team leads: Manage publishing workflows for multiple Markdown documents, requiring configuration and scripts for batch processing or automated integration.
Related Skills
An AI editorial master skill that manages the full content creation process from vague ideas to publishable drafts, covering topic selection, writing, review, and publication adaptation.
An AI skill that generates original lyrics and synthesizes a custom song based on user-provided stories, occasions, and details.
Generates trending product copy for cross-border e-commerce platforms like Amazon and Shopee with SEO keyword optimization and multi-language support.
Converts beauty and skincare product information into Red (Xiaohongshu) compliant notes, including layout planning, copywriting, and compliance screening.