Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

notion-content-render

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

notion-content-render - npm Package Compare versions

Comparing version 0.2.9 to 0.2.10

14

dist/index.d.ts

@@ -1,2 +0,2 @@

import type { Block, RichText } from "@notionhq/client/build/src/api-types";
import type { Block, HeadingOneBlock, HeadingThreeBlock, HeadingTwoBlock, ParagraphBlock, RichText, ToDoBlock, ToggleBlock } from "@notionhq/client/build/src/api-types";
export declare const BLOCK_TYPES: {

@@ -19,6 +19,6 @@ PARAGRAPH: string;

export declare type StyleFactory<R> = {
heading_1: (input: R) => R;
heading_2: (input: R) => R;
heading_3: (input: R) => R;
paragraph: (input: R) => R;
heading_1: (input: R, block: HeadingOneBlock) => R;
heading_2: (input: R, block: HeadingTwoBlock) => R;
heading_3: (input: R, block: HeadingThreeBlock) => R;
paragraph: (input: R, block: ParagraphBlock) => R;
bold: Modifier<R>;

@@ -35,4 +35,4 @@ strikethrough: Modifier<R>;

richText: (input: Array<R>) => R;
toggle: (title: R, content: R) => R;
todo: (checked: boolean, content: R) => R;
toggle: (title: R, content: R, block: ToggleBlock) => R;
todo: (checked: boolean, content: R | undefined, block: ToDoBlock) => R;
unsupported: (block: Block) => R;

@@ -39,0 +39,0 @@ };

@@ -26,3 +26,3 @@ "use strict";

var richText = toRichTextBlock(text);
return styleFactory.heading_1(richText);
return styleFactory.heading_1(richText, block);
}

@@ -32,3 +32,3 @@ function toHeading_2(block) {

var richText = toRichTextBlock(text);
return styleFactory.heading_2(richText);
return styleFactory.heading_2(richText, block);
}

@@ -38,7 +38,7 @@ function toHeading_3(block) {

var richText = toRichTextBlock(text);
return styleFactory.heading_3(richText);
return styleFactory.heading_3(richText, block);
}
function toParagraph(block) {
var richText = toRichTextBlock(block.paragraph.text);
return styleFactory.paragraph(richText);
return styleFactory.paragraph(richText, block);
}

@@ -73,2 +73,7 @@ function toRichTextBlock(textArray) {

}
function toToggle(content) {
var title = toRichTextBlock(content.toggle.text);
var children = undefined; //Notion doesn't return this yet
return styleFactory.toggle(title, children, content);
}
return {

@@ -90,2 +95,4 @@ renderRichText: toRichTextBlock,

]);
case exports.BLOCK_TYPES.TOGGLE:
return toToggle(block);
default:

@@ -92,0 +99,0 @@ return styleFactory.unsupported(block);

{
"name": "notion-content-render",
"version": "0.2.9",
"version": "0.2.10",
"description": "A library to render notion content structure to React or MD",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc