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

markmuse-wechat

v1.0.1

Published

Convert Markdown to WeChat Official Account HTML format (requires browser environment)

Readme

markmuse-wechat

将 Markdown 转换为微信公众号格式的 HTML

安装

npm install markmuse-wechat

快速开始

Node.js 环境(推荐)

import { getWeChatHtml } from 'markmuse-wechat/converter';

// 使用默认样式
const html = await getWeChatHtml('# 标题\n这是内容 $E = mc^2$');

// 使用自定义样式
const html2 = await getWeChatHtml(markdown, customCss);

浏览器环境

ES 模块方式

import { convertDefault } from 'markmuse-wechat';

// 确保 MathJax 已加载
// <script src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-svg.js"></script>

// 使用默认样式
const html = await convertDefault(markdown);

// 使用自定义样式(会与默认样式合并)
const html2 = await convertDefault(markdown, customCss);

CDN 方式

<!-- 加载 MathJax -->
<script>
  window.MathJax = {
    tex: {
      inlineMath: [['$', '$']],
      displayMath: [['$$', '$$']]
    },
    svg: {
      fontCache: 'none'
    }
  };
</script>
<script src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-svg.js"></script>

<!-- 加载 MarkMuse(通过 CDN) -->
<script src="https://cdn.jsdelivr.net/npm/markmuse-wechat/dist/bundle.iife.js"></script>

<script>
  // 使用默认样式
  const html = await window.MarkMuse.convertDefault(markdown);
  
  // 使用自定义样式
  const html2 = await window.MarkMuse.convertDefault(markdown, customCss);
</script>

API

Node.js API

getWeChatHtml(markdown: string, customCss?: string): Promise<string>

在 Node.js 环境中将 Markdown 转换为微信公众号格式的 HTML。

示例:

import { getWeChatHtml } from 'markmuse-wechat/converter';

const html = await getWeChatHtml('# 标题\n内容');

batchConvert(items: Array<{markdown: string, css?: string}>): Promise<string[]>

批量转换多个 Markdown 内容。

示例:

import { batchConvert } from 'markmuse-wechat/converter';

const results = await batchConvert([
  { markdown: '# 文章1' },
  { markdown: '# 文章2', css: customCss }
]);

浏览器 API

convert(markdown: string, cssText: string): Promise<string>

将 Markdown 转换为微信公众号格式的 HTML(完全由 CSS 控制样式)。

convertDefault(markdown: string, customCss?: string): Promise<string>

将 Markdown 转换为微信公众号格式的 HTML(带默认样式,开箱即用)。

功能特性

  • ✅ 支持 Markdown 语法
  • ✅ 支持数学公式(LaTeX,通过 MathJax)
  • ✅ 支持代码高亮(highlight.js)
  • ✅ 支持自定义 CSS 主题
  • ✅ 自动处理微信公众号兼容性
  • ✅ CSS 样式自动内联

依赖要求

  • Playwright: Node.js 环境需要(会自动安装)
  • MathJax: 浏览器环境需要(通过 CDN 加载)

License

MIT