Markdown to WeChat Public Account HTML converter
Project description
Xie
Convert Markdown to WeChat-compatible HTML with a single command. Works as a CLI tool, Python library, or web service.
Xie (写) means "to write" in Chinese.
Why
If you write in Markdown and publish to WeChat, you know the pain of formatting. WeChat only accepts a limited subset of HTML, so most Markdown-to-HTML converters produce code that just won't paste correctly.
Xie handles this for you. It outputs clean, WeChat-compatible HTML with proper inline styles that paste directly into the WeChat editor.
Quick Start
# Install
pip install xie
# Convert a file
xie convert test.md -o test.html
# Or pipe content
echo "# Hello" | xie
Installation
# From PyPI
pip install xie
# With web support
pip install xie[all]
# From source
git clone https://github.com/cycleuser/xie.git
cd xie
pip install -e .
Usage
CLI
# Basic conversion
xie convert test.md -o test.html
# With standalone document (includes title, author, styles)
xie convert test.md --standalone --title "My Post" --author "John" -o test.html
# JSON output
xie convert test.md --json
Python Library
from xie import convert_markdown_to_wechat
result = convert_markdown_to_wechat("# Hello\n\nThis is **bold** text")
if result.success:
print(result.data['html'])
Web Service
# Start web server
xie web --port 5000
Open http://localhost:5000 in your browser. Write Markdown on the left, see the WeChat preview on the right, and click "Copy" to grab formatted HTML ready to paste.
Features
- Full Markdown support: headers, bold, italic, links, images, code blocks, tables, blockquotes, lists
- Syntax highlighting for code blocks with 100+ languages (Pygments)
- LaTeX math via
$inline$and$$block$$syntax - WeChat-compatible output: all styles inline, no external CSS
Supported Syntax
# Headers **bold** *italic* ~~strikethrough~~
[links](url)  `code` ```language blocks
> quotes - lists 1. lists | tables |
$math$ $$block math$$
Example
Input (test.md):
# 一级标题
## 二级标题
**加粗**
* 分点1
* 分点2
> 引用
$$
\Sigma_e^t= \frac{1}{2}
$$
```python
print("hello")
Output: WeChat-compatible HTML with inline styles.
## Requirements
- Python 3.8+
- mistune (Markdown parsing)
- Pygments (code highlighting)
- Flask (optional, for web server)
## License
GPLv3
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file xie-1.0.3.tar.gz.
File metadata
- Download URL: xie-1.0.3.tar.gz
- Upload date:
- Size: 153.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f8f046d401beb66155a6f366a0e0749f0ac6fc9b6ddd1ffd14f6109b2978c541
|
|
| MD5 |
b3506610d4df941a2999a51c70fb31d5
|
|
| BLAKE2b-256 |
8ca5d31e1895195f2e5fd160397c4e330f6697738191cc1f4618776207bd4716
|
File details
Details for the file xie-1.0.3-py3-none-any.whl.
File metadata
- Download URL: xie-1.0.3-py3-none-any.whl
- Upload date:
- Size: 31.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
15df58776c39614b439f396942a168e64a097f838db4885dc183c52a5d948289
|
|
| MD5 |
13d29b8a597882c7c032a113666bdc23
|
|
| BLAKE2b-256 |
e8c21d895d78f6630ec1c23c3cc774e3524d37de3cd183c6be6aa153286fbc3c
|