wechat-html-normalizer

Inline computed CSS into WeChat article HTML using Chromium and remove scripts, styles, and divs.

5|1|Updated Jul 31, 2026
One-click install
npx skills add https://github.com/shiker1996/wechat-editroom --skill wechat-html-normalizer-shiker1996
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: wechat-html-normalizer
Source: https://github.com/shiker1996/wechat-editroom/tree/main/skills/wechat-html-normalizer
Command: npx skills add https://github.com/shiker1996/wechat-editroom --skill wechat-html-normalizer-shiker1996

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires puppeteer, and includes scripts (resource) components.

What problem does it solve? WeChat Official Account articles lose their styling when copied into the editor because external stylesheets and style tags are stripped. This Skill deterministically computes the CSS cascade in Chromium and writes styles inline so the article renders correctly after paste. ## Core Features & Use Cases - CSS Inlining via Chromium: Computes the full CSS cascade in a headless browser and writes allowed computed styles into each element's inline style attribute. - Sanitization: Removes all style tags, stylesheet links, scripts, iframes, forms, event handler attributes, and converts divs into section or span elements. - Fidelity Checks: Verifies text, links, and images are unchanged before writing output, and blocks remote stylesheet loading entirely. - Use Case: After drafting a WeChat article HTML with embedded styles, run the normalizer to produce a copy-paste-ready article.ai.html that survives the WeChat editor without style loss. ## Quick Start Run the normalize-html script with node, passing the draft HTML file and the desired output path, to produce a fully inlined WeChat-ready HTML file.

Frequently Asked Questions about wechat-html-normalizer

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I inline CSS into HTML for WeChat articles?

Run the normalize-html.mjs script with Node.js, passing the draft HTML and output path. It opens the file in headless Chromium via Puppeteer, computes the CSS cascade, and writes allowed computed styles into each element's inline style attribute.

Why do WeChat articles lose styling after copy and paste?

The WeChat editor strips style tags and external stylesheets, so only inline styles survive. This normalizer moves all computed styles inline and removes style tags, scripts, and divs so the pasted article keeps its appearance.

Can the normalizer load remote stylesheets from URLs?

No. Remote stylesheets are explicitly rejected and the script exits with an error listing the URLs. All CSS must be embedded in the draft's style tag or inline styles before normalization, and network requests are blocked during rendering.

What happens to div elements during HTML normalization?

Divs are replaced based on their computed display value: block-level divs become section elements and inline divs become span elements. All attributes and children are preserved during the conversion.

Why does normalization fail with a content integrity error?

The script compares visible text, link count, and image count before and after processing. If they differ, it aborts with a content_integrity_mismatch error to prevent silent content loss, so check the draft for unusual markup.