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

@noticle/core

v0.10.1

Published

Notion to Markdown Converter

Downloads

4

Readme

@noticle/core

Core package for converting Notion pages to Markdown.

🚀 Installation

Install via npm

# if JavaScript
npm install @noticle/core

# if TypeScript
npm install @noticle/core @noticle/types

📖 Usage

Follow Notion's Getting Started Guide to obtain an API key.

Basic Example

import {
  $getPageFullContent,
  NotionMarkdownConverter,
} from "@noticle/core";
import { Client } from "@notionhq/client";

const client = new Client({
  auth: API_KEY,
});

const pageId = "some-page-id";
// Notion API helpers in this library.
// Recursively retrieve the Notion Block's child elements
const content = await $getPageFullContent(client, pageId);

// convert to markdwon
const executor = new NotionMarkdownConverter();
const result = executor.execute(content);

[!WARNING] The APIs $getPageFullContent and $getDatabasePages may undergo specification changes in the future as we plan to remove the dependency on @notionhq/client.

Customizing Output Markdown

If you want to change the conversion of a Heading Block. For example, define a custom transformer that increases the number of # in a Markdown heading by one.

import { createHeadingTransformerFactory, MarkdownUtils } from "@noticle/core";

export const createMarkdownCustomHeadingTransformer = () => {
	// Use a function to create a transformer
  return createHeadingTransformerFactory(({ level, richText }) => {
    const text = MarkdownUtils.convertRichTextsToMarkdown(richText);
    return MarkdownUtils.wrapWithNewLines(MarkdownUtils.heading(text, level + 1)); // add 1 level
  });
};

To simplify writing tests for transformers, we provide the @noticle/testing library. This library allows you to easily create Notion block objects and test their conversion results.

$ npm install @noticle/testing
import {
  createTransformerContext,
  createHeading1Block,
  createTextRichText,
  dedent,
} from "@noticle/testing";
import { createMarkdownCustomHeadingTransformer } from "./createMarkdownCustomHeadingTransformer";

describe("createMarkdownCustomHeadingTransformer", () => {
  const transformer = createMarkdownCustomHeadingTransformer();

  it("Can convert heading_1 block", () => {
    const block = createHeading1Block({
      richText: [
        createTextRichText({
          content: "Hello",
        }),
      ],
    });
    const context = createTransformerContext({
      blocks: [block],
    });

    const result = transformer(context);
    expect(result).toBe(dedent({ wrap: true })`
      ## Hello
    `);
  });
});

Define the created transformer in the options of the converter.

const executor = new NotionMarkdownConverter({
  heading: createMarkdownCustomHeadingTransformer(),
});
const result = executor.execute(content);

Caption Metadata

You can set metadata for captions in blocks such as images, code blocks, and embeds. Metadata is specified in key=value format, and the portion from the beginning of the caption to the first : is treated as metadata.

Basic Usage

width=500:This is an image description

In this case:

  • width=500 is the metadata
  • This is an image description is the actual caption

Multiple Metadata

Multiple metadata can be specified by separating them with &:

width=500&height=300:This is an image description

In this case:

  • width=500 and height=300 are metadata
  • This is an image description is the actual caption

Usage Examples

  • Specifying image width: width=500:Image description
  • Setting diff for code blocks: diff=true:filename.js

License

Distributed under the MIT License. See LICENSE for more information.

Author

malvageee (https://github.com/salvage0707)