npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@ohcj099/md2wechat

v1.0.1

Published

Markdown 转微信公众号富文本 HTML — 零依赖命令行工具,支持代码高亮、表格、一键复制

Readme

md2wechat

Markdown 转微信公众号排版工具

将 Markdown 文件转换为微信公众号编辑器可直接粘贴的富文本 HTML

npm version License: MIT GitHub Pages

赞助作者

功能特性

  • ✅ 支持完整的 Markdown 语法(标题、粗体、斜体、代码块、列表、表格等)
  • ✅ 微信公众号完美兼容的内联 CSS 样式
  • ✅ 代码块语法高亮配色
  • ✅ 支持暗色主题
  • ✅ 自动复制到剪贴板(支持 Windows/macOS/Linux)
  • ✅ 零依赖,使用 esbuild 打包为单个文件
  • ✅ 完美支持中英文混合排版

安装

npm install -g @ohcj099/md2wechat

或者使用 npx 直接运行:

npx @ohcj099/md2wechat article.md

使用方法

基本用法

# 从文件读取
md2wechat article.md

# 从 stdin 读取
cat article.md | md2wechat

# 输出到文件
md2wechat article.md -o output.html

# 使用暗色主题
md2wechat article.md --theme dark

命令行选项

| 选项 | 说明 | |------|------| | --theme <theme> | 主题:default(默认)或 dark | | --output, -o <file> | 输出到文件 | | --version | 显示版本号 | | --help | 显示帮助信息 |

示例

输入 Markdown

# 微信公众号文章标题

这是一段**粗体**和*斜体*的文字。

## 代码示例

​```javascript
function hello() {
  console.log("你好,世界!");
}
​```

> 这是一段引用文字

- 列表项 1
- 列表项 2

输出效果

转换后的 HTML 会自动复制到剪贴板,直接粘贴到微信公众号编辑器即可。

样式说明

| 元素 | 样式 | |------|------| | 标题(h1-h6) | 深蓝色 (#1a1a2e),左侧彩色边框 | | 代码块 | 浅灰色背景 (#f6f8fa),语法高亮 | | 行内代码 | 浅灰色背景,红色文字 | | 引用块 | 左侧蓝色边框,灰色背景 | | 表格 | 细边框,表头深色背景 | | 链接 | 蓝色,无下划线(微信不支持外链) |

开发

# 克隆仓库
git clone https://github.com/your-username/md2wechat.git
cd md2wechat

# 安装依赖
npm install

# 开发模式
npm run build

# 运行测试
echo "# Hello" | node dist/cli.js

许可证

MIT


如果这个工具对你有帮助,请考虑 赞助作者