wechat-article-html
Skill1 starsChanged 3 months agoMITView on GitHub
Generate WeChat Official Account (公众号) articles as self-contained HTML files with inline CSS, optimized for mobile reading and direct paste into the WeChat editor. This skill should be used when the user asks to write, create, or format a 公众号文章, 微信公众号文章, WeChat article, or any HTML content intended for the WeChat Official Account editor. Covers the full design system: color palette, typography, chapter headings, cards, tables, image embedding, and the contact/QR-code footer. All styles are inline — no external CSS, no head or body wrapper tags.
1 other project uses a version of this.
Adopted by
Most recently taken up by
- AthenDrakomin-hub/agent-skillstheir own version, first seen Nov 1, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- AthenDrakomin-hub/agent-skills★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
The file
Show its rules and text
We split this skill into the rules it gives an agent
22 rules. About 0 are common, 6 are distinctive, and 16 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈6
Distinctive · estimate
This author's own choices. Worth a look.
16
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 29
All CSS inline: Every element carries its own style="..." attribute.
- Very specific: line 36
Tag balance: Every <section> must have a matching </section>.
- Distinctive: line 37
Verify tag balance before presenting the file.
- Very specific: line 125
Use <!-- ====== 第N章 ====== --> HTML comments as section markers (helps with editing and reordering later)
- Very specific: line 216
Use border-collapse: separate (NOT collapse) — this allows border-radius and overflow: hidden to work on the table
- Very specific: line 218
Always use table-layout: fixed with <colgroup> for predictable column widths
- Very specific: line 221
Every <td> must have text-align: center.
- Very specific: line 261
Always use width: 100%; max-width: Npx.
- Distinctive: line 327
Use Python to handle large base64 strings (avoid heredoc quoting issues)
- Very specific: line 337
If source is DOCX: use python-docx to extract paragraphs, tables, and images
- Very specific: line 338
If source is PPTX: use python-pptx to extract slide text and images, map images to their slide context
- Distinctive: line 340
If source is plain text or notes: parse directly
- Distinctive: line 350
Write the complete HTML file using the design system above
- Distinctive: line 351
Use Python script for image base64 embedding (to avoid shell quoting issues)
- Very specific: line 352
Verify tag balance: count <section vs </section>, <table vs </table>
- Very specific: line 367
Use present_files to open the HTML in a live preview panel.
- Very specific: line 372
If the user needs a cover image (封面图), use the ImageGen tool:
- Very specific: line 397
When interpreting a published paper (esp.
- Distinctive: line 411
Always downscale to ~1000px width + JPEG q80 before base64 embedding to stay under the ~2MB paste limit (6 figures ≈ 1.3MB base64 total is …
- Very specific: line 416
When generating articles via Python scripts, ASCII double quotes " inside Chinese content strings terminate the Python string and cause …
- Very specific: line 418
Write Chinese quotes directly as “ ” in source, or
- Very specific: line 421
NOT preceded by = (attribute) and NOT followed by space/>// (attribute close), which cleanly skips all style="..." attributes.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
WeChat Official Account Article HTML Generator
Overview
Generate a single self-contained HTML file that can be copy-pasted directly into
the WeChat Official Account (公众号) web editor. The WeChat editor strips
<head>, <body>, external stylesheets, and <script> tags, so every style
must be inline. The output is a fragment of nested <section> elements — never
a full HTML document.
When to Use
- User asks to write a 公众号文章 / 微信公众号文章 / WeChat article
- User provides source materials (DOCX, PPTX, PDF, notes) and wants a formatted WeChat article
- User asks to "排版" (format/layout) content for WeChat
- User wants HTML that can be pasted into the WeChat editor
Core Constraints
- No document-level tags: No
<!DOCTYPE>,<html>,<head>, or<body>. The entire output is a fragment starting with the outer<section>wrapper. - All CSS inline: Every element carries its own
style="..."attribute. No<style>blocks, no class names, no external stylesheets. - Max-width 677px: The outer wrapper uses
max-width: 677px(WeChat's content area width on desktop). Mobile users see full width. - No JavaScript: The WeChat editor strips all
<script>tags. - No external resources: No
<link>, no external fonts, no CDN URLs. Images must be base64data:URIs or uploaded to WeChat's media library. - Tag balance: Every
<section>must have a matching</section>. Verify tag balance before presenting the file.
Design System
Color Palette
| Role | Color | Hex |
| Primary (dark) | Deep navy blue | #1a5276 |
| Accent | Teal green | #16a085 |
| Primary light bg | Light blue | #ebf5fb |
| Accent light bg | Light teal | #e8f6f3 |
| Warning/highlight | Orange | #e67e22 |
| Warning light bg | Light orange | #fef5e7 |
| Premium accent | Gold | #f1c40f |
| Danger/negative | Red | #c0392b |
| Body text | Dark gray | #2c3e50 |
| Secondary text | Gray | #7f8c8d |
| Border | Light gray | #d5dbdb |
| Alt row bg | Very light blue | #f8fbfd |
| Neutral card bg | Light gray | #f4f6f7 |
| Header gradient | Navy → Teal (works in WeChat on content-bearing sections) | linear-gradient(135deg, #1a5276 0%, #16a085 100%) |
| Divider line | Navy (draw as h2 border-bottom, never empty div) | #1a5276 |
Typography
- Font stack:
-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif - Base font size: 16px
- Base line height: 1.85
- Body text color:
#2c3e50 - Word break:
break-word - Heading sizes: H1 26px, H2 20px, card title 16px
- Small text: 12-13px for captions and secondary info
- Letter spacing: 2-3px for decorative labels (e.g., "CONTACT US")
Spacing (Mobile-First)
- Chapter horizontal margin:
8pxleft and right (NOT 15px+ — that wastes screen space on mobile) - Chapter bottom margin:
28pxbetween chapters (generous breathing room) - Card padding:
14px 16px(compact but readable) - Card header padding:
12px 16px - Card bottom margin:
14pxbetween stacked cards - Table cell padding:
10px 8px(compact for mobile) - Image card padding:
14px 12px
HTML Structure
Outer Wrapper
<section style="max-width: 677px; margin: 0 auto; padding: 0; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif; font-size: 16px; line-height: 1.85; color: #2c3e50; word-break: break-word;">
<!-- All content goes here -->
</section>Cover / Title Section
<section style="background-color: #1a5276; padding: 40px 20px 35px; border-radius: 0 0 16px 16px; text-align: center; margin-bottom: 10px;">
<p style="margin: 0 0 12px; font-size: 13px; letter-spacing: 3px; color: #aed6f1; font-weight: 500;">CATEGORY · 专题</p>
<h1 style="margin: 0; font-size: 26px; font-weight: bold; color: #ffffff; line-height: 1.5;">主标题<br/>副标题</h1>
<p style="margin: 18px 0 0; font-size: 14px; color: #aed6f1;">补充说明文字</p>
</section>Lead / Introduction Block
<section style="background: #ebf5fb; border-left: 5px solid #1a5276; margin: 22px 8px 30px; padding: 18px 16px; border-radius: 0 10px 10px 0;">
<p style="margin: 0; font-size: 15px; line-height: 1.9; color: #1a5276;">导语正文...</p>
</section>Chapter Heading (with number badge)
<!-- ====== 第N章 ====== -->
<section style="margin: 30px 8px 28px;">
<h2 style="display: flex; align-items: center; font-size: 20px; color: #1a5276; margin: 0 0 20px; font-weight: bold; border-bottom: 3px solid #1a5276; padding-bottom: 12px;">
<span style="display: inline-block; width: 32px; height: 32px; line-height: 32px; text-align: center; background: #1a5276; color: #fff; border-radius: 50%; font-size: 16px; margin-right: 12px; flex-shrink: 0;">1</span>
章节标题
</h2>
<!-- Chapter content -->
</section>Key rules for chapter headings:
- Use
<!-- ====== 第N章 ====== -->HTML comments as section markers (helps with editing and reordering later) - The number badge is a 32px circle with the chapter number
- ⚠️ NEVER use a separate empty
<div>for the divider line — WeChat editor converts near-empty<div>s to<p>and drops theirheight, so the line disappears on paste (only a blank gap remains). Instead, draw the line as the heading's ownborder-bottom: 3px solid #1a5276; padding-bottom: 12px;— the heading has real text content, so the border always survives. margin: 30px 8px 28pxgives generous top/bottom spacinglinear-gradientIS supported by WeChat editor (verified) — safe to use on sections with real content (cover header, contact footer). The problem was never the gradient; it was the empty div structure.
Card Component (white card with header + body + footer)
<section style="background: #fff; border: 1px solid #d5dbdb; border-radius: 12px; padding: 0; margin: 0 0 14px; overflow: hidden;">
<!-- Card header -->
<section style="background: #ebf5fb; padding: 12px 16px; border-bottom: 1px solid #d5dbdb;">
<p style="margin: 0; font-size: 16px; font-weight: bold; color: #1a5276;">卡片标题</p>
<p style="margin: 4px 0 0; font-size: 12px; color: #5d6d7e;">副标题/描述</p>
</section>
<!-- Card body -->
<section style="padding: 14px 16px;">
<p style="margin: 0; font-size: 14px; line-height: 1.8;">正文内容...</p>
</section>
<!-- Card footer (optional) -->
<section style="background: #e8f6f3; padding: 12px 16px; border-top: 1px solid #d5dbdb;">
<p style="margin: 0; font-size: 13px; color: #16a085; line-height: 1.7;"><strong>提示:</strong>总结说明</p>
</section>
</section>Header color variants:
- Blue header:
background: #ebf5fb+ textcolor: #1a5276 - Teal header:
background: #e8f6f3+ textcolor: #16a085 - Orange header:
background: #fef5e7+ textcolor: #e67e22
Step List (numbered steps with circular badges)
<section style="display: flex; align-items: flex-start; margin-bottom: 14px;">
<span style="display: inline-block; min-width: 24px; height: 24px; line-height: 24px; text-align: center; background: #1a5276; color: #fff; border-radius: 50%; font-size: 12px; margin-right: 12px; flex-shrink: 0; margin-top: 2px;">1</span>
<p style="margin: 0; font-size: 14px; line-height: 1.8;"><strong>步骤名</strong>:步骤描述</p>
</section>Step badge color rotation:
- Steps 1, 3, 5:
background: #1a5276(primary) - Steps 2, 4:
background: #16a085(accent) - Or use a single accent color for all steps in a subsection
Info Tip Block
<section style="background: #ebf5fb; border-radius: 10px; padding: 14px 16px; border-left: 4px solid #1a5276; margin: 0 0 16px;">
<p style="margin: 0; font-size: 13px; line-height: 1.8; color: #1a5276;"><strong>💡 提示:</strong>提示内容</p>
</section>Border-left color variants: #1a5276 (blue), #16a085 (teal), #e67e22 (orange), #8e44ad (purple)
Data Table (with fixed layout and centered cells)
<table style="width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; margin: 0 0 12px; box-shadow: 0 2px 8px rgba(0,0,0,0.08); border-radius: 8px; overflow: hidden; table-layout: fixed;">
<colgroup>
<col style="width: 25%;"/>
<col style="width: 44%;"/>
<col style="width: 31%;"/>
</colgroup>
<thead>
<tr>
<th style="padding: 12px 8px; text-align: center; font-weight: bold; background: #1a5276; color: #fff; border-bottom: 1px solid #154360;">列标题1</th>
<th style="padding: 12px 8px; text-align: center; font-weight: bold; background: #1a5276; color: #fff; border-bottom: 1px solid #154360;">列标题2</th>
<th style="padding: 12px 8px; text-align: center; font-weight: bold; background: #16a085; color: #fff; border-bottom: 1px solid #138d75;">推荐列</th>
</tr>
</thead>
<tbody>
<tr>
<td style="padding: 12px 8px; border-bottom: 1px solid #e8e8e8; font-weight: bold; color: #1a5276; background: #fff; text-align: center; vertical-align: middle;">内容</td>
<td style="padding: 12px 8px; border-bottom: 1px solid #e8e8e8; line-height: 1.7; background: #fff; vertical-align: middle;">内容</td>
<td style="padding: 12px 8px; border-bottom: 1px solid #e8e8e8; line-height: 1.7; color: #16a085; background: #fff; vertical-align: middle;">内容</td>
</tr>
<!-- Alternating row: background: #f8fbfd -->
<!-- Last row: remove border-bottom -->
</tbody>
</table>Critical table rules:
- Use
border-collapse: separate(NOTcollapse) — this allowsborder-radiusandoverflow: hiddento work on the table - Always use
table-layout: fixedwith<colgroup>for predictable column widths - Apply background color to each
<th>individually (NOT on<tr>) — the WeChat editor sometimes drops<tr>styles - Every
<td>must havetext-align: center; vertical-align: middle;for consistent centering - Alternate row backgrounds:
#fffand#f8fbfd - Last row: omit
border-bottom - Recommended column: use
background: #16a085header +color: #16a085text - Highlight "★ 推荐" with a pill badge:
<span style="display: inline-block; margin-top: 4px; background: #16a085; color: #fff; font-size: 10px; padding: 2px 8px; border-radius: 10px;">★ 推荐</span>
Key-Value Table (compact parameter list)
<section style="background: #f4f6f7; border-radius: 10px; padding: 16px; margin: 0 0 16px;">
<table style="width: 100%; border-collapse: collapse; font-size: 13px; table-layout: fixed;">
<colgroup>
<col style="width: 25%;"/>
<col style="width: 75%;"/>
</colgroup>
<tr style="background: #fff;">
<td style="padding: 10px 6px; border-bottom: 1px solid #e0e0e0; font-weight: bold; color: #1a5276; text-align: center; vertical-align: middle;">标签</td>
<td style="padding: 10px 6px; border-bottom: 1px solid #e0e0e0; text-align: center; vertical-align: middle;">值</td>
</tr>
<tr style="background: #f8fbfd;">
<td style="padding: 10px 6px; border-bottom: 1px solid #e0e0e0; font-weight: bold; color: #1a5276; text-align: center; vertical-align: middle;">标签</td>
<td style="padding: 10px 6px; border-bottom: 1px solid #e0e0e0; text-align: center; vertical-align: middle;">值</td>
</tr>
</table>
</section>Image Card (with caption)
<section style="background: #fff; border: 1px solid #d5dbdb; border-radius: 12px; padding: 14px 12px; margin: 0 0 16px;">
<p style="margin: 0 0 10px; font-size: 14px; font-weight: bold; color: #1a5276;">图表标题</p>
<img src="data:image/png;base64,..." alt="图片描述" style="display: block; width: 100%; max-width: 480px; height: auto; margin: 0 auto; border-radius: 6px;"/>
<p style="margin: 10px 0 0; font-size: 12px; color: #7f8c8d; text-align: center; line-height: 1.6;">图注说明文字</p>
</section>Image rules:
- Always use
width: 100%; max-width: Npx; height: auto;for responsive sizing max-widthtypically 420-560px depending on image aspect ratiodisplay: block; margin: 0 auto;for centeringborder-radius: 6px;for rounded corners- Caption:
font-size: 12px; color: #7f8c8d; text-align: center; - Highlight conclusions in accent color:
color: #16a085; font-weight: bold;
Image with background (for emphasis)
linear-gradientworks fine in WeChat editor on sections that contain real content (verified with cover header & contact footer). Preferlinear-gradient(135deg, #ebf5fb, #e8f6f3)for light emphasis bands. Just never use empty/ -only elements to paint decoration — those get stripped.
<section style="background: linear-gradient(135deg, #ebf5fb, #e8f6f3); border-radius: 12px; padding: 16px 12px; margin: 20px 0 8px;">
<p style="margin: 0 0 12px; font-size: 15px; font-weight: bold; color: #1a5276; text-align: center;">🔬 标题</p>
<img src="data:image/png;base64,..." alt="描述" style="display: block; width: 100%; max-width: 560px; height: auto; margin: 0 auto; border-radius: 6px;"/>
<p style="margin: 12px 0 0; font-size: 13px; color: #16a085; text-align: center; line-height: 1.7;"><strong>结论说明</strong></p>
</section>Contact / QR Code Footer
<!-- ====== 联系我们 ====== -->
<section style="margin: 30px 8px 15px;">
<section style="background-color: #1a5276; border-radius: 16px; padding: 28px 20px; text-align: center;">
<p style="margin: 0 0 6px; font-size: 13px; letter-spacing: 2px; color: #aed6f1; font-weight: 500;">CONTACT US</p>
<p style="margin: 0 0 18px; font-size: 20px; font-weight: bold; color: #fff;">关注公众号名称</p>
<!-- QR code -->
<section style="display: inline-block; background: #ffffff; border-radius: 12px; padding: 12px; margin: 0 0 16px;">
<img src="data:image/jpeg;base64,..." alt="二维码" style="display: block; width: 180px; height: 180px; border-radius: 6px;"/>
</section>
<p style="margin: 0 0 18px; font-size: 13px; color: #d1f2eb;">扫码关注公众号 · 获取更多技术干货</p>
<!-- Company intro -->
<section style="background: rgba(255,255,255,0.12); border: 1px solid rgba(255,255,255,0.25); border-radius: 12px; padding: 18px 20px; margin: 0;">
<p style="margin: 0 0 10px; font-size: 15px; font-weight: bold; color: #fff; text-align: center;">关于公司</p>
<p style="margin: 0; font-size: 13px; color: #d1f2eb; line-height: 1.9; text-align: justify;">公司简介正文...</p>
</section>
<p style="margin: 18px 0 0; font-size: 16px; font-weight: bold; color: #f1c40f;">品牌口号</p>
</section>
</section>Bottom Disclaimer
<!-- ====== 底部声明 ====== -->
<section style="margin: 8px 8px 20px; text-align: center;">
<p style="margin: 0; font-size: 12px; color: #95a5a6; line-height: 1.6;">本文内容仅供参考,具体方案请咨询专业人员<br/>© 公司名称 版权所有</p>
</section>Embedding Images as Base64
To embed images from source files (PPTX, DOCX, etc.):
- Extract images using
python-pptxorzipfile+python-docx - Convert to base64:
base64.b64encode(data).decode('utf-8') - Embed as:
<img src="data:image/png;base64,{b64_string}" .../>ordata:image/jpeg;base64,...for JPEG - Use Python to handle large base64 strings (avoid heredoc quoting issues)
Important: Base64 images inflate file size (~1.3x the original binary). If the total HTML exceeds ~2MB, warn the user that the WeChat editor may truncate the paste. Offer to switch to uploaded image URLs as an alternative.
Workflow
1. Extract Source Content
- If source is DOCX: use
python-docxto extract paragraphs, tables, and images - If source is PPTX: use
python-pptxto extract slide text and images, map images to their slide context - If source is plain text or notes: parse directly
2. Plan Article Structure
- Determine chapters and their order (most important/practical content first)
- Decide where images go based on their context in the source
- Plan which content becomes tables vs. cards vs. step lists
3. Generate HTML
- Write the complete HTML file using the design system above
- Use Python script for image base64 embedding (to avoid shell quoting issues)
- Verify tag balance: count
<sectionvs</section>,<tablevs</table>
4. Review and Adjust
Common adjustments users request:
- "页边距太大" → reduce horizontal margins from 15px to 8px
- "太密集" → increase chapter bottom margin from 8px to 28px
- "表格表头没底色/文字没居中" → check that background is on each
<th>, not on<tr>; useborder-collapse: separate; addtext-align: center; vertical-align: middleto every cell - "表格列宽不合理" → adjust
<colgroup>width percentages - "加上二维码和简介" → add contact section per the template above
5. Present to User
Use present_files to open the HTML in a live preview panel. Tell the user to
Ctrl+A → Ctrl+C in the preview, then Ctrl+V in the WeChat editor.
Generating Cover Images
If the user needs a cover image (封面图), use the ImageGen tool:
- Size:
1536x1024(WeChat cover ratio ~2.35:1) - Style: match the article's color palette (deep blue → teal gradient)
- Content: abstract, professional, minimal text or no text
- The cover image is uploaded separately in the WeChat editor, not embedded in the HTML
Quick Reference: Common Mistakes
| Mistake | Fix |
<tr style="background: ..."> — WeChat drops it | Put background on each <th>/<td> individually |
border-collapse: collapse — no rounded corners | Use border-collapse: separate + overflow: hidden |
| Large margins (15px+) — wasted mobile space | Use 8px horizontal margins |
| No spacing between chapters | Add margin: 30px 8px 28px to chapter wrappers |
<td> text not centered | Add text-align: center; vertical-align: middle; to every cell |
| External font references | Use only system fonts in the font stack |
<html>/<head>/<body> tags | Remove them — output a fragment only |
| Images too wide on mobile | width: 100%; max-width: Npx; height: auto; |
No table-layout: fixed | Always add it + <colgroup> for predictable widths |
linear-gradient assumed broken | It actually works in WeChat editor (verified) — keep it on sections with real content (cover header, contact footer). The real pitfall is empty elements, not gradients |
Divider line drawn with a separate empty <div> — disappears on paste (only a blank gap remains) | Draw the line as the heading's own border-bottom: 3px solid #1a5276; padding-bottom: 12px; — the heading has text content, so it always survives. Never use empty/ -only divs for decoration |
Sourcing Original Figures for Paper-Interpretation Articles (论文解读)
When interpreting a published paper (esp. Science/Nature/Cell), users often want the paper's OWN figures, not generated illustrations. Reliable sourcing order:
- Preprint mirror (best): Most papers have a bioRxiv/medRxiv preprint with
CC-BY license. Figure URLs follow a predictable pattern:
https://www.biorxiv.org/content/<DOI>/<hash>/F{n}.large.jpg(e.g.https://www.biorxiv.org/content/biorxiv/early/2025/09/17/2025.09.12.675911/F1.large.jpg?width=800). Get the exact URLs + figure captions via WebFetch on the.fullpage. - Wayback Machine fallback (bioRxiv Cloudflare 429 rate-limits aggressive
downloads): query
http://web.archive.org/cdx/search/cdx?url=<page-or-asset>*&output=jsonfor snapshot timestamps, then downloadhttps://web.archive.org/web/<ts>id_/<url>?width=800. IMPORTANT: Wayback may return gzip-compressed bodies — check for\x1f\x8bmagic andgzip.decompressbefore validating the JPEG header (\xff\xd8). - News/media coverage of the paper often embeds the abstract figure / key panels.
- Always downscale to ~1000px width + JPEG q80 before base64 embedding to stay under the ~2MB paste limit (6 figures ≈ 1.3MB base64 total is safe).
Chinese Quotation Marks Pitfall (中文引号)
When generating articles via Python scripts, ASCII double quotes " inside
Chinese content strings terminate the Python string and cause SyntaxError. Rules:
- Write Chinese quotes directly as
“ ”in source, or - Fix with a whitelist of exact phrases, or
- For an HTML template region: convert
"to“/”(stateful toggle) ONLY when NOT preceded by=(attribute) and NOT followed by space/>//(attribute close), which cleanly skips allstyle="..."attributes. - Validate: no ASCII
"adjacent to CJK chars; count of“== count of”.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

