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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@notion-stuff/scully-plugin-notion

v6.0.0

Published

This is a [Scully](https://scully.io) plugin to convert [Notion](https://notion.so) pages to static HTML pages utilizing [@notion-stuff/blocks-html-parser](../blocks-html-parser/README.md)

Downloads

33

Readme

@notion-stuff/scully-plugin-notion

This is a Scully plugin to convert Notion pages to static HTML pages utilizing @notion-stuff/blocks-html-parser

Notion API is currently in beta. There are content types that aren't being supported. Check the Notion API documentations for details

Features

  • [x] Convert Notion pages to static HTML
  • [x] Access to Notion page properties as Frontmatter (should be ScullyRoute from ScullyRoutesService)
    • [ ] Customize Notion page properties
  • [x] Customize HTML parsers. Please check out NotionBlocksHtmlParser documentations for more details.

Installation

npm install --save-dev @notion-stuff/scully-plugin-notion

@notion-stuff/scully-plugin-notion depends on @notionhq/client

Usage

Notion integration steps courtesy of Gatsby Source Notion Plugin author

  1. Created a Notion integration (sign in to Notion, go to Settings & Memberships → Integrations → Develop your own integrations , short link to the Integrations creation section). It’s OK to use an internal one. Don’t forget to copy the token: gif-1

  2. Go to the database you want to have access to from Scully, and share it with the integration (Share → Select the integration in the Invite dropdown). Don’t forget the database in the URL. It’s a series of characters after the last slash and before the question mark. gif-2

Here’s a reference: https://www.notion.so/{USER}/{DATABASE_ID}?{someotherirrelevantstuff} If you only have 1 ID before the question mark in the URL, then the first ID is the Database ID i.e. https://www.notion.so/{DATABASE_ID}?{OtherIdThatDoesNotMatter}

  1. Your database needs to have the following Page Properties (Table column headers)

| Title | Status | Slug | | ---------------------- | ----------------------------------------- | ---- | | This should be default | Select (a Published option is required) | Text |

  • Status is required
    • Published status is required because this is being used by the plugin to set the published flag for a specific ScullyRoute. Although this is required for the plugin to work as expected, your intention (as plugin consumers) to use the published flag is totally up to you.
  • Slug is utilized to setup the route to the post which is needed to be set manually as of the moment.
    • You can call Slug whatever you want but this needs to match slugKey
  1. Configure the plugin in scully.your-app.config.ts

Frontmatter (route metadata)

All columns in the table will be added to the route data which can be consumed via ScullyRouteService along with the additional items from notion

All column headers will be turned into camelCase keys to be used in the frontmatter/config of the plugin

interface AdditionalNotionProperties {
  // link to the notion page cover image or null if one isn't set. Note: [someKey] is commonly external or file
  cover: null | { type: string, [someKey: string]: { url: string } };
  // url to the notion page
  notionUrl: string;
  // GUID of the notion page
  id: string;
}
import { ScullyConfig, setPluginConfig } from '@scullyio/scully';
import {
  NotionDom,
  NotionDomRouter,
  NotionDomPluginOptions,
  NotionDomRouterPluginOptions
} from '@notion-stuff/scully-plugin-notion';

setPluginConfig(NotionDom, {
  notionBlocksHtmlParserOptions: {
    /**
     ... customer the parser ...
     */
  },
} as NotionDomPluginOptions);

export const config: ScullyConfig = {
  projectRoot: './src',
  projectName: 'my-project',
  outDir: './dist/static',
  routes: {
    '/blog/:slug': {
      type: NotionDomRouter,
      postRenderers: [NotionDom],
      databaseId: 'your-database-id', // required
      notionApiKey: 'your-integration-secret', // if NOTION_API_KEY is set in Environment Variables, it is used instead of notionApiKey
      basePath: '/blog', // optional, should match your route here
      titleSuffix: '', // optional
      slugKey: 'slug', // optional
    } as NotionDomRouterPluginOptions,
  },
};