notion-core-workflow-b

Featured

Work with Notion blocks, rich text, comments, and page content. Use when reading/writing page content blocks, building rich text, managing comments, or working with nested block trees. Trigger with phrases like "notion blocks", "notion page content", "notion rich text", "notion comments", "notion append blocks".

AI & Automation 2,249 stars 312 forks Updated today MIT

Install

View on GitHub

Quality Score: 99/100

Stars 20%
100
Recency 20%
100
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
50
License 10%
100
Description 5%
100

Skill Content

# Notion Core Workflow B — Blocks, Content & Comments ## Overview Secondary workflow for content operations: reading block trees, appending content, building rich text with annotations, and managing comments. ## Prerequisites - Completed `notion-install-auth` setup - A Notion page shared with your integration - Familiarity with `notion-core-workflow-a` (databases/pages) ## Instructions ### Step 1: Retrieve Block Children ```typescript import { Client } from '@notionhq/client'; const notion = new Client({ auth: process.env.NOTION_TOKEN }); async function getPageContent(pageId: string) { const blocks = []; let cursor: string | undefined; do { const response = await notion.blocks.children.list({ block_id: pageId, start_cursor: cursor, page_size: 100, }); blocks.push(...response.results); cursor = response.has_more ? response.next_cursor ?? undefined : undefined; } while (cursor); return blocks; } ``` ### Step 2: Read Blocks Recursively (Nested Content) ```typescript async function getBlockTree(blockId: string, depth = 0): Promise<any[]> { const blocks = await getPageContent(blockId); const tree = []; for (const block of blocks) { const node: any = { ...block, children: [] }; // Recursively fetch children if block has them if ('has_children' in block && block.has_children) { node.children = await getBlockTree(block.id, depth + 1); } tree.push(node); } return tree; } // Extract plain text f...

Details

Author
jeremylongshore
Repository
jeremylongshore/claude-code-plugins-plus-skills
Created
7 months ago
Last Updated
today
Language
Python
License
MIT

Integrates with

Related Skills