Skip to content

Latest commit

 

History

History
164 lines (114 loc) · 4.39 KB

File metadata and controls

164 lines (114 loc) · 4.39 KB
name publish-all
description One markdown file → publish to blog + generate WeChat Word, Zhihu Markdown, Xiaohongshu text, and more. Content distribution for Chinese social media platforms.
argument-hint <file.md> [--slug my-slug] [--lang zh,en] [--skip-blog]
metadata
author version homepage
PulseAgent
1.0.0

Publish All — One Markdown, Every Platform

Distribute a single Markdown blog post across multiple platforms in one command.

What It Does

Output Format Platform
Blog publish SQL/API upsert Your blog (configurable)
WeChat Word .docx with embedded QR codes WeChat Subscription Account (微信订阅号)
Zhihu Markdown Clean .md without QR images Zhihu (知乎)
Xiaohongshu text Short text with emojis + hashtags Xiaohongshu (小红书)
Original copy .md Archive

When to Use

  • After writing a blog post and wanting to distribute it to Chinese social media
  • When you need platform-specific formatting from a single source
  • When you want to maintain consistent messaging across platforms
  • Invoke with /publish-all <file.md>

Prerequisites

  • Python 3.10+ (auto-creates venv on first run)
  • sshpass (for blog publishing via SSH, optional)
  • Blog server with PostgreSQL (optional, for auto-publish)

Setup

1. Install the skill

Copy to your Claude Code skills directory:

cp -r publish-all ~/.claude/skills/

Or symlink:

ln -s /path/to/publish-all ~/.claude/skills/publish-all

2. Configure blog publishing (optional)

Create ~/.publish-all.env:

# Blog server (PostgreSQL via SSH)
BLOG_SSH_HOST=user@your-server.com
BLOG_SSH_PASS=your-password        # or use SSH keys
BLOG_DB_USER=dbuser
BLOG_DB_NAME=dbname
BLOG_AUTHOR_ID=uuid-of-author     # or "auto" to use first admin

# Or use Blog API instead of SSH
BLOG_API_URL=https://yourblog.com/api/blog/publish
BLOG_API_KEY=your-api-key

If no config is found, blog publishing is skipped and only format generation runs.

Usage

Via Claude Code

/publish-all ~/Desktop/my-article.md
/publish-all ~/Desktop/my-article.md --slug custom-slug --lang zh,en
/publish-all ~/Desktop/my-article.md --skip-blog

Via command line

bash scripts/publish-all.sh <file.md> [slug] [lang]

Output

All files are generated in ~/Desktop/publish-{slug}/:

publish-my-article/
├── 微信订阅号-my-article.docx    # Import to WeChat editor
├── 知乎-my-article.md            # Paste into Zhihu editor
├── 小红书-my-article.txt          # Copy-paste to Xiaohongshu
└── 原文-my-article.md             # Archive copy

Markdown Input Format

Your input markdown should follow this structure:

# Article Title

> Optional lead paragraph or blockquote

Body content with standard markdown...

## Section headings

Regular paragraphs, **bold**, *italic*, lists, etc.

![QR caption](https://api.qrserver.com/v1/create-qr-code/?size=200x200&data=https://your-url.com)

[Link text](https://your-url.com)

QR Codes

QR codes using api.qrserver.com are automatically:

  • WeChat Word: Downloaded and embedded as images
  • Zhihu: Removed (replaced by text links)
  • Xiaohongshu: Omitted (plain text only)

Extending

Add a new platform

Edit scripts/gen-formats.py and add a new generator function:

def generate_weibo(md: str) -> str:
    """Convert blog to Weibo-friendly format."""
    # Your conversion logic here
    return weibo_text

Then register it in the main() function.

API-based publishing

The script checks for ~/.publish-all.env. Add new platform API keys there and extend publish-all.sh to call them.

How It Works

input.md
    │
    ├──→ SSH/SQL ──→ Blog database (upsert by slug+lang)
    │
    └──→ gen-formats.py
            ├──→ WechatDocBuilder ──→ .docx (python-docx + QR images)
            ├──→ generate_zhihu()  ──→ .md  (clean markdown)
            └──→ generate_xiaohongshu() ──→ .txt (short + emojis)

Credits

Built by PulseAgent — AI-powered go-to-market platform for exporters.

Inspired by 爱贝壳内容同步助手 (browser-based approach) — we took the CLI + API-first route instead.