notion-content-render
Advanced tools
Comparing version 0.2.6 to 0.2.7
@@ -1,2 +0,2 @@ | ||
import type { Block } from "@notionhq/client/build/src/api-types"; | ||
import type { Block, RichText } from "@notionhq/client/build/src/api-types"; | ||
export declare const BLOCK_TYPES: { | ||
@@ -38,4 +38,7 @@ PARAGRAPH: string; | ||
}; | ||
declare type Maker<B> = (block: Block) => B; | ||
declare type Maker<B> = { | ||
renderBlock: (block: Block) => B; | ||
renderRichText: (richText: RichText[]) => B; | ||
}; | ||
export default function <B>(styleFactory: StyleFactory<B>): Maker<B>; | ||
export {}; |
@@ -71,16 +71,19 @@ "use strict"; | ||
} | ||
return function (block) { | ||
switch (block.type) { | ||
case exports.BLOCK_TYPES.HEADING_1: | ||
return toHeading_1(block); | ||
case exports.BLOCK_TYPES.HEADING_2: | ||
return toHeading_2(block); | ||
case exports.BLOCK_TYPES.HEADING_3: | ||
return toHeading_3(block); | ||
case exports.BLOCK_TYPES.PARAGRAPH: | ||
return toParagraph(block); | ||
case exports.BLOCK_TYPES.BULLETED_LIST_ITEM: | ||
return toBulletList(block); | ||
default: | ||
return styleFactory.unsupported(block); | ||
return { | ||
renderRichText: toRichTextBlock, | ||
renderBlock: function (block) { | ||
switch (block.type) { | ||
case exports.BLOCK_TYPES.HEADING_1: | ||
return toHeading_1(block); | ||
case exports.BLOCK_TYPES.HEADING_2: | ||
return toHeading_2(block); | ||
case exports.BLOCK_TYPES.HEADING_3: | ||
return toHeading_3(block); | ||
case exports.BLOCK_TYPES.PARAGRAPH: | ||
return toParagraph(block); | ||
case exports.BLOCK_TYPES.BULLETED_LIST_ITEM: | ||
return toBulletList(block); | ||
default: | ||
return styleFactory.unsupported(block); | ||
} | ||
} | ||
@@ -87,0 +90,0 @@ }; |
{ | ||
"name": "notion-content-render", | ||
"version": "0.2.6", | ||
"version": "0.2.7", | ||
"description": "A library to render notion content structure to React or MD", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
13615
242