Communitygithub.com

wp-x/wechat-layout

WeChat Official Account formatting Agent Skill: 8 color themes × 9 design styles × 6 article presets, outputting HTML directly pasteable into the WeChat editor.

What is wechat-layout?

This AI agent skill is designed to transform any user-provided document content (text, Markdown, or file) into a unified, aesthetically pleasing HTML format that can be directly pasted into the WeChat Official Account (公众号) editor. It combines three orthogonal dimensions for styling: theme (color palette), style (visual language), and preset (article structure). The skill automatically recommends themes and styles based on content tone (e.g., tech gets a blue theme, lifestyle gets green) and applies consistent formatting rules to ensure compatibility with the WeChat editor's constraints—using inline styles, specific tags, and a `leaf=""` attribute on inner spans to bypass editor filters. It also enforces strict visual hierarchy rules (font size steps, spacing, color levels, highlighting) to maximize scannability and structure readability, producing final HTML code blocks ready for immediate use.

Works with~Claude Code~Codex CLI~Cursor
npx skills add wp-x/wechat-layout

Ask in your favorite AI

Open a new chat with this agent skill pre-loaded.

Documentation

WeChat Official Account All-Purpose Formatting

Converts any user-provided document content into uniform, visually appealing HTML that can be directly pasted into the WeChat Official Account editor.

Workflow

Formatting is achieved by combining three orthogonal dimensions: Theme (color palette, themes.md) × Style (visual language, styles.md) × Preset (article structure, presets.md).

  1. Read Content: Receive the user's text/Markdown/file.
  2. Select Theme & Style:
    • If specified by the user → use directly.
    • If not specified → recommend based on content tone (see tables below), and inform the user of the chosen combination in one sentence without waiting for confirmation. Default style is "Soft Card Style".
  3. Select Article Type Preset (determines component combination tendency, see references/presets.md).
  4. Read references/components.md to get component templates, replace {{tokens}} with the selected palette values from references/themes.md; if the style is not the default, modify the form according to the global override rules in references/styles.md; replace foundational components with signature components directly.
  5. Convert paragraph by paragraph according to the "Content Mapping Rules", output the complete HTML.
  6. Self-check: Verify against "Hard Constraints" to ensure no original text has been omitted.

Theme Recommendations

Content ToneTheme
Health, Lifestyle, Environmental, Growth TipsFresh Green
AI, Tech, Internet, Digital ReviewsTech Blue
Business Analysis, Finance, Industry ReportsBusiness Black & Gold
Food, Travel, Event Previews, PromotionsVibrant Orange
Psychology, Literature, Women's Growth, Paid KnowledgeElegant Purple
Festivals, Chinese Trend, Positive Energy, Major EventsChinese Red
Emotions, Beauty, Mom & Baby, Xiaohongshu-stylePastel Pink
Long-form Deep Reads, Character Features, Minimalist AestheticMinimal Black & White

Style Recommendations

Content ToneStyle
General, Safe, No MistakesSoft Card Style (default)
Trend Culture, Design Circles, Sharp OpinionsNeo-Brutalism
Music, Subculture, Retro CreativityVaporwave
Long-form Deep Reads, Design Critique, Rational RestraintSwiss Internationalism
Traditional Culture, Solar Terms, Poetry, Tea & WineElegant Chinese Style
Programmers, AI Tech, Geek ReviewsRetro Terminal
Parent-Child, Activities, Light-hearted PlayfulMemphis
Character Features, Lifestyle, Brand Soft AdsMagazine Editorial Style
AI Products, SaaS, Tech Release CopyGlassmorphism Gradient
Product Launches, Tool Reviews, Year-in-Review, Big Tech VibeLanding Page (Color Band Section Paradigm)

When a user provides a reference article/screenshot requesting "make it in this style," analyze it using the five-layer dissection process in references/style-lab.md and generate a new style; do not copy pixel values exactly.

Vaporwave, Elegant Chinese Style, Retro Terminal, and Memphis come with their own dedicated color palettes; when one of these is selected, ignore the theme dimension. See the combination suggestion table at the end of styles.md for forbidden combinations.

Content Mapping Rules

Original FeatureComponent to Use
First paragraph of the articleDrop Cap paragraph (if a Lead Card is already used, the first paragraph becomes a normal paragraph; the two are mutually exclusive)
Opening lead/summaryLead Card
Major section switchNumbered Separator (01, 02…) or Heading 1 block; choose one for the entire article: use Numbered Separator for sections without heading text, use Heading 1 block for sections with heading text; the two must not be used consecutively
Heading 1Heading 1 block (automatically append an English subtitle, e.g., WHY IT MATTERS)
Heading 2Heading 2 (left vertical bar)
Heading 3Heading 3 (▍ bold line)
Core conclusions, key concepts (max 2 per paragraph)Highlighted annotation (colored background)
Terms, data, action words (at least 1 per long paragraph)Bold keyword (no background)
Golden quotes, core viewpointsQuote Card or centered emphasis
Core principles, point summaryInfo Card
Steps, processesStep Timeline
Parallel pointsList Card
Two-way comparisonComparison Double Column
Key numbersNumber Highlight
Quotes from others/literatureBlockquote
Q&A contentFAQ component
Tips/warningsTip Bar
CodeCode Block
Image placeholderStandard Image Component (keep original URL; if no image, output <!-- Place image here: xxx --> comment)
Ending summaryKey Points Card
End of articleFollow-up Card (if no Official Account name provided, use generic copy "Tap [Watching]")

Hard Constraints (WeChat Editor Compatibility)

  • All styles must be inline styles; <style> tags, class selectors (except retained WeChat classes like rich_pages wxw-img) are forbidden.
  • All innermost <span> elements directly wrapping text must be written as <span leaf=""> (abbreviated as <span> in component templates; unifiedly add leaf="" when generating HTML). This bypasses the WeChat editor's style filter to prevent styles from being stripped after pasting.
  • position, transform, float (except drop cap's float, which is a verified working usage), id, JS, and external fonts are forbidden.
  • Layout must use only section + p + span; double columns use display: inline-block or table.
  • Images must include class="rich_pages wxw-img" and max-width:100% !important.
  • Font size range: 11px–36px; body text 15px, line height 2.0–2.1, letter-spacing: 0.3px, justified alignment.
  • Outer container: <section> wrapping the entire article, background #ffffff, padding 32px 20px, font stack -apple-system, BlinkMacSystemFont, 'Helvetica Neue', 'PingFang SC', 'Microsoft YaHei', sans-serif.
  • Append the standard ending at the end of the code:
<p style="display: none;"><br/></p>
<section class="_135editor"><mp-style-type data-value="3"></mp-style-type></section>
<p><br/></p>

Visual Hierarchy Specifications (Mandatory for Clear Hierarchy)

The primary goal of formatting is to make the structure obvious at a glance. Self-check item by item:

  1. Font size steps must create clear gaps: Heading 1 22px > Heading 2 17px > Body text 15px > Captions/Sources 13px. Additionally, set an emphasis layer at 18–20px, used only for centered emphasis, Key Points Card, Quote Card (18px), and Number Highlights; these must be centered or placed within cards to avoid confusion with headings. Adjacent levels must differ by ≥ 2px; unify the same level across the whole article; do not add new font sizes (decorative text like badges, capsule labels are excluded from the step system).
  2. Visual weight steps: Heading 1 = card + bold + large font; Heading 2 = left vertical bar + bold, no card; Heading 3 = ▍ prefix bold line, no line or card; body text has no decoration. Adjacent heading levels must never look alike.
  3. Spacing rhythm (proximity principle): Space above a heading must be ≥ 2× the space below (Heading 1: 56px/24px, Heading 2: 44px/18px), ensuring the heading clearly "belongs" to the following text rather than floating in the middle; 20px between paragraphs; ≥ 48px before/after major section switches (Numbered Separator).
  4. Three-tier color system: Heading color (darkest), body main color, secondary text (notably lighter and smaller); use only these three grayscale levels + the theme color across the whole article; do not mix other text colors.
  5. Scan-reading priority, dual-layer annotation (mandatory): A reader should be able to grasp the article's core information just by looking at "headings + highlights + bolds"; this is the formatting pass/fail line.
    • Highlighted annotations (colored background) = core conclusions, key concepts: max 2 per paragraph, covering 5–10% of the total article characters.
    • Bold keywords (no background, using highlight text color) = secondary emphasis, terms, data, action words: Every paragraph over 60 characters must mark at least 1 bold, long paragraphs 2–3, ensuring each screen has a visual anchor.
    • Before output, perform a scan-reading test: Covering the plain text and looking only at annotations, can you retell the article's main thread? If not, go back and add more marks.
    • Quote Card / Key Points Card: max one per screen (approx. 500 characters) to avoid overusing large components.
  6. Long paragraphs must be split: If a single paragraph exceeds 120 characters (about 4 lines), it must be split into two paragraphs or converted to a List Card / Step Timeline; after 3 consecutive plain text paragraphs, insert a visual component (Card, Quote, Number Highlight, or Image placeholder).
  7. Cards are for content, not for headings: Info Cards, List Cards, etc., should only carry "point summary" content; if they appear consecutively, they must be separated by normal paragraphs to avoid the whole screen becoming a blur of cards.
  8. Before output, read through the structure: Collapse the body text, look only at headings and cards; you should be able to reconstruct the article outline. If you can't, the hierarchy has failed and must be reworked.

Preservation Principle

  • Do not delete any text content, do not rewrite semantics (unless the user explicitly requests polishing).
  • Maintain the original logical order and paragraph separation.
  • Large components (Quote Card / Key Points Card) should be used sparingly; at least one normal paragraph must separate two consecutive cards. However, inline annotations (highlights + bolds) are a minimum requirement, not a maximum; follow the "scan-reading priority" rule, and do not skip marks due to restraint.

Output Requirements

  1. Output the complete HTML code block directly, from the outer <section> to the standard ending.
  2. If the user requests saving to a file, write to 排版-{标题}-{主题}-{风格}.html.
  3. After output, explain in 1-2 sentences (in Chinese) the theme, style, and components used, and suggest that the user can re-format with different themes or styles.

Related Skills