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

@amsyn/notion-parse

v1.1.0

Published

Convert Notion pages to Markdown with frontmatter

Readme

Notion Parse

An NPM module for downloading Notion content and saving it as Markdown with FrontMatter. This module takes data from Notion database pages and converts them into structured Markdown or MDX files.

Installation

# Using npm
npm install @amsyn/notion-parse

# Using pnpm
pnpm add @amsyn/notion-parse

# Using yarn
yarn add @amsyn/notion-parse

Standard Markdown Mode (.md)

Generates traditional .md files with clean YAML Frontmatter. Images are downloaded to your public directory and referenced via relative paths.

import { parseNotion } from '@amsyn/notion-parse';
import dotenv from 'dotenv';
dotenv.config();

const databaseConfigs = [
  {
    databaseId: process.env.NOTION_DATABASE_ID,
    contentType: "blogs", // Files will be generated under [outputDir]/blogs/
    languageField: "lang", // Optional: for multi-language support (e.g. "en", "zh")
  },
];

async function sync() {
  const { NOTION_SECRET } = process.env;
  if (!NOTION_SECRET) throw new Error("Missing NOTION_SECRET");

  // Sync to './content' directory
  await parseNotion(NOTION_SECRET, './src/app/content', databaseConfigs); 
  console.log("Sync completed!");
}

sync().catch(console.error);

Next.js MDX Folder Mode (.mdx)

Designed for Next.js App Router (e.g., ./src/app/content/[slug]/page.mdx).

When useNextMdxFolderMode: true is enabled, the parser isolates each article into its own folder containing a page.mdx and its local images. Images are automatically imported as ESM modules and rendered using custom React components.

// everything unchanged
const databaseConfigs = [
  {
    databaseId: process.env.NOTION_DATABASE_ID,
    contentType: "blogs",
    useNextMdxFolderMode: true, // 💡 Enables experimental MDX isolation mode
  },
];

Generated page.mdx Preview

import { ArticleLayout } from '@/components/ArticleLayout'
import img0 from './cover.png'

export const article = {
  "notionId": "1a2b3c4d-...",
  "type": "blogs",
  "title": "My Awesome Notion Blog",
  "slug": "my-awesome-notion-blog",
  "comments": []
};

export const metadata = {
  title: article.title,
  description: article.description
}

export default (props) => <ArticleLayout article="{article}" {...props}/>

# Hello World

<Image alt="My Cover Image" src="{img0}"/>

Configuration API (DocumentType)

The databaseConfigs array accepts objects with the following properties:

| Option | Type | Required | Description | | --- | --- | --- | --- | | database | string | Yes | The Notion Database ID. | | contentType | string | Yes | Content type name (used as folder directory). | | languageField | string | No | Property name in Notion for language code (e.g., "en"). | | filterFields | string[] | No | Array of Notion properties to exclude from Frontmatter. | | useNextMdxFolderMode | boolean | No | If true, outputs .mdx with ESM imports. Default false. |

Environment Variables

Create a .env file in the root of your project:

NOTION_SECRET=ntn_xxxxxxxxxxxxxxxxxxxxxxxxxx
NOTION_DATABASE_ID=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Where is my Database ID?

Copy the link of your Notion database page. The ID is the 32-character string in the URL.

Features

  • Double-Track Generation: Choose between traditional .md or Next.js App Router compatible .mdx.
  • Smart Asset Pipeline: Automatically downloads and maps remote Notion images to local storage.
  • Auto Comments Sync: Automatically fetches and nests database page comments into frontmatter.
  • Contentlayer 2 Friendly: Easily integrated into modern SSG pipelines.

Requirements

  • Node.js: 20.x or higher
  • Notion: An integration token with "Read" access.

License

MIT