md2wechat-skill

repository·main·Indexed 25 days ago

https://github.com/geekjourneyx/md2wechat-skill

A CLI tool and skill set for AI Agents and developers to automate the creation, formatting, and publishing of WeChat Official Account articles from Markdown. It features professional API mode for advanced layouts, AI-driven image generation for covers and infographics, and custom writing style configurations. The project provides platform-specific implementations for Claude Code, Codex, OpenCode, WorkBuddy, Obsidian, Claudian, OpenClaw, and ClawHub.

Tokens
54.8K
Snippets
170
Records
354
Agent score
84%

What's inside md2wechat-skill

  1. Use Professional API mode for advanced layout and automation

    main

    The Professional API mode is designed for stable output, team collaboration, and Agent automation. Unlike the free mode, it provides:

    • Direct WeChat HTML: Returns final HTML instead of just prompts.
    • Advanced Themes: Access to 48 professional themes.
    • Layout Parsing: Parses 53 recommended :::module syntax names.
    • Automation: Suitable for managing multiple accounts and matrix publishing.

    To use these features, you must apply for API service via the '极客杰尼' WeChat official account.

  2. Supported Markdown features in md2wechat

    main

    The md2wechat tool supports converting Markdown content into WeChat-compatible HTML with the following features:

    • Markdown to HTML conversion: Standard Markdown syntax is transformed for WeChat.
    • Automatic image uploading: Handles both local and remote images.
    • Theming: Supports multiple beautiful themes.
    • Draft creation: One-click creation of WeChat drafts.
  3. Understand the md2wechat-skill architecture and workflow

    main

    The project is designed to transform Markdown into stable, verifiable, and automatable WeChat Official Account content. The core workflow follows this sequence:

    cmd (CLI entry) $\rightarrow$ inspect (validation/metadata) $\rightarrow$ converter/publish (orchestration) $\rightarrow$ asset pipeline (image processing) $\rightarrow$ draft/wechat adapters (platform delivery).

    Key architectural components:

    • inspect: The single source of truth for metadata, readiness, and semantic checks.
    • preview: A view layer that reuses inspect results and calls the converter to generate HTML, but does not perform side effects like uploading.
    • convert: The primary command for transformation, metadata extraction, and executing side effects (uploading/draft creation) based on flags.
    • AssetPipeline: Handles image uploading, generation, downloading, and HTML backfilling.
  4. Understand Advanced Layout Modules

    main

    Advanced Layout Modules are visual card components used to enhance WeChat Official Account articles. They are written in Markdown using the :::module_name syntax and are rendered into structured HTML via the md2wechat API.

    Note: These modules are exclusive to API mode. The convert command uses API mode by default. Access to the API requires consultation with the author.

    The 4-Purpose Principle

    To maintain readability and avoid clutter, follow the principle of using minimal modules, targeting one module per purpose:

    • attention: Capture interest (e.g., hero, cards, verdict).
    • readability: Improve mobile reading experience (e.g., toc, steps, part).
    • memorability: Help readers remember key points or brands (e.g., verdict, manifesto, author-card).
    • conversion: Drive actions like follows or purchases (e.g., cta, faq, checklist).
  5. Compare OpenClaw with Claude Code

    main

    If you are deciding between using OpenClaw or Claude Code for the md2wechat skill, note the following key differences:

    • Positioning: Claude Code is a terminal AI programming assistant, while OpenClaw is an AI assistant for chat applications (WhatsApp, Telegram, etc.).
    • Execution: Claude Code runs in the local terminal; OpenClaw runs locally but is controlled via chat applications.
    • Skill Path: In Claude Code, skills are located in skills/md2wechat/. In OpenClaw, they are in platforms/openclaw/md2wechat/.
    • Skill Directory: Claude Code uses ~/.claude/skills/. OpenClaw uses the active workspace's skills/ directory, or a shared path at ~/.openclaw/skills. You can verify the actual location using the command openclaw skills info md2wechat.
    • Installation: Claude Code uses the /plugin command. OpenClaw uses npm with the command openclaw skills install @geekjourneyx/md2wechat.
    • Configuration: Both platforms use ~/.config/md2wechat/config.yaml or environment variables.
    • LLM Support: Claude Code is limited to Claude. OpenClaw supports Claude, GPT, DeepSeek, KIMI, and others.
    • Marketplace: Claude Code uses the Plugin Marketplace; OpenClaw uses ClawHub.
  6. Distinguish between CLI Config and Brand Profile

    main

    It is important to understand the difference between the two configuration types in md2wechat:

    FeatureCLI Runtime Config (config.yaml)Brand Profile (brand.md)
    Location~/.config/md2wechat/config.yaml~/.config/md2wechat/brand.md
    FormatYAMLMarkdown
    Primary UserCLI (for API keys, providers, themes)Agent (for style, tone, brand context)
    PurposeTechnical connectivity and rendering settingsContent generation and persona consistency
  7. Provide diagnostic information for GitHub Issues

    main

    When reporting an issue on GitHub, include the following diagnostic data to help maintainers resolve the problem quickly:

    1. Version Information: Run md2wechat version --json and go version.
    2. Configuration Summary: Run md2wechat config show --format json.
    3. Error Logs: Provide the failed command and its full error output (e.g., md2wechat convert article.md 2>&1).
    4. System Info: Run uname -a on macOS/Linux or systeminfo on Windows.
    # Example of gathering diagnostic data
    md2wechat version --json
    go version
    md2wechat config show --format json
    md2wechat convert article.md 2>&1
  8. Initialize md2wechat configuration

    main

    Initialize the default configuration file by running md2wechat config init. The configuration is stored at ~/.config/md2wechat/config.yaml.

    To create WeChat drafts, you must configure the following keys:

    • wechat.appid
    • wechat.secret
    • api.md2wechat_key

    You can also switch the API domain by modifying api.md2wechat_base_url in the config file. Supported domains include https://www.md2wechat.cn and https://md2wechat.app.

    md2wechat config init
  9. Create Image Posts

    main

    Create WeChat image posts (newspic/image messages) using either local files or Markdown content.

    • From Files: Specify a title and a list of images.
    • From Markdown: Use the --from-markdown flag. This supports both local image paths and remote image URLs (remote images are automatically downloaded, uploaded to WeChat, and then used to create the post).
  10. Initialize and use Brand Profile for Agents

    main

    The Brand Profile is a Markdown file used by Agents (not the CLI) to understand brand context, tone, and style preferences. It is stored at ~/.config/md2wechat/brand.md.

    Setup

    Use the following commands to manage the profile:

    • md2wechat brand init: Initializes a new Brand Profile (idempotent; won't overwrite if it exists).
    • md2wechat brand show: Displays the current profile.
    • md2wechat brand show --json: Displays the profile in JSON format, including the raw Markdown content in the data.content field.

    Usage for Developers/Agents

    Agents should read the content of brand.md and use it as context for content generation. If the file is missing, the Agent should fall back to default styles. If the file exists but is unreadable, the Agent should notify the user and use default styles.

    md2wechat brand init
    md2wechat brand show --json
  11. Initialize and validate configuration

    main

    After installation, use the following commands to initialize your configuration and validate it. Using the --json flag is recommended for machine-readable output.

    md2wechat version --json
    md2wechat config init --json
    md2wechat config validate --json
  12. Initialize and validate md2wechat configuration

    main

    Follow these three steps to set up a basic configuration:

    1. Generate a sample config: Run md2wechat config init. This creates a file at ~/.config/md2wechat/config.yaml. You can specify a custom path using md2wechat config init ./path/to/config.yaml.
    2. Fill in required fields: Open the generated file and provide your WeChat AppID, Secret, and your md2wechat_key.
    3. Verify configuration:
      • Use md2wechat config validate to check if the file can be loaded and parsed.
      • Use md2wechat doctor --json for a local health check (verifies API readiness, theme compatibility, and layout catalog availability without performing live authentication).
      • Use md2wechat config show --format json to see the currently active, flattened configuration.
    md2wechat config init ./md2wechat.yaml
    md2wechat config validate
    md2wechat doctor --json
    md2wechat config show --format json