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

export-notion

v0.1.2

Published

Export Notion pages to PDF with rendered Mermaid diagrams

Readme

export-notion

Export Notion pages to PDF with rendered Mermaid diagrams.

Solves the problem where Notion's built-in export doesn't render Mermaid diagrams.

Features

  • Fetch page content via Notion API
  • Render Mermaid diagrams as SVG/PNG images
  • Export to PDF, HTML, or Markdown
  • Multiple theme support (default, dark, forest, neutral)
  • Custom CSS for PDF/HTML styling

Installation

# Run directly with npx (no install needed)
npx export-notion <page-id> ./output

# Or install globally
npm install -g export-notion

Notion Integration Setup

  1. Go to https://www.notion.so/my-integrations
  2. Click "New integration"
  3. Enter a name and create
  4. Copy the "Internal Integration Token"
  5. Open the Notion page you want to export
  6. Click "..." (top right) -> "Connections" -> Add your integration

Usage

# Set token via environment variable
export NOTION_TOKEN="your-integration-token"

# Export to PDF (default)
npx export-notion <page-id-or-url> ./output

# Export to Markdown
npx export-notion <page-id-or-url> ./output -f md

# Export to HTML
npx export-notion <page-id-or-url> ./output -f html

# With options
npx export-notion <page-id-or-url> ./output -f pdf -t dark -i png -v

Options

| Option | Description | Default | |--------|-------------|---------| | -f, --format | Output format: pdf, md, html | pdf | | -i, --image-format | Mermaid image format: svg, png | svg | | -t, --theme | Theme: default, dark, forest, neutral | default | | -v, --verbose | Verbose output | false | | --token | Notion API token (alternative to env var) | - | | --css | Custom CSS file for PDF/HTML styling | - |

Page ID Formats

You can specify the page in any of these formats:

# Page ID (32-character hex string)
npx export-notion abc123def456... ./output

# UUID format
npx export-notion abc123de-f456-... ./output

# Notion URL
npx export-notion "https://www.notion.so/My-Page-abc123def456..." ./output

Output Structure

output/
└── My-Page/
    ├── My-Page.pdf
    └── images/
        ├── mermaid-block1.svg
        └── mermaid-block2.svg

Development

# Install dependencies
npm install

# Build
npm run build

# Run
node dist/cli.js <page-id> ./output

Custom CSS

You can customize the PDF/HTML output with your own CSS:

npx export-notion <page-id> ./output --css custom.css

Example custom.css:

body {
  font-family: "Noto Sans JP", sans-serif;
  line-height: 1.8;
  max-width: 800px;
  margin: 0 auto;
}

h1, h2, h3 {
  color: #333;
}

code {
  background: #f5f5f5;
  padding: 2px 6px;
  border-radius: 3px;
}

License

ISC