1.6.1 • Published 11 months ago

notion-blocks v1.6.1

Weekly downloads
-
License
ISC
Repository
github
Last release
11 months ago

Notion-Blocks

alt text

semantic-release: React Main Workflow npm version Badge

NPM PACKAGE

LIVE DEMO

Use

NotionBlocks

import {NotionBlocks} from 'notion-blocks'
import 'notion-blocks/dist/styles/katex.css'


export const example = () => {
  const blocks = BLOCKS_FROM_NOTION_API;

  return (
    <NotionBlocks blocks={blocks}>
  )
}

FetchNotionBlocks

import { FetchNotionBlocks } from 'notion-blocks';

const { cover, response, blocks } = await FetchNotionBlocks({
  notionkey: process.env.NOTION_KEY,
  notionPageId: PAGE_ID,
});

API

NotionBlocks

ProptypeDescription
blocksobjectlist of blocks that can be acquired from Notion's API
codeThemestringlight or dark
containerStyleobjectObject to style container where blocks are rendered
codeOverlaybooleanTo Show overlay in code block that allows users to copy code, and see the language within the code block
headerStylesobjectStyle overrides for headers, These overrides do not include toggle headers
toggleHeaderStylesobjectStyle overrides for toggle headers. These styles do not include the content within the headers
toggleStylesobjectStyle overrides for toggle lists. These styles do not include the content within the headers
codeStylesobjectstyles placed onto the code block container.
pictureStylesobjectstyles for pictures
calloutStylesobjectstyles for callout container
quoteStylesobjectstyles for quote container
listStylesobjectstyles for individual block container
columnStylesobjectstyles for column container
bookmarkStylesobjectstyles for bookmark container
equationStylesobjectstyles for Equation container
childPageStylesobjectstyles for child page container
tableStyleobjectstyles for table container
tableRowStyleobjectstyles for all table rows except headers
tableHeaderStyleobjectstyles for table headers row and columns
onChildPageClickfunctionfunction to be called if user clicks on child page block. (id, title) => console.log(id, title)

FetchNotionBlocks

Function to only be used on the backend where secrets are not exposed to the client

proptypedescription
notionKeystringnotion secret key
notionPageIdstringID of page you'd like to fetch

Not Supported

  • link to page (not to be confused with child page or embedded pages which are supported)

Development

Local Setup

Setup

Install dependencies

yarn

local StoryBook

yarn storybook

Building

yarn rollup
1.4.6

12 months ago

1.4.5

12 months ago

1.4.4

12 months ago

1.6.1

11 months ago

1.4.3

12 months ago

1.6.0

11 months ago

1.4.2

12 months ago

1.5.0

12 months ago

1.4.9

12 months ago

1.4.11

12 months ago

1.4.8

12 months ago

1.4.10

12 months ago

1.4.7

12 months ago

1.4.12

12 months ago

1.4.1

1 year ago

1.4.0

1 year ago

1.3.0

1 year ago

1.2.0

1 year ago

1.1.6

1 year ago

1.1.5

1 year ago

1.1.4

1 year ago

1.1.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago