A powerful Node.js framework for seamlessly adding content to Notion pages and databases with support for markdown parsing, smart toggles, and flexible formatting options.
- Universal URL Support: Works with any Notion page or database URL
- Smart Toggle Creation: Automatically creates collapsible sections for long content
- Markdown Parsing: Full markdown support with code blocks, lists, and formatting
- CLI Tool: Easy command-line interface for quick additions
- Flexible Content: Add text, files, or stdin input
- Auto-detection: Automatically detects if URL is a page or database
- Customizable: Control timestamps, formatting, and toggle behavior
# Clone the repository
git clone https://github.com/yourusername/notion-integration-framework.git
cd notion-integration-framework
# Install dependencies
npm install- Get your Notion API token from Notion Developers
- Update the
NOTION_TOKENinnotion-notes-framework.js - Ensure the token has access to your target pages/databases
# Add simple text
node add-to-notion.js "https://notion.so/your-page" "Your content here"
# Add from a file
node add-to-notion.js "https://notion.so/your-page" ./document.md
# Add from stdin
cat document.md | node add-to-notion.js "https://notion.so/your-page" --stdin# Add with custom title
node add-to-notion.js "url" "content" --title "My Custom Title"
# Add with smart toggles (auto-detect from headers)
node add-to-notion.js "url" file.md --toggles
# Customize toggle threshold
node add-to-notion.js "url" file.md --toggles --min-toggle-lines 15
# Disable timestamp
node add-to-notion.js "url" "content" --no-timestamp
# Disable markdown parsing
node add-to-notion.js "url" "content" --no-markdownconst NotionNotesFramework = require('./notion-notes-framework');
const framework = new NotionNotesFramework();
// Simple text
await framework.addNotes(
'https://notion.so/your-page-url',
'Your content here',
{ title: 'My Note' }
);
// With toggles
await framework.addNotes(
'https://notion.so/your-page-url',
markdownContent,
{
title: 'Documentation',
useToggles: true,
toggleSections: 'auto',
minToggleLines: 10
}
);The framework intelligently creates collapsible sections:
- Short sections (< 10 lines): Display as regular headers
- Long sections (≥ 10 lines): Create collapsible toggles
- Customizable threshold: Adjust based on your needs
- Headers (
#,##,###) - Lists (bullet and numbered)
- Code blocks with syntax highlighting
- TODO items
- Horizontal rules
- Bold and italic text
- Headings (1-3)
- Paragraphs
- Toggle lists
- Code blocks
- Bulleted lists
- Numbered lists
- To-do items
- Dividers
- Callouts
notion-integration-framework/
├── notion-notes-framework.js # Core framework
├── add-to-notion.js # CLI tool
├── claude-notion-integration.js # Original integration
├── test-notion-framework.js # Test examples
├── test-toggles.js # Toggle feature tests
├── package.json # Dependencies
└── README.md # This file
node add-to-notion.js "notion-url" meeting-notes.md --title "Team Meeting" --togglesnode add-to-notion.js "notion-url" api-docs.md --toggles --min-toggle-lines 20echo "Remember to review PR #123" | node add-to-notion.js "notion-url" --stdin --title "Quick Reminder"Contributions are welcome! Please feel free to submit a Pull Request.
MIT License - see LICENSE file for details
Made with ❤️ for the Notion community