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.
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.
# Install
pip install xie
# Convert a file
xie convert test.md -o test.html
# Or pipe content
echo "# Hello" | xie# 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 .# 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 --jsonfrom xie import convert_markdown_to_wechat
result = convert_markdown_to_wechat("# Hello\n\nThis is **bold** text")
if result.success:
print(result.data['html'])# Start web server
xie web --port 5000Open 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.
- 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
# Headers **bold** *italic* ~~strikethrough~~
[links](url)  `code` ```language blocks
> quotes - lists 1. lists | tables |
$math$ $$block math$$
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
