Gatsby plugin for Notion API

Overview

Gatsby

Gatsby Source Plugin Notion API

Maintainability

code style: prettier versioning: or-release

Gatsby source plugin for working with official Notion API.

Here's a Postman collection to play around with the API if you're interested: https://www.postman.com/notionhq/workspace/notion-s-public-api-workspace/overview

🚧 It's a work in progress

This is a source plugin for pulling content into Gatsby from official public Notion API (currently in beta). With this plugin, you will be able to query your Notion pages in Gatsby using GraphQL.

Notion API Reference

An example

Here's my blog running on gatsby-source-notion-api

Features

  • Get your Notion pages in Gatsby via GraphQL
  • Convenient access to page properties
  • Page contents in Markdown!
  • Normalised page title
  • All blocks styling represented in Markdown:
    • bold (**$VALUE**)
    • italic (_$VALUE_)
    • strikethrough (~~$VALUE~~)
    • underline (<u>$VALUE</u>)
    • code ($VALUE)
    • color 🤷 (<span notion-color="$COLOR">$VALUE</span>)
  • Access to raw data returned by Notion API
  • Support for markdown-remark and mdx

Install

yarn add gatsby-source-notion-api

or

npm install --save gatsby-source-notion-api

How to use

Before using this plugin, make sure you

  1. Created a Notion integration (sign in to Notion, go to Settings & MembershipsIntegrationsDevelop 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: Notion integration creation GIF
  2. Go to the database you want to have access to from Gatsby, 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. Notion integration sharing GIF Here's a reference: https://www.notion.so/{USER}/**{DATABASE_ID}**?{someotherirrelevantstuff}

Then add this to your gatsby-config.json:

plugins: [
	{
		resolve: `gatsby-source-notion-api`,
		options: {
			token: `$INTEGRATION_TOKEN`,
			databaseId: `$DATABASE_ID`,
			propsToFrontmatter: true,
			lowerTitleLevel: true,
		},
	},
	// ...
]

Configuration options

token [string][required]

Integration token.

databaseId [string][required]

The identifier of the database you want to get pages from. The integration identified by provided token must have access to the database with given id.

propsToFrontmatter [boolean][defaults to true]

Put Notion page props to Markdown frontmatter. If you set this to false, you will need to query notion to get page props.

lowerTitleLevel [boolean][defaults to true]

Push headings one level down. # becomes ##, ## becomes ###, ### becomes ####. Notion is limited to only 3 levels of heading. You can create ####, #####, etc. - they will not be reflected in Notion, but they will work properly in the Markdown output. Is true by default.

How to query for nodes

You can query for pages with notion or grab all of them with allNotion. The raw content of the page is available under raw property.

Query for all nodes

query {
	allNotion {
		edges {
			node {
				id
				parent
				children
				internal
				title
				properties {
					My_Prop_1
					My_Prop_2
				}
				archived
				createdAt
				updatedAt
				markdown
				raw
			}
		}
	}
}

Alternatively, you can use MarkdownRemark or MDX directly:

query {
	allMarkdownRemark {
		edges {
			node {
				frontmatter {
					title
				}
				html
			}
		}
	}
}

Node properties

id

Unique page identifier. This is not a Notion page identifier. You can get the Notion page id under raw.id.

parent (Node)

Parend Node.

children

Blocks that belong to the page.

title (String)

Page title joined into one string.

properties

Properties of the page. An object with keys representing database columns (snake-cased), and the following value:

id (String)

Notion column id

key (String)

Readable name of the column (without snake case).

value (*)

Value of the column for the page. Might have different structure depending on the type.

type (String)

Notion type of the column.

archived (Boolean)

Boolean. Is true if the pages was marked removed but not removed permanently.

createdAt (Date)

Date of page creation.

updatedAt (Date)

Date of the last page update.

raw (*)

Untouched contents of whatever Notion API returned.

markdown (String)

Markdown contents of the page. Limited by blocks currently supported by Notion API. Unsupported blocks turn into HTML comments specifying that Notion marked this block as non-supported.

Attaching images via "Files" property

If you want to turn images attached through the "Files" property into file nodes that you can use with gatsby-image, you need to attach remote file nodes to the "Files" property. In the example below, the propsToFrontmatter is set to true and the Hero Image Files property is used for images:

// ./gatsby-node.js
exports.onCreateNode = async ({ node, actions: { createNode }, createNodeId, getCache }) => {
	if (node.internal.type === "MarkdownRemark") {
		for (let i = 0; i < node.frontmatter["Hero Image"].length; i++) {
			const name = node.frontmatter["Hero Image"][i].name

			if (!name) {
				continue
			}

			if (name.startsWith("http")) {
				const fileNode = await createRemoteFileNode({
					url: name,
					parentNodeId: node.id,
					createNode,
					createNodeId,
					getCache,
				})

				if (fileNode) {
					node.frontmatter["Hero Image"][i].remoteImage___NODE = fileNode.id
				}
			}
		}
	}
}

Current state

  • Due to the fact that Notion API only appeared recently, and it is still in beta, some blocks are marked "unsupported". Among others, images cannot be fetched for now
  • Currently, gatsby-source-notion-api can only work with one provided database. In further releases, all databases reachable by the Integration will be available for querying
  • Nested blocks are currently skipped. E.g. if a list item has a nested sublist, it's contents will be omitted. This will be fixed in the nearest releases Nested blocks are supported as of 0.4.0!
  • Only raw content is available. Raw meaning whatever Notion returns. Further releases will aim at providing a more convenient data format apart from the raw one 0.3.0 features support for archived, createdAt, updatedAt, properties and title.

🎉 You did it

Thanks for reaching to the end of the readme!

Comments
  • Add Caching

    Add Caching

    Description

    This adds the Gatsby cache to the plugin. When pages are fetched, we first check to see if the page content has been cached. If so, the content is returned directly from the cache.

    Motivation and Context

    This dramatically speeds up build times. In my project, my build went from 79 seconds to 13 seconds.

    Types of changes

    • [ ] Bug fix (non-breaking change which fixes an issue)
    • [ ] Security fix (non-breaking change which fixes a security issue)
    • [x] New feature (non-breaking change which adds functionality)
    • [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
    opened by LandonSchropp 3
  • Refactor notionBlockToMarkdown function

    Refactor notionBlockToMarkdown function

    This pull request wholely refactors the notionBlockToMarkdown function.

    Description

    This code makes a few changes to the existing functionality:

    • The reduce function could be removed by relying on the recursive nature of the blocks.
    • Ensures that most block elements are always separated by two newlines. This is important to prevent them from being interpreted as a single entry, such as with back-to-back blockquotes.
    • Allows blockquotes to contain child blocks, such as lists and paragraphs.
    • Allows list items to contain child blocks, such as lists and paragraphs.

    Motivation and Context

    Originally, my motivation for this was that I needed a blockquote that could contain multiple paragraphs. However, I realized that my approach fixed a few other problems, so I went ahead and did the whole thing.

    Screenshots

    I created a test page in Notion to check the code.

    Screen Shot 2022-01-07 at 8 06 15 PM

    So far, this seems to be parsing well! Here's what the generated markdown looks like:

    This is an example paragraph.
    
    [This](http://example.com) `is` **another** _example_ ~~paragraph~~.
    
    ---
    
    ## Header 1
    
    ### Header 2
    
    #### Header 3
    
    ---
    - [ ]  To do item 1
    - [x]  To do item 2
      
      Child of to-do item 2
    - [ ]  To do item 3
      
      - [x]  Child 1 of to-do item 3
      - [ ]  Child 2 of to-do item 3
    
    ---
    * Bulleted item 1
    * Bulleted item 2
      
      Child of bulleted item 2
    * Bulleted item 3
      
      * Child 1 of bulleted item 3
      * Child 2 of bulleted item 3
    
    ---
    1. Numbered item 1
    1. Numbered item 2
      
      1. Child of numbered item 2
    1. Numbered item 3
      
      1. Child 1 of numbered item 3
      1. Child 2 of numbered item 3
    
    ---
    
    <details><summary>This is a toggle.</summary>This is the toggle content</details>
    
    ---
    
    `` javascript [Backticks edited to display correctly on GitHub]
    function() {
      return "code block";
    }
    ``
    
    
    ---
    
    ![Bill Murray](https://s3.us-west-2.amazonaws.com/secure.notion-static.com/…1cd0dfe80051a2bc49a5&X-Amz-SignedHeaders=host&x-id=GetObject)
    
    ---
    
    > I’m not superstitious, but I am a little stitious.
    > 
    > —Michael Scott (Steve Carrell),
    > 
    > _The Office_
    ---
    
    <audio controls><source src="https://s3.us-west-2.amazonaws.com/secure.notion-static.com/…fe9bf0d1097063f19091&X-Amz-SignedHeaders=host&x-id=GetObject" /></audio>
    

    Types of changes

    • [x] Bug fix (non-breaking change which fixes an issue)
    • [ ] Security fix (non-breaking change wich fixes a security issue)
    • [x] New feature (non-breaking change which adds functionality)
    • [x] Breaking change (fix or feature that would cause existing functionality to not work as expected)
    opened by LandonSchropp 3
  • Add support for column lists and columns

    Add support for column lists and columns

    • Add support for column lists and columns
    • Add documentation for column lists and columns

    Description

    I've included support for Notion's column list and column blocks.

    Motivation and Context

    In my project, I needed a way to render Notion's columns. Prior to this change, this was not possible using gatsby-source-notion-api.

    Screenshots

    Screen Shot 2022-07-24 at 4 26 47 PM

    Types of changes

    • [ ] Bug fix (non-breaking change which fixes an issue)
    • [ ] Security fix (non-breaking change wich fixes a security issue)
    • [x] New feature (non-breaking change which adds functionality)
    • [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
    opened by LandonSchropp 2
  • ⬆️ Bump node-fetch from 2.6.1 to 3.1.1

    ⬆️ Bump node-fetch from 2.6.1 to 3.1.1

    Bumps node-fetch from 2.6.1 to 3.1.1.

    Release notes

    Sourced from node-fetch's releases.

    v3.1.1

    Security patch release

    Recommended to upgrade, to not leak sensitive cookie and authentication header information to 3th party host while a redirect occurred

    What's Changed

    New Contributors

    Full Changelog: https://github.com/node-fetch/node-fetch/compare/v3.1.0...v3.1.1

    v3.1.0

    What's Changed

    ... (truncated)

    Changelog

    Sourced from node-fetch's changelog.

    Changelog

    All notable changes will be recorded here.

    The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.

    What's Changed

    New Contributors

    Full Changelog: https://github.com/node-fetch/node-fetch/compare/v3.1.0...v3.1.2

    3.1.0

    What's Changed

    ... (truncated)

    Commits
    Maintainer changes

    This version was pushed to npm by endless, a new releaser for node-fetch since your current version.


    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 1
  • Add support to code blocks

    Add support to code blocks

    Description

    Add support for code blocks returned by the Notion API

    Types of changes

    • [ ] Bug fix (non-breaking change which fixes an issue)
    • [ ] Security fix (non-breaking change wich fixes a security issue)
    • [x] New feature (non-breaking change which adds functionality)
    • [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
    opened by ovalb 1
  • ⬆️ Bump path-parse from 1.0.6 to 1.0.7

    ⬆️ Bump path-parse from 1.0.6 to 1.0.7

    Bumps path-parse from 1.0.6 to 1.0.7.

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 0
  • ⬆️ Bump normalize-url from 4.5.0 to 4.5.1

    ⬆️ Bump normalize-url from 4.5.0 to 4.5.1

    Bumps normalize-url from 4.5.0 to 4.5.1.

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 0
  • ⬆️ Bump trim-newlines from 3.0.0 to 3.0.1

    ⬆️ Bump trim-newlines from 3.0.0 to 3.0.1

    Bumps trim-newlines from 3.0.0 to 3.0.1.

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 0
  • ⬆️ Bump json5 from 2.2.0 to 2.2.3

    ⬆️ Bump json5 from 2.2.0 to 2.2.3

    Bumps json5 from 2.2.0 to 2.2.3.

    Release notes

    Sourced from json5's releases.

    v2.2.3

    v2.2.2

    • Fix: Properties with the name __proto__ are added to objects and arrays. (#199) This also fixes a prototype pollution vulnerability reported by Jonathan Gregson! (#295).

    v2.2.1

    • Fix: Removed dependence on minimist to patch CVE-2021-44906. (#266)
    Changelog

    Sourced from json5's changelog.

    v2.2.3 [code, diff]

    v2.2.2 [code, diff]

    • Fix: Properties with the name __proto__ are added to objects and arrays. (#199) This also fixes a prototype pollution vulnerability reported by Jonathan Gregson! (#295).

    v2.2.1 [code, diff]

    • Fix: Removed dependence on minimist to patch CVE-2021-44906. (#266)
    Commits
    • c3a7524 2.2.3
    • 94fd06d docs: update CHANGELOG for v2.2.3
    • 3b8cebf docs(security): use GitHub security advisories
    • f0fd9e1 docs: publish a security policy
    • 6a91a05 docs(template): bug -> bug report
    • 14f8cb1 2.2.2
    • 10cc7ca docs: update CHANGELOG for v2.2.2
    • 7774c10 fix: add proto to objects and arrays
    • edde30a Readme: slight tweak to intro
    • 97286f8 Improve example in readme
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 0
  • :sparkles: Add support for multiple databases

    :sparkles: Add support for multiple databases

    Description

    This PR adds support for querying multiple databases by adding a new nodeTypeName property.

    In order to query multiple databases, you can add multiple gatsby-source-notion-api in your project’s gatsby-config.js and set different nodeTypeName values. For instance:

      plugins: [
        {
          resolve: `gatsby-source-notion-api`,
          options: {
            token: `$INTEGRATION_TOKEN`,
            databaseId: `$DATABASE_ID`,
            nodeTypeName: "notionTeamMember",
            propsToFrontmatter: true,
            lowerTitleLevel: true,
          },
        },
        {
          resolve: `gatsby-source-notion-api`,
          options: {
            token: `$INTEGRATION_TOKEN`,
            databaseId: `$DATABASE_ID`,
            nodeTypeName: "notionTask",
            propsToFrontmatter: true,
            lowerTitleLevel: true,
          },
        },
      ],
    

    nodeTypeName is optional and defaults to "Notion", so the change is non-breaking.

    Motivation and Context

    https://github.com/orlowdev/gatsby-source-notion-api/issues/3

    Screenshots

    Types of changes

    • [ ] Bug fix (non-breaking change which fixes an issue)
    • [ ] Security fix (non-breaking change wich fixes a security issue)
    • [x] New feature (non-breaking change which adds functionality)
    • [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
    opened by viteinfinite 0
  • TypeScript support

    TypeScript support

    Hey, Thank you for your commitment to the Notion ecosystem. This plugin is really useful! I want to ask if you have any plans to ship the TS definitions also. Or maybe you consider migrating this project fully to TS?

    opened by yurist38 0
  • ⬆️ Bump minimatch from 3.0.4 to 3.1.2

    ⬆️ Bump minimatch from 3.0.4 to 3.1.2

    Bumps minimatch from 3.0.4 to 3.1.2.

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 0
  • [Question] How to rewrite internal url to pretty url?

    [Question] How to rewrite internal url to pretty url?

    In a Notion page, if you link to another page also in Notion, the linked page will be rendered as:

    <a href="/1a2b3c4d">...</a>
    

    where 1a2b3c4d is the id of the linked Notion page.

    If you use pretty URLs, then how to you map the link above to the pretty URL?

    I haven't tested out this idea, but it seems I'll need to:

    • In onCreateNode, create new slug field for each node.
    • In onCreatePage, query the markdownString value of the page.
    • Search for any instance of relative URL, then query the Notion node with this id, then get the slug value of that node.
    • Create a new string based on markdownString, replacing the original relative URL with the new one that includes pretty url.
    • Pass the new string as context to createPage.
    • This `context prop can then be access in the template component.

    Can anyone offer any guidance?

    opened by bytrangle 1
  • Add support for Mention

    Add support for Mention

    If I mention a page, for example its title is "A Real World Article", it will be just plain text in the markdownString.

    What I think should be rendered:

    [A Real World Article](/a1b2c3d4)
    

    where a1b2c3d4.

    What do you think?

    opened by bytrangle 1
Releases(0.12.0)
  • 0.12.0(Jul 30, 2022)

  • 0.11.0(Oct 14, 2021)

  • 0.10.0(Jun 10, 2021)

    0.10.0

    :boom: Breaking Changes

    • Remove image transformation (31528e3)

    It should be done separately per project

    :sparkles: Features

    • Remove gatsby-source-filesystem peer dependency (4cee1ce)

    :bug: ∘ :ambulance: ∘ :lock: Fixes

    • Docs updated for propsToFrontmatter, Files property, and lowerTitleLevel (ed3de50)
    Source code(tar.gz)
    Source code(zip)
  • 0.9.1(Jun 8, 2021)

    0.9.1

    :bug: ∘ :ambulance: ∘ :lock: Fixes

    • Fix fetching database recursively (804d4c9)

    It left the loop after the first after the first iteration because I put return in the wrong place :sweat_smile:, References #4

    Source code(tar.gz)
    Source code(zip)
  • 0.9.0(Jun 7, 2021)

  • 0.8.1(May 30, 2021)

  • 0.8.0(May 30, 2021)

    0.8.0

    :sparkles: Features

    • Add transforming rich-text properties to a string (2f3f4fa)
    • Only apply block transformations to frontmatter (17f4d62)

    :sparkles: Add simplified date access

    • Add support for image transformation in props (32e7728)

    :sparkles: Add support for lowering title level, :sparkles: Add option for transforming Notion page props to frontmatter, :heavy_plus_sign: Add gatsby-source-filesystem as a peer dependency, :bug: Fix indentation of code snippets written in Markdown syntax, :bug: Fix displaying Markdown tables

    Source code(tar.gz)
    Source code(zip)
  • 0.7.1(May 18, 2021)

  • 0.7.0(May 18, 2021)

    0.7.0

    :sparkles: Features

    • Add support for inline math equations (92271f3)

    :bug: ∘ :ambulance: ∘ :lock: Fixes

    • Remove redundant argument (b2edac0)
    • Remove redundant argument (f9ff004)
    Source code(tar.gz)
    Source code(zip)
  • 0.6.0(May 18, 2021)

    0.6.0

    :boom: Breaking Changes

    • Add support for Remark and MDX integration (8358a4e)

    :boom: Rename markdown property to markdownString

    :sparkles: Features

    • Make frontmatter a bit more convenient to use (5520a1b)
    • Add json field for raw Notion data in one string (2e9355a)

    :bug: ∘ :ambulance: ∘ :lock: Fixes

    • Hide block ids in unsupported block comments (58e916e)
    Source code(tar.gz)
    Source code(zip)
  • 0.5.0(May 17, 2021)

    0.5.0

    :boom: Breaking Changes

    • Fix collecting nested blocks (cb42f88)

    :boom: Nested blocks are now in block.children, rather than block[type].children

    :sparkles: Features

    • Add support for annotations in the page title (color, code, underline, etc.) (50ac3fb)
    • Add support for retrieving page content in Markdown (8e62588)

    :bug: ∘ :ambulance: ∘ :lock: Fixes

    • Use plain text for user mentions in titles (9911980)
    • Remove redundant console.log :smirk: (692d736)
    Source code(tar.gz)
    Source code(zip)
  • 0.4.1(May 17, 2021)

  • 0.4.0(May 17, 2021)

    0.4.0

    :boom: Breaking Changes

    • Replace 'pageContents' with 'children' for accessing page blocks (32cd5b8)

    :sparkles: Features

    • Add support for extracting nested blocks (00f5978)

    They are available under '[block][blockType].children'

    Source code(tar.gz)
    Source code(zip)
  • 0.3.1(May 16, 2021)

  • 0.3.0(May 16, 2021)

    0.3.0

    :boom: Breaking Changes

    • Make 'properties' an object (c2d620d)

    Since you are probably going to know the names of the columns in your tables, fetching data via the column names seems to make more sense. All properties except for the 'title' type are now available in Notion.properties, each having a key (column name), a value, and a type

    :sparkles: Features

    • Add id to properties (12ecc25)
    Source code(tar.gz)
    Source code(zip)
  • 0.2.1(May 16, 2021)

    0.2.1

    :bug: ∘ :ambulance: ∘ :lock: Fixes

    • Compose page title from all chunks it includes (1a019ca)

    Date, user, and page mentions are added as plain text, The title is trimmed, CAVEAT: Mentioning a page that has a title mentioning a date will produce a title different from the same title of the mentioned page. E.g.: 'Page1 @Yesterday' will be transformed into 'Page1 2021-05-15' as of today, but 'Post2 @Post1' will produce 'Post2 Post1 @Yesterday'. That's what Notion API returns right now

    Source code(tar.gz)
    Source code(zip)
  • 0.2.0(May 16, 2021)

  • 0.1.0(May 15, 2021)

Owner
Sergei Orlov ||↓
🐼 The cunning of a panda 🐳 The grace of a whale 🐨 The swiftness of a koala ⛰️ The wisdom of a rock 🦉 The playfulness of an owl at a hot summer noon
Sergei Orlov ||↓
ESLint plugin for react-hook-form

eslint-plugin-react-hook-form react-hook-form is an awsome library which provide a neat solution for building forms. However, there are many rules for

Chuan-Tse Kao 37 Nov 22, 2022
Webpack plugin to tree-shake and minify JSON modules

webpack-json-access-optimizer Optimize JSON modules that are referenced via accessor function. For example, i18n locale JSONs. Features Tree shaking R

hiroki osame 33 Oct 23, 2022
experimental project for babel-plugin-mutable-react-state

Goalist Mutable React Example This example is an attempt to work with babel-plugin-mutable-react-state on a simpler project to see how complicated wou

Reaper 1 Jun 7, 2022
A simplified Telegraf plugin to provide users with a great interface.

telegraf-pagination A simplified Telegraf plugin to provide users with a great interface. Getting started Prerequisites You need to have telegraf inst

Alisher Ortiqov 8 Nov 21, 2022
A markdown-it plugin and Nunjucks async filter to make working with Cloudinary in Eleventy easier.

Cloudinary Eleventy Helpers This is a collection of Eleventy Cloudinary helpers. It currently includes: A markdown-it plugin that converts local image

Jason Lengstorf 9 Feb 2, 2022
A PhotoShot Plugin to get material you colors easily.

material-you 可以快速获取符合 material-you 配色的 PhotoShop 插件。 参考自 Material Theme Builder 安装 初次安装 从 release 中下载压缩包并解压。打开 Photoshop ,运行 文件-脚本-浏览 ,选择安装包中的 安装脚本.js

周财发 4 Jun 17, 2022
Webpack plugin that helps importing .cdc files

cadence-webpack-plugin Webpack plugin that helps importing .cdc files and polyfills fcl dependencies This fixes the Buffer is not defined and Module n

AE Studio 8 Dec 8, 2022
A plugin that lets you override the Webpack modules public path in webpage runtime.

dynamic-public-path-plugin A plugin that lets you override the Webpack modules public path in webpage runtime. plugin : webpack-runtime-public-path-pl

dxh_vip 4 Jan 25, 2022
Expo Config Plugin that generates an App Clip for iOS apps built with Expo.

react-native-app-clip Expo Config Plugin that generates an App Clip for iOS apps built with Expo. Warning This plugin is a work in progress and hasn’t

Benedikt 186 Dec 24, 2022
Babel Plugin Lite Regenerator

Babel Plugin Lite Regenerator intro This babel plugin is a ported version of TypeScript generator transform. It can transform async and generator func

Shi Meng 6 Jul 8, 2022
a babel plugin that can transform generator function to state machine, which is a ported version of typescript generator transform

Babel Plugin Lite Regenerator intro This babel plugin is a ported version of TypeScript generator transform. It can transform async and generator func

Shi Meng 6 Jul 8, 2022
Customizable plugin, smooth scroll up button, on native JavaScript

up-button Customizable plugin, smooth scroll up button, on native JavaScript Description Up button initialization, call up() function, in your js file

Alexandr Zabolotny 2 May 24, 2022
The JavaScript and API powered WordPress.com

Calypso Calypso is the new WordPress.com front-end – a beautiful redesign of the WordPress dashboard using a single-page web application, powered by t

Automattic 12.2k Dec 30, 2022
React friendly API wrapper around MapboxGL JS

react-map-gl | Docs react-map-gl is a suite of React components designed to provide a React API for Mapbox GL JS-compatible libraries. More informatio

Vis.gl 6.9k Dec 31, 2022
Fully typed hooks and utility functions for the React Native StyleSheet API

react-native-style-utilities Fully typed hooks and utility functions for the React Native StyleSheet API npm i react-native-style-utilities ESLint Set

Marc Rousavy 73 Dec 17, 2022
Distance Matrix Routing App with Tom Tom API

Distance Matrix Routing App Have you ever wanted to build a delivery app that will calculate the shortest distance from each drop off spot? Get extra

Ania Kubow 31 Dec 13, 2022
Web Audio API based Pitch Tuner application made with ReactJS.

Pitch Tuner Pitch Tuner is a ReactJS application based on WebAudio API. You can tune your guitar/ukelele from online without any application! The algo

Jalal Uddin 27 Jul 11, 2022
Redux-Toolkit example with React Hooks CRUD Application, Axios, Rest API, Bootstrap

Redux-Toolkit CRUD example with React Hooks, Axios & Web API Build Redux-Toolkit CRUD application with React Hooks and Rest API calls in that: Each it

null 69 Dec 27, 2022
An application that has a frontend (user interface) that allows you to create, read, update or delete (CRUD) products using an API in which you can also create, read, update or delete products.

CRUD app with React and Firebase 9 An application that has a frontend (user interface) that allows you to create, read, update or delete (CRUD) produc

Júlio Bem 3 Sep 28, 2021