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

@kzttools/md-to-mdx

v0.0.2

Published

Convert Markdown files with front-matter to MDX files with exported metadata.

Readme

md-to-mdx

English | 中文

npm version npm downloads bundle License

将包含 Front Matter 的 Markdown 文件转换为带有 export const metadata 的 MDX 文件,方便在 React/Next.js 等框架中直接使用。

特性

  • 保留 Front Matter 并导出为 metadata 对象。
  • 支持批量转换目录中的 .md 文件,可按需递归子目录。
  • 保持正文内容不变,最大限度兼容现有 Markdown/MDX 生态。

快速开始

无需安装,直接运行:

npx @kzttools/md-to-mdx ./content --deep

命令行参数:

  • directory(位置参数,默认 ./):需要转换的目录。
  • --deep / --no-deep:是否递归处理子目录。
  • --adapter 原字段:新字段:转换 Front Matter 字段名,可重复使用。
  • --out ./output:将生成的文件输出到指定目录(单文件模式可传 .mdx 文件路径)。
  • -h / --help:显示帮助信息。

工具会在原目录旁生成 .mdx 文件,并自动注入 export const metadata = { ... }

只想处理某个单独的 Markdown?直接指向该文件即可:

npx @kzttools/md-to-mdx ./posts/about.md

希望输出到独立目录?使用 --out 指定:

npx @kzttools/md-to-mdx ./content --deep --out ./converted

安装到项目或全局

# 项目内开发依赖
pnpm add -D @kzttools/md-to-mdx

# 全局安装
pnpm add -g @kzttools/md-to-mdx

安装后可直接通过 pnpm md-to-mdx ./notes 或全局的 md-to-mdx ./notes 运行。

许可证

MIT License © KazooTTT