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

newmd

v0.1.0

Published

A CLI tool that creates markdown files with frontmatter using a Zod schema.

Readme

* blog is the default schema with some fields. You can define your own schema in the config file.

npm GitHub Workflow Status Checked with Biome License

Usage

CLI

Run the following command in your terminal:

npx newmd blog "Hello World"

or using pnpx(pnpm dlx):

pnpx newmd blog "Hello World"

Will create a markdown file with the following content:

---
title: Hello World
description: ''
pubDate: 2025-03-09T01:57:00.000Z
---

* The pubDate field will be filled with new Date().

You can install it globally for convenience.

Options

See newmd --help for more details, following is a brief description.

newmd <schemaName> <title>
  • --content <value> Set the content of the markdown file
  • --path <value> Set the output directory
  • --slug <value> Set the slug for the filename, if not provided, it will be generated from the slugified title.
  • --cwd <value> Set the current working directory
  • --toml Whether to use TOML format for frontmatter, default is false
  • --overwrite Whether to overwrite the existing file, default is false

Config file

You need to create a config file to define the schemas for the frontmatter.

The config structure and default values are as follows:

// newmd.config.[js,mjs,ts]
import { defineConfig, z } from 'newmd'

export default defineConfig({
    // The format of the frontmatter.
    format: 'yaml',
    
      // Root path for the markdown file.
      // Use a string for a single path applied to all schemas:
      path: '.',
      
      // Or use an object to specify different paths per schema:
      // path: {
      //   blog: './content/blog',
      //   docs: './docs',
      //   articles: './content/articles',
      // },
    
    // Schemas for the frontmatter.
    schemas: {
        blog: z.object({
            title: z.string(),
            description: z.string().optional(),
            pubDate: z.coerce.date(),
            updatedDate: z.coerce.date().optional(),
        }),
    },
})

Integration

With Astro

Say you have this content config file:

// src/content.config.ts
import { glob } from 'astro/loaders'
import { defineCollection, z } from 'astro:content'

const blog = defineCollection({
    loader: glob({ pattern: '**/*.md', base: './src/data/blog' }),
    schema: z.object({
        title: z.string(),
        permalink: z.string().optional(),
    }),
})

export const collections = { blog }

You can create a newmd config file like this:

// newmd.config.ts
import { defineConfig, z } from 'newmd'

export default defineConfig({
    // Corresponding to the `base` option in the content config.
    path: './src/data/blog',
    schemas: { // Copy the schema from the content config.
        blog: z.object({
            title: z.string(),
            description: z.string().optional(),
            pubDate: z.coerce.date(),
            updatedDate: z.coerce.date().optional(),
        }),
    },
})

Now you can use the same schema to create markdown files with frontmatter by running npx newmd blog "Hello World".

Credits

This project won't be possible without @toiroakr's zod-empty and other open-source projects.

License

MIT License © 2024-PRESENT Max Chang