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

md2pdf-context

v1.0.2

Published

Convert Markdown to PDF with one right-click. Supports Mermaid, syntax highlighting, math, themes and more.

Readme

md2pdf-context

Convert Markdown to PDF with a single right-click. Supports Mermaid diagrams, syntax highlighting, math (KaTeX), themes, batch conversion and more.

Platform Node License


Features

  • Right-click → Convert to PDF on any .md file (Windows & Linux)
  • Mermaid diagrams rendered as SVG
  • Syntax highlighting via highlight.js
  • Math / LaTeX via KaTeX ($inline$ and $$block$$)
  • Task lists with checkboxes
  • YAML Frontmatter support
  • Table of Contents generation
  • 3 built-in themes: github, dark, minimal
  • Custom CSS themes
  • Batch conversion — entire folders at once
  • CLI (md2pdf) for scripting and automation
  • Standalone .exe — no Node.js required for end users

Installation

Option 1 — Right-click installer (Windows)

Requires Node.js (LTS)

  1. Download and extract the zip
  2. Right-click scripts/install-windows.batRun as Administrator
  3. Done — right-click any .md file and choose "Convert to PDF"

Option 2 — Global CLI via npm

npm install -g md2pdf-context
md2pdf yourfile.md

Option 3 — Standalone .exe (no Node.js needed)

Download the latest .exe from the Releases page.

md2pdf.exe yourfile.md
md2pdf.exe myfolder/

Linux / macOS

git clone https://github.com/RedFeatherXO/md2pdf-context.git
cd md2pdf-context
bash scripts/install-unix.sh

Usage

CLI

# Single file
md2pdf README.md

# Batch — whole folder
md2pdf docs/

# Multiple files
md2pdf file1.md file2.md file3.md

# Custom theme
md2pdf file.md --theme dark

# With Table of Contents
md2pdf file.md --toc

# Landscape A3
md2pdf file.md --format A3 --landscape

# Custom output path
md2pdf file.md -o output/report.pdf

# All options
md2pdf --help

All CLI Options

| Option | Default | Description | | ---------------------- | -------- | ----------------------------------------------------- | | --theme <name> | github | Theme: github, dark, minimal, or path to .css | | --format <fmt> | A4 | Page format: A4, A3, Letter, Legal | | --landscape | false | Landscape orientation | | --toc | false | Generate Table of Contents | | --toc-depth <n> | 3 | TOC heading depth (1–6) | | --no-mermaid | — | Disable Mermaid rendering | | --no-highlight | — | Disable syntax highlighting | | --no-math | — | Disable KaTeX math | | --margin-top <mm> | 20mm | Top margin | | --margin-bottom <mm> | 20mm | Bottom margin | | --margin-left <mm> | 20mm | Left margin | | --margin-right <mm> | 20mm | Right margin | | -o, --output <path> | — | Output file path |


Configuration

Place a md2pdf.config.json in your project folder (or any parent folder):

{
  "theme": "github",
  "format": "A4",
  "landscape": false,
  "margins": {
    "top": "20mm",
    "right": "20mm",
    "bottom": "20mm",
    "left": "20mm"
  },
  "mermaid": true,
  "highlight": true,
  "math": true,
  "toc": false,
  "tocDepth": 3
}

Config files are discovered by walking up the directory tree from the input file.

YAML Frontmatter

You can also configure per-file in the Markdown itself:

---
title: My Document
theme: dark
format: A3
landscape: true
toc: true
---

# My Document

...

Themes

| Theme | Description | | --------- | --------------------------- | | github | GitHub-style (default) | | dark | Dark mode (GitHub Dark) | | minimal | Clean serif, print-friendly |

Custom Theme

Point to any .css file:

md2pdf file.md --theme ./my-custom-theme.css

Or in config:

{ "theme": "./themes/corporate.css" }

Mermaid Example

```mermaid
graph TD
    A[Start] --> B{Decision}
    B -->|Yes| C[Do it]
    B -->|No| D[Skip]
```

Math Example

Inline: $E = mc^2$

Block:

$$
\int_0^\infty e^{-x^2} dx = \frac{\sqrt{\pi}}{2}
$$

Task List Example

- [x] Install md2pdf-context
- [x] Convert first file
- [ ] Publish to GitHub

Building the .exe

Requires pkg:

npm install
npm run build:exe
# Output: dist/md2pdf-win.exe, dist/md2pdf-linux, dist/md2pdf-macos

Requirements

  • Node.js >= 16 (not needed for .exe)
  • Internet connection during conversion (CDN: Mermaid, highlight.js, KaTeX)
  • Note: Currently, this tool has primarily been tested on Windows 10. Linux and macOS versions are provided but should be considered experimental.

Offline mode: Download the CDN assets and point to local files in a custom theme — see wiki.


License

MIT — do whatever you want with it.