X Article Publisher

Publish Markdown articles to X (Twitter) Articles with one command. Say goodbye to tedious rich text editing.

Category: Content

About this skill

This skill automates the entire X Articles publishing workflow. Convert Markdown to rich text, upload images with precise block-index positioning, and save as draft - all automatically. Provides 10x efficiency improvement: what used to take 20-30 minutes now takes 2-3 minutes.

Source and installation instructions

Installation

  1. # Install via Claude Code
  2. x-article-publisher skill install
  3. # Or via Git Clone:
  4. git clone https://github.com/wshuyi/x-article-publisher-skill.git
  5. cp -r x-article-publisher-skill/skills/x-article-publisher ~/.claude/skills/
  6. # Requirements:
  7. pip install Pillow pyobjc-framework-Cocoa
  8. # Requires: X Premium Plus, Playwright MCP, macOS

Documentation

X Article Publisher Skill

English | 中文

Publish Markdown articles to X (Twitter) Articles with one command. Say goodbye to tedious rich text editing.

v1.2.0 — Now with divider support, table-to-image, Mermaid support, and cross-platform clipboard


The Problem

If you're used to writing in Markdown, publishing to X Articles is a painful process:

Pain PointDescription
Format LossCopy from Markdown editor → Paste to X → All formatting gone
Manual FormattingSet each H2, bold, link manually — 15-20 min per article
Tedious Image Upload5 clicks per image: Add media → Media → Add photo → Select → Wait
Position ErrorsHard to remember where each image should go

Time Comparison

TaskManualWith This Skill
Format conversion15-20 min0 (automatic)
Cover image1-2 min10 sec
5 content images5-10 min1 min
Total20-30 min2-3 min

10x efficiency improvement


The Solution

This skill automates the entire publishing workflow:

Markdown File
     ↓ Python parsing
Structured Data (title, images with block_index, HTML)
     ↓ Playwright MCP
X Articles Editor (browser automation)
     ↓
Draft Saved (never auto-publishes)

Key Features


What's New in v1.1.0

FeatureBeforeAfter
Image positioningText matching (fragile)Block index (precise)
Insertion orderSequentialReverse (high→low)
Wait behaviorFixed delayImmediate return on condition

Why Block-Index?

Previously, images were positioned by matching surrounding text — this failed when:

Now, each image has a block_index indicating exactly which block element it follows. This is deterministic and reliable.


Requirements

RequirementDetails
Claude Codeclaude.ai/code
Playwright MCPBrowser automation
X Premium PlusRequired for Articles feature
Python 3.9+With dependencies below
OSmacOS or Windows
# macOS
pip install Pillow pyobjc-framework-Cocoa

# Windows
pip install Pillow pywin32 clip-util

# For Mermaid diagrams (optional)
npm install -g @mermaid-js/mermaid-cli

Installation

Method 1: Git Clone (Recommended)

git clone https://github.com/wshuyi/x-article-publisher-skill.git
cp -r x-article-publisher-skill/skills/x-article-publisher ~/.claude/skills/

Method 2: Plugin Marketplace

/plugin marketplace add wshuyi/x-article-publisher-skill
/plugin install x-article-publisher@wshuyi/x-article-publisher-skill

Usage

Natural Language

Publish /path/to/article.md to X
Help me post this article to X Articles: ~/Documents/my-post.md

Skill Command

/x-article-publisher /path/to/article.md

Workflow Steps

[1/7] Parse Markdown...
      → Extract title, cover image, content images with block_index
      → Convert to HTML, count total blocks

[2/7] Open X Articles editor...
      → Navigate to x.com/compose/articles

[3/7] Upload cover image...
      → First image becomes cover

[4/7] Fill title...
      → H1 used as title (not included in body)

[5/7] Paste article content...
      → Rich text via clipboard
      → All formatting preserved

[6/7] Insert content images (reverse order)...
      → Sort by block_index descending
      → Click block element at index → Paste image
      → Wait for upload (returns immediately when done)

[7/7] Save draft...
      → ✅ Review and publish manually

Supported Markdown

SyntaxResultNotes
# H1Article titleExtracted, not in body
## H2Section headersNative support
**bold**Bold textNative support
*italic*Italic textNative support
[text](https://github.com/wshuyi/x-article-publisher-skill/blob/main/url)HyperlinksNative support
> quoteBlockquotesNative support
- itemUnordered listsNative support
1. itemOrdered listsNative support
![](https://raw.githubusercontent.com/wshuyi/x-article-publisher-skill/main/img.jpg)ImagesFirst = cover
---DividersVia Insert menu (v1.2)
TablesPNG imagesVia table_to_image.py (v1.2)
MermaidPNG imagesVia mmdc CLI (v1.2)

Example

Input: article.md

# 5 AI Tools Worth Watching in 2024

![cover](https://raw.githubusercontent.com/wshuyi/x-article-publisher-skill/main/images/cover.jpg)

AI tools exploded in 2024. Here are 5 worth your attention.

## 1. Claude: Best Conversational AI

**Claude** by Anthropic excels at long-context understanding.

> Claude's context window reaches 200K tokens.

![claude-demo](https://raw.githubusercontent.com/wshuyi/x-article-publisher-skill/main/images/claude-demo.png)

## 2. Midjourney: AI Art Leader

[Midjourney](https://midjourney.com) is the most popular AI art tool.

![midjourney](https://raw.githubusercontent.com/wshuyi/x-article-publisher-skill/main/images/midjourney.jpg)

Parsed Output (JSON)

{
  "title": "5 AI Tools Worth Watching in 2024",
  "cover_image": "./images/cover.jpg",
  "content_images": [
    {"path": "./images/claude-demo.png", "block_index": 4},
    {"path": "./images/midjourney.jpg", "block_index": 6}
  ],
  "total_blocks": 7
}

Insertion Order

Images inserted in reverse: block_index=6 first, then block_index=4.

Result


Project Structure

x-article-publisher-skill/
├── .claude-plugin/
│   └── plugin.json              # Plugin config
├── skills/
│   └── x-article-publisher/
│       ├── SKILL.md             # Skill instructions
│       └── scripts/
│           ├── parse_markdown.py    # Extracts block_index + dividers
│           ├── copy_to_clipboard.py # Cross-platform clipboard
│           └── table_to_image.py    # Markdown table → PNG (v1.2)
├── docs/
│   └── GUIDE.md                 # Detailed guide
├── README.md                    # This file
├── README_CN.md                 # Chinese version
└── LICENSE

FAQ

Q: Why Premium Plus? A: X Articles is exclusive to Premium Plus subscribers.

Q: Windows/Linux support? A: Windows is now supported (v1.2). Linux support is still in progress — PRs welcome!

Q: Image upload failed? A: Check: valid path, supported format (jpg/png/gif/webp), stable network.

Q: Can I publish to multiple accounts? A: Not automatically. Switch accounts in browser manually before running.

Q: Why insert images in reverse order? A: Each inserted image shifts subsequent block indices. Inserting from highest to lowest ensures earlier indices remain valid.

Q: What if text matching was used before? A: v1.1 replaces text matching with block_index. The after_text field is kept for debugging but not used for positioning.

Q: Why does wait return immediately sometimes? A: browser_wait_for textGone="..." returns as soon as the text disappears. The time parameter is just a maximum, not a fixed delay.


Documentation


Changelog

v1.2.0 (2025-01)

v1.1.0 (2025-12)

v1.0.0 (2025-12)


License

MIT License - see LICENSE

Author

wshuyi


Acknowledgments

v1.2.0 features were inspired by and adapted from:

Thank you to the community for building upon and improving this skill!


Contributing