Take existing HTML content (file, URL, or pasted HTML) and publish it directly to WeChat Official Account draft box. No file conversion, no web scraping — ju...
Design & media
Wechat Markdown Html Render
Try itRender Markdown to polished HTML with WeChat-friendly typography and explicit theme layering. Use when users ask to convert Markdown articles to formatted HT...
What it does
Render Markdown to polished HTML with WeChat-friendly typography and explicit theme layering. Use when users ask to convert Markdown articles to formatted HTML, replicate or analyze wechat.bmpi.dev theme behavior, or require text theme and code-block highlighting to be independently switchable.
The skill document
Wechat Markdown Html Render
Overview
Render Markdown files into standalone HTML with separate style layers: basic-theme, text-theme, code-theme, and font-theme.
Use scripts/render-markdown-html.js to generate deterministic output and keep code-block visuals independent from text theme.
Workflow
- Inspect site-mechanism notes in
references/wechat-bmpi-analysis.mdwhen the request mentionswechat.bmpi.dev. - Install dependencies in the skill folder:
npm install
- Render Markdown, you can pick a text-theme and code-theme and font-theme according to article contents:
node scripts/render-markdown-html.js \
--input /path/to/input.md \
--output /path/to/output.html \
--text-theme geek-black \
--code-theme wechat \
--font serif
- Validate that the output includes the four style blocks and that
--text-themeand--code-themecan be changed independently.
Script Interface
--input: Markdown source file path (required)--output: HTML output file path (required)--text-theme:normal | orange-heart | geek-black | minimal-dark | gold-sea(optional, defaultgold-sea)--code-theme:wechat | atomOneDark | atomOneLight | monokai | github | vs2015 | xcode(optional, defaultwechat)--font:serif | sans(optional, defaultserif)--title: Custom HTML title (optional)--custom-css-file: CSS file used only when--text-theme custom(optional)
Notes
- The script intentionally scopes markdown typography under
#niceand syntax highlighting under.hljs/pre codeselectors so code theme remains independent. - The output is standalone HTML and can be copied into downstream editors.
WeChat MP editor list normalization (built into the renderer)
The script applies two post-processing rules specifically to survive the WeChat 公众号 editor's non-standard HTML ingester. These are NOT optional — they're enabled for every render — but worth knowing when reviewing output or extending the script:
-
Flatten
…for leaf items. The MP editor drops the list marker (the1. 2. 3.numbers, or•bullets) when acontains a block-level child like, and also inserts an extra blank row per item from the section's vertical margins. Fix: forthat does NOT contain a nested/, the renderer unwraps the inner section and merges its typographic styles directly onto the. Items with nested sub-lists keep the section wrapper (their sub-list layout depends on it). -
**Zero whitespace at
/boundaries and between siblings.** The MP editor treats whitespace text nodes betweensiblings (and at the start/end of a/) as additional EMPTY list items, producing numbered/bulleted blank rows interleaved with the real ones. Newline-only stripping is NOT enough — spaces and tabs leak through and still trigger the bug. The renderer collapses all whitespace at those three positions:→ first,→ next, last→(and the same for ``).
Symptoms in the MP editor preview when either rule fails:
- Rule 1 broken → no
1. 2. 3.markers, items show as plain paragraphs separated by blank rows. - Rule 2 broken →
1. (blank) / 2. real / 3. (blank) / 4. real / …— count of visual rows ≈2N + 1forNreal items.
If you copy text out of the MP editor and the markers are missing, that's a clipboard artifact (markers are CSS ::marker pseudo-elements, not text nodes) — verify in the editor's visual preview, not the copied text.
Related skills
Turn Markdown into WeChat Official Account HTML, covers, infographics, and image posts via the md2wechat CLI.
Independently turn an article into WeChat Official Accounts compatible Markdown/HTML, present built-in theme choices, and publish to WeChat as a draft or for...
Convert Markdown articles into WeChat Official Account friendly inline-style HTML with 12 visual themes, rich-copy preview, macOS rich clipboard support, con...
公众号排版|Markdown 转 HTML|排版主题|段落样式 — 公众号一键排版工具,Markdown 文稿转微信后台可粘贴 HTML,多主题、多字号、段落样式切换,所见即所得。面向公众号编辑、独立作者、排版岗。触发词:「排版」「版式」「美化」「格式化」「字号」「段落样式」「换个排版主题」「换个版式」「转 HTML」「弄好看点」「调整格式」。换预设包/品牌包/整套主题配色请走 aws-wechat-article-assets;需要多环节串联(写+审+排+配图+发)请走 aws-wechat-article-main。
将 Markdown 文章转换为微信公众号兼容的纯 HTML 格式。当用户要求"转成微信格式"、"生成公众号文章 HTML"、"排版到微信草稿箱"、"微信粘贴格式"时触发。输出带内联样式的纯 HTML,微信编辑器可直接渲染,无需额外适配。支持标题、段落、列表、粗体、行内代码、表格、引用块、代码块、配图的完整转换。