name: wechat-mp-publish description: General workflow for creating, updating, reviewing, and safely publishing WeChat Official Account drafts in a logged-in editor session. Use it when a task involves filling metadata, importing article body content, setting a cover image, saving a draft, inspecting layout, or publishing only after explicit confirmation. license: MIT
WeChat MP Publish
Overview
Use this skill to create, update, inspect, and publish WeChat Official Account articles in a stable and repeatable way inside an already logged-in editor session.
This skill does not assume any personal author name, summary style, local directory layout, or private media-library workflow.
Supported Inputs
- A local Markdown article file.
- Prebuilt HTML body content.
- An existing WeChat Official Account draft that only needs partial updates.
- Optional title, author, summary, and cover image.
Preconditions
- Use a persistent browser session that is already logged in to the WeChat Official Account backend.
- Confirm the article body source and whether optional fields such as title, author, summary, and cover image have been provided.
- Final publishing is an external action. Do not click the final publish button without explicit current-turn confirmation from the user.
Standard Workflow
1. Fill Basic Metadata
- The title is required and should be written explicitly or updated to match the user's intended title.
- Fill the author field only when the user has provided an author name. Otherwise keep the existing value or leave it empty.
- Write a summary only when it has been provided or clearly confirmed. Do not rewrite it into promotional platform copy.
2. Import the Article Body
- Prefer
scripts/markdown_to_wechat_html.pyto convert local Markdown into HTML suitable for editor import. - If the body is already valid HTML, skip conversion and write it directly into the editor.
- Do not rely on normal paste behavior. Call the editor instance's
replaceAllContentmethod directly. - To locate the editor instance, start from
.view.rich_media_content.autoTypeSetting24psectionand walk upward through Vue parents until you find an object withreplaceAllContent.
Reusable browser snippet:
const editorRoot = document.querySelector('.view.rich_media_content.autoTypeSetting24psection');
let vm = editorRoot && editorRoot.__vue__;
for (let i = 0; i < 6 && vm && !vm.replaceAllContent; i++) vm = vm.$parent;
if (!vm || !vm.replaceAllContent) throw new Error('WeChat editor instance not found');
vm.replaceAllContent(html);
3. Set the Cover Image
- Only handle the cover image when the user provides one or explicitly asks to replace it.
- Use only visible, official UI entry points: click the cover area, then choose from the media library or another visible platform option.
- Do not expose or manipulate hidden
input[type=file]elements. That can corrupt page state and leave duplicate covers or temporary upload controls behind. - After upload and crop confirmation, return to the editor and confirm that the left-side article card shows the correct cover.
4. Save the Draft
- Save after each major step. In most cases, save at least twice.
- Save once after the first complete pass of body content and cover image.
- Save again after layout review and any fixes.
- After saving, check the history panel and confirm that a new manual save record appears.
5. Inspect Layout
Check at least three areas:
- Top: title, author, subheadings, opening paragraph, and cover card.
- Middle: paragraph density, heading visibility, and any accidental bolding, indentation, or editor residue.
- Bottom: references, lists, trailing blank lines, duplicate covers, duplicate images, or leftover upload controls.
Take screenshots when needed. Do not rely on DOM text alone.
6. Perform Partial Updates Carefully
- If the user asks to change only the title, summary, author, cover image, or a few paragraphs, do not overwrite the full article body.
- Before editing part of an existing draft, inspect its current state and decide whether a full replacement or an in-editor patch is safer.
- If the existing draft already contains manually arranged images, quote blocks, separators, or other hand-tuned formatting, evaluate the risk of losing that work before replacing the whole body.
7. Publish Only After Explicit Confirmation
- Enter the publish dialog only after the user explicitly says to publish now.
- If the publish flow shows secondary confirmations, verify the normal options but do not alter the user's intent.
- If the platform raises a warning, blocks the content, or reveals a formatting problem, stop instead of forcing publication.
Constraints and Troubleshooting
- If a temporary “Choose File” style control appears near the top of the page, a hidden upload control was likely manipulated earlier. Clean it up before saving again.
- A generated cover preview node does not guarantee that the cover has actually been applied. Trust the real display in the editor card and cover area.
- If a references section becomes fully bold, list items collapse together, or blank lines expand unexpectedly, fix the body before publishing.
- Do not assume any fixed author name, default summary template, private directory layout, or previous session state.
Body Conversion Script
Usage:
python3 scripts/markdown_to_wechat_html.py /path/to/article.md > /tmp/wechat_article_body.html
cat /path/to/article.md | python3 scripts/markdown_to_wechat_html.py - > /tmp/wechat_article_body.html
This script generates simplified HTML suitable for replaceAllContent, preserving:
- heading levels
- normal paragraphs
- unordered and ordered lists
- bold, italic, links, and inline code
It does not attempt full rich-text fidelity. If the article contains tables, footnotes, or deeply nested structures, review the imported output manually.