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

md2pdf2

v0.2.3

Published

Convert Markdown to PDF using customizable templates

Readme

MD2PDF

A CLI tool that converts Markdown to PDF using customizable templates — think Astro, but for PDFs.

Features

  • Convert Markdown to PDF with a single command
  • Customizable templates with layout, styling, and components
  • Supports multiple output formats (letter, a4, etc.)
  • Template inheritance and partials
  • Frontmatter support for metadata
  • Built-in template engine (Handlebars-like syntax)
  • CLI flags for quick customization
  • Watch mode for development

Quick Start

# Install globally (once published)
npm install -g md2pdf2

# Or use npx
npx md2pdf2 convert input.md -o output.pdf

# With a custom template
md2pdf2 convert input.md --template my-template.hbs -o output.pdf

# Dev mode with live preview
md2pdf2 dev input.md

Agent Skill

Install the md2pdf2 skill for Claude Code, Amp, OpenCode etc:

npx skills add areai51/md2pdf2

This adds the skill to your Claude Code environment, enabling intelligent PDF generation with automatic template selection and markdown formatting.

Dev Mode

Start a live preview server to see your markdown rendered in different templates:

md2pdf2 dev input.md --port 3456

Opens a browser with:

  • Left pane: Template selector (switch between templates)
  • Right pane: Live preview of your markdown

Changes to your .md file or templates auto-reload the preview.

Built-in Templates

  • default - Clean, professional look
  • modern - Bold colors, Inter-style typography
  • minimal - Simple, classic serif
  • newsletter - Email newsletter style
  • resume - CV/resume formatting

Project Structure

my-doc/
├── content/
│   └── my-doc.md
├── templates/
│   ├── default.hbs
│   ├── parts/
│   │   └── header.hbs
│   └── styles.css
├── md2pdf2.config.js
└── package.json

Templates

Templates use handlebars-like syntax for placeholders and partials:

<!DOCTYPE html>
<html>
<head>
  <meta charset="UTF-8">
  <style>{{{styles}}}</style>
</head>
<body>
  {{> header}}
  <main>
    {{{content}}}
  </main>
</body>
</html>

Configuration

md2pdf2.config.js:

export default {
  template: './templates/default.hbs',
  style: './templates/styles.css',
  pdfOptions: {
    format: 'A4',
    margin: { top: '1cm', right: '1cm', bottom: '1cm', left: '1cm' }
  }
}

Development

# Clone and setup
git clone https://github.com/areai51/md2pdf.git
cd md2pdf
npm install

# Build
npm run build

# Test
npm test

# Link for global use
npm link

License

MIT