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-template-vars

v0.2.2

Published

Replace {{variables}} in markdown templates with YAML values

Readme

md-template-vars

A CLI tool to replace {{variables}} in Markdown templates with values from a YAML file.

Installation

npm install -g md-template-vars

Or use with npx:

npx md-template-vars ./templates ./output

Usage

md-template-vars <input> <output> [options]

Arguments

| Argument | Description | | -------- | ----------------------------------------- | | input | Input directory containing template files | | output | Output directory for processed files |

Options

| Option | Default | Description | | --------------- | ---------------- | --------------------------------------------------- | | --vars | variables.yaml | Path to the variables YAML file | | --include | - | Glob pattern to include specific files | | --exclude | - | Glob pattern to exclude specific files | | --watch | false | Watch for file changes and rebuild automatically | | --rename-from | - | Variable name to rename from (use with --rename-to) | | --rename-to | - | Variable name to rename to (use with --rename-from) |

Examples

Basic usage

md-template-vars ./templates ./output

Custom variables file

md-template-vars ./templates ./output --vars production.yaml

Filter files

# Include only files matching pattern
md-template-vars ./templates ./output --include "api-*.md"

# Exclude files matching pattern
md-template-vars ./templates ./output --exclude "draft-*.md"

Watch mode

md-template-vars ./templates ./output --watch

This will watch for changes in:

  • Template files in the input directory
  • The variables YAML file

When changes are detected, templates are automatically rebuilt.

Rename variables

Rename a variable across all template files and the variables YAML file:

# Simple rename
md-template-vars ./templates ./output --rename-from "name" --rename-to "title"

# Rename nested variable
md-template-vars ./templates ./output --rename-from "database.host" --rename-to "db.host"

This updates:

  • All {{oldName}} occurrences in template files → {{newName}}
  • The key in the variables YAML file

Template Syntax

Use {{variableName}} syntax in your Markdown files:

Template (templates/hello.md):

# Hello {{name}}

Welcome to {{project}}!

Variables (variables.yaml):

name: World
project: My Project

Output (output/hello.md):

# Hello World

Welcome to My Project!

Nested Variables

You can use nested objects in your variables file and access them with dot notation:

Template:

# {{app.name}}

Database: {{database.host}}:{{database.port}}

Variables (variables.yaml):

app:
  name: My App

database:
  host: localhost
  port: 5432

Output:

# My App

Database: localhost:5432

Error Handling

| Case | Behavior | | --------------------------- | --------------------------------------------------- | | Undefined variable | Warning is displayed, variable syntax is kept as-is | | Same input/output directory | Error and exit | | Variables file not found | Error and exit |

License

MIT