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

md-to-html-rongx

v1.9.0

Published

Markdown ↔ HTML 双向转换工具,支持 Mermaid 验证修复、代码高亮、KaTeX 数学公式,Feynman 白金主题

Readme

md-to-html-feynman

Markdown ↔ HTML 双向转换工具,支持 Mermaid 验证修复、代码高亮、KaTeX 数学公式,Feynman 白金主题。

功能特性

MD → HTML(md-to-html):

  • 📝 Markdown 转 HTML(基于 marked)
  • 🎨 Feynman 白金主题(浅色/深色自动切换)
  • 📊 Mermaid 语法验证与自动修复(14 种图表类型)
  • 🌈 代码高亮(highlight.js)
  • 🔢 KaTeX 数学公式
  • 📑 左侧侧边栏导航(多文档模式)
  • 📋 右侧页内目录(TOC)
  • 📋 代码块一键复制
  • 📱 响应式设计

HTML → MD(html-to-md): ⭐ NEW

  • 🔄 HTML 转 Markdown(基于 Turndown)
  • 📊 Mermaid 代码块保留
  • 🌈 代码块语言识别
  • 📐 表格完整转换
  • 🧹 智能 DOM 清洗(自动移除导航/侧边栏)
  • 🎯 自定义内容选择器
  • 📊 转换报告统计

安装

npm install -g md-to-html-rongx

使用方法

MD → HTML:转换 Markdown 为 HTML

md-to-html input.md -o output.html

HTML → MD:转换 HTML 为 Markdown

html-to-md -i input.html -o output.md

批量转换目录

html-to-md -i ./html_folder -o ./md_folder -b

命令行选项

md-to-html (MD → HTML)

| 选项 | 说明 | |------|------| | -o, --output | 输出文件或目录 | | --title | 文档标题 | | --no-highlight | 禁用代码高亮 | | --no-mermaid | 禁用 Mermaid 图表 | | --no-katex | 禁用 KaTeX 数学公式 | | --no-emoji | 移除 Emoji(保留 Mermaid 块内的 emoji) | | -h, --help | 显示帮助信息 |

html-to-md (HTML → MD)

| 选项 | 说明 | |------|------| | -i, --input | 输入 HTML 文件或目录 | | -o, --output | 输出 MD 文件或目录 | | -s, --selector | CSS 选择器指定主要内容区域 | | -b, --batch | 批量转换目录下所有 HTML 文件 | | -r, --remove | 自定义移除的 CSS 选择器(逗号分隔) | | -v, --verbose | 显示详细转换报告 | | -h, --help | 显示帮助信息 |

示例

MD → HTML

# 转换单个文件
md-to-html README.md

# 转换目录
md-to-html ./markdown -o ./html --title "项目文档"

HTML → MD

# 转换单个文件
html-to-md -i report.html -o report.md

# 指定主要内容区域(过滤侧边栏)
html-to-md -i page.html -s ".main-content" -o page.md

# 批量转换整个文件夹
html-to-md -i ./html_docs -o ./md_docs -b

# 详细模式,显示转换报告
html-to-md -i page.html -s "article" -v

双向转换工作流

# 1. MD → HTML(发布为网页)
md-to-html docs/guide.md -o public/guide.html

# 2. HTML → MD(从现有网页恢复文档)
html-to-md -i old-site/page.html -o docs/recovered.md -s ".content" -v

作为 Node.js 模块使用

// MD → HTML
const { mdToHtml } = require('md-to-html-rongx');
const html = mdToHtml('# Hello World', '我的文档');
console.log(html);

// HTML → MD
const { htmlToMd } = require('md-to-html-rongx');
const md = htmlToMd('<h1>Hello</h1><p>World</p>');
console.log(md);

主题样式

  • 白金配色方案
  • 自动检测系统深色模式
  • 左侧侧边栏导航
  • 右侧页内目录
  • 平滑滚动和高亮

依赖

  • marked: Markdown 解析
  • highlight.js: 代码高亮
  • Mermaid、KaTeX 等通过 CDN 加载

许可证

MIT