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

remark-notro

v0.0.11

Published

Remark plugin for Notion-flavored Markdown (NFM)

Downloads

1,568

Readme

remark-notro

npm License: MIT

A remark plugin for Notion-flavored Markdown (NFM). It fixes structural issues in Notion Public API Markdown output and adds callout block support so content can be processed correctly in a remark pipeline.

[!TIP] This package is used internally by notro (Astro Content Loader for Notion). If you are integrating Astro with Notion, use notro instead.

Installation

npm install remark-notro

Usage

import { unified } from "unified";
import remarkParse from "remark-parse";
import remarkGfm from "remark-gfm";
import { remarkNfm } from "remark-notro";

const processor = unified()
  .use(remarkParse)
  .use(remarkNfm)
  .use(remarkGfm);

With @mdx-js/mdx's evaluate():

import { evaluate } from "@mdx-js/mdx";
import { remarkNfm } from "remark-notro";
import remarkGfm from "remark-gfm";
import remarkMath from "remark-math";

const { default: Content } = await evaluate(markdown, {
  remarkPlugins: [remarkNfm, remarkGfm, remarkMath],
  // ...
});

Features

remarkNfm combines three capabilities into one plugin.

1. Preprocessing (preprocessNotionMarkdown)

Fixes structural issues in Notion Markdown before remark tokenizes it.

| Fix | Problem fixed | |-----|--------------| | 0 | (Migration) Escaped inline math \$…\$ from old preprocessing bugs converted back to $…$ | | 1 | --- dividers without a preceding blank line are misread as setext H2 headings | | 2 | Callout directive syntax "::: callout {…}"":::callout{…}"; tab-indented content inside callout blocks is dedented | | 3 | Block-level color annotations {color="…"} → raw <p color="…"> HTML | | 4 | <table_of_contents/> tag (underscore) wrapped in <div> for CommonMark HTML detection | | 5 | Inline equation $\…`$$…$for remark-math | | 6 |<synced_block>wrapper stripped and content dedented | | 7 |isolated with blank lines so it becomes a block-level element | | 8 | Closing tags, , , , get a trailing blank line — without it, CommonMark HTML blocks swallow all following markdown as raw text | | 9 | Markdown link syntaxtextinside raw HTMLcells converted to` tags, because remark does not process inline markdown inside raw HTML blocks |

2. Directive syntax support

Integrates micromark-extension-directive and mdast-util-directive internally to parse :::callout{...} block syntax.

:::callout{icon="💡" color="blue_background"}
This block is treated as a callout.
:::

3. Callout conversion (calloutPlugin)

Transforms directive nodes (containerDirective) into <callout icon="..." color="..."> custom HTML elements.

API

remarkNfm

import { remarkNfm } from "remark-notro";
import type { RemarkNfmOptions } from "remark-notro";

A remark plugin. Currently accepts no options (reserved for future use).

preprocessNotionMarkdown(markdown: string): string

import { preprocessNotionMarkdown } from "remark-notro";

A pure function that preprocesses Notion API Markdown before passing it to remark. Applies fixes 0–9 listed above.

Normally called automatically by remarkNfm, but can be used standalone when processing Markdown outside a remark pipeline (e.g. for cache key computation).

calloutPlugin

import { calloutPlugin } from "remark-notro";

A remark transformer that converts containerDirective nodes into <callout> elements. Included inside remarkNfm; direct use is rarely needed.

Relationship to notro-loader

remark-notro        Pure remark plugin — no Astro or Notion API dependencies
   ↑ used by
notro-loader        Astro + Notion API integration library
                    (Content Loader / MDX compiler / Astro components)
   ↑ used by
notro-blog          Deployable Astro template app
  • remark-notro has no dependency on Astro or the Notion API and can be published independently
  • notro-loader uses remarkNfm in its internal MDX compile pipeline
  • You can use remark-notro directly in any unified or @mdx-js/mdx pipeline