🧠 Notion Helper - Browser Example

This example demonstrates how to use the Notion Helper library in a browser environment. Each example shows the code you would write on the left, and the generated JSON output on the right.

Example 1: Create Rich Text Objects

import { buildRichTextObj } from 'notion-helper'; // Create rich text with formatting const richText = buildRichTextObj("Hello, World!", { bold: true, color: "blue" }); console.log(richText);
Click "Run Example" to see the JSON output...

Example 2: Create Block Objects

import { paragraph, heading1, bulletedListItem } from 'notion-helper'; // Create an array of different block types const blocks = [ heading1("My Heading"), paragraph("This is a paragraph with some text."), bulletedListItem("First bullet point"), bulletedListItem("Second bullet point") ]; console.log(blocks);
Click "Run Example" to see the JSON output...

Example 3: Create an Entire Page

import { createNotionBuilder } from 'notion-helper'; // Create page object with properties and child blokcs const pageMeta = createNotionBuilder({ limitNesting: false, limitChildren: true, allowBlankParagraphs: true, }).title("Name", "Great American Novel Idea") .richText("Description", "A tale about a cowboy going to space to meet Jabba the Hutt") .status("Status", "To Do") .date("Due Date", "2025-06-01") .heading1("Novel Pitch") .paragraph("The novel starts in an unlikely place: Des Moines, Iowa...") .image(uploadId) .build() console.log(pageMeta);
Click "Run Example" to see the JSON output...