
Baoyu Post To X
Turn a Markdown draft into a formatted X Article with cover image and inline images, preview in Chrome, then publish when you are ready.
Install
npx skills add https://github.com/ideacco/baoyu-skills-openclaw --skill baoyu-post-to-xWhat is this skill?
- CLI via `npx -y bun` and `x-article.ts` with default preview and `--submit` to publish
- YAML frontmatter for title and cover (`cover_image`, `cover`, `image` aliases)
- Maps Markdown (headers, lists, blockquotes, links) into X Article rich text; code blocks become blockquotes
- Downloads remote images, uses `XIMGPH_N` placeholders, then inserts images in the editor
- Optional custom cover: `--cover ./cover.jpg`
Adoption & trust: 1 installs on skills.sh; 12 GitHub stars; 1/3 security scanners passed (skills.sh audits); trending (+100% hot-view momentum).
Recommended Skills
Journey fit
Long-form publishing on X is a launch/distribution motion—getting written work onto a channel builders use for audience reach, not in-repo product build. Distribution subphase covers pushing finished articles to external platforms; this skill automates the X Articles editor path from Markdown.
Common Questions / FAQ
Is Baoyu Post To X safe to install?
skills.sh reports 1 of 3 security scanners passed. Review the Security Audits panel on this page before installing in production.
SKILL.md
READMESKILL.md - Baoyu Post To X
# X Articles - Detailed Guide Publish Markdown articles to X Articles editor with rich text formatting and images. ## Prerequisites - X Premium subscription (required for Articles) - Google Chrome installed - `bun` installed ## Usage ```bash # Publish markdown article (preview mode) npx -y bun ${SKILL_DIR}/scripts/x-article.ts article.md # With custom cover image npx -y bun ${SKILL_DIR}/scripts/x-article.ts article.md --cover ./cover.jpg # Actually publish npx -y bun ${SKILL_DIR}/scripts/x-article.ts article.md --submit ``` ## Markdown Format ```markdown --- title: My Article Title cover_image: /path/to/cover.jpg --- # Title (becomes article title) Regular paragraph text with **bold** and *italic*. ## Section Header More content here.  - List item 1 - List item 2 1. Numbered item 2. Another item > Blockquote text [Link text](https://example.com) \`\`\` Code blocks become blockquotes (X doesn't support code) \`\`\` ``` ## Frontmatter Fields | Field | Description | |-------|-------------| | `title` | Article title (or uses first H1) | | `cover_image` | Cover image path or URL | | `cover` | Alias for cover_image | | `image` | Alias for cover_image | ## Image Handling 1. **Cover Image**: First image or `cover_image` from frontmatter 2. **Remote Images**: Automatically downloaded to temp directory 3. **Placeholders**: Images in content use `XIMGPH_N` format 4. **Insertion**: Placeholders are found, selected, and replaced with actual images ## Markdown to HTML Script Convert markdown and inspect structure: ```bash # Get JSON with all metadata npx -y bun ${SKILL_DIR}/scripts/md-to-html.ts article.md # Output HTML only npx -y bun ${SKILL_DIR}/scripts/md-to-html.ts article.md --html-only # Save HTML to file npx -y bun ${SKILL_DIR}/scripts/md-to-html.ts article.md --save-html /tmp/article.html ``` JSON output: ```json { "title": "Article Title", "coverImage": "/path/to/cover.jpg", "contentImages": [ { "placeholder": "XIMGPH_1", "localPath": "/tmp/x-article-images/img.png", "blockIndex": 5 } ], "html": "<p>Content...</p>", "totalBlocks": 20 } ``` ## Supported Formatting | Markdown | HTML Output | |----------|-------------| | `# H1` | Title only (not in body) | | `## H2` - `###### H6` | `<h2>` | | `**bold**` | `<strong>` | | `*italic*` | `<em>` | | `[text](url)` | `<a href>` | | `> quote` | `<blockquote>` | | `` `code` `` | `<code>` | | ```` ``` ```` | `<blockquote>` (X limitation) | | `- item` | `<ul><li>` | | `1. item` | `<ol><li>` | | `` | Image placeholder | ## Workflow 1. **Parse Markdown**: Extract title, cover, content images, generate HTML 2. **Launch Chrome**: Real browser with CDP, persistent login 3. **Navigate**: Open `x.com/compose/articles` 4. **Create Article**: Click create button if on list page 5. **Upload Cover**: Use file input for cover image 6. **Fill Title**: Type title into title field 7. **Paste Content**: Copy HTML to clipboard, paste into editor 8. **Insert Images**: For each placeholder (reverse order): - Find placeholder text in editor - Select the placeholder - Copy image to clipboard - Paste to replace selection 9. **Review**: Browser stays open for 60s preview 10. **Publish**: Only with `--submit` flag ## Example Session ``` User: /post-to-x article ./blog/my-post.md --cover ./thumbnail.png Claude: 1. Parses markdown: title="My Post", 3 content images 2. Launches Chrome with CDP 3. Navigates to x.com/compose/articles 4. Clicks create button 5. Uploads thumbnail.png as cover 6. Fills title "My Post" 7. Pastes HTML content 8. Inserts 3 images at placeholder positions 9. Reports: "Article composed. Review and use --submit to publish." ``` ## Troubleshooting - **No create button**: Ensure X Premium subscription is active - **Cover upload fails**: Check file path and format (PNG, JPEG) - **Images not inserting**: Verify placeholders exist in pasted content - **Content not pasting**: Check