Sync local Markdown files to Notion with full formatting support. Use when user wants to backup, sync, or migrate files to Notion, mentions uploading to Notion, or says sync to Notion. Features include: (1) Recursive directory structure preservation, (2) Complete Markdown formatting (bold, italic, code, links, lists, tables, callouts), (3) Automatic emoji icons based on filenames, (4) Duplicate detection for incremental syncs, (5) Smart chunking for large files, (6) Relative link conversion to Notion page links. Requires Notion API token and target page ID configured in .env file.
Resources
3Install
npx skillscat add treydong/banana-skills/banana-sync-to-notion Install via the SkillsCat registry.
Banana Sync to Notion
Automatically sync local Markdown files to Notion while preserving directory structure and full Markdown formatting.
Setup
Before using this skill:
Install dependencies in the skill directory:
cd banana-sync-to-notion npm installConfigure environment variables by creating a
.envfile:NOTION_TOKEN=your_notion_integration_token NOTION_ROOT_PAGE_ID=target_page_idNOTION_TOKEN: Get from Notion IntegrationsNOTION_ROOT_PAGE_ID: The parent page ID where files will be synced- Ensure the integration has read/write permissions to the target page
Usage
Sync Files to Notion
Run from the skill directory:
npm run sync:notionThis command:
- Recursively scans the source directory (default:
Files/in project root) - Converts Markdown files to Notion blocks
- Preserves directory hierarchy as nested pages
- Assigns emoji icons based on filenames
- Skips existing pages (incremental sync)
- Shows detailed progress and statistics
Clean Notion Pages
Remove all child pages under the target page:
npm run clean:notionUse this before a fresh re-sync.
Re-sync Everything
Clean existing content and sync fresh:
npm run resync:notionCombines clean:notion + sync:notion.
Markdown Support
All standard Markdown syntax is converted to native Notion blocks:
| Syntax | Notion Output |
|---|---|
**bold** or __bold__ |
Bold text |
*italic* or _italic_ |
Italic text |
***bold italic*** |
Bold italic |
`code` |
Inline code |
[text](url) |
Clickable link (http/https only) |
```language ... ``` |
Code block |
- item or * item |
Bullet list |
1. item |
Numbered list |
> quote |
Quote block |
> ๐ก note |
Callout (emoji-prefixed quotes) |
--- or *** |
Divider |
| Markdown tables | Native Notion tables |
Relative Links:
./file.mdor../folder/file.mdโ Converted to Notion page links./image.pngโ Preserved as text (no local file upload)http://...โ Clickable external links
Automatic Icon Selection
The script assigns emoji icons based on filename patterns:
- ๐ Chapters (e.g., "01-intro.md")
- ๐ฏ Getting started, basics
- โ FAQ, troubleshooting, problems
- ๐ก Examples, case studies
- ๐ง Tools, utilities
- ๐ Methods, tutorials
- ๐ Data, analysis, reports
- โ๏ธ Configuration, settings
- ๐๏ธ Architecture, system
- ๐ป Scripts, code
- โ๏ธ Writing, creative
- ๐ Notes, records
- ๐ Advanced, recommendations
- ๐ Guides
- ๐ README files
- ๐ฆ Downloads, resources
- ๐จ Presentations
- ๐ Default (no match)
Customize icons by editing the selectIcon function in scripts/sync-notion.js.
Smart Features
Duplicate Detection: Automatically skips pages that already exist with the same title, enabling incremental syncs without duplicates.
Smart Chunking:
- Handles Notion's 2000-character limit per block
- Supports files with >100 blocks
- Batches API requests to avoid rate limits
- Automatic retry on temporary failures
Progress Reporting: Shows detailed statistics during sync:
- Files processed
- Files created vs skipped
- Folders created
- Duration and errors
Output Example
๐ Starting Notion Sync...
๐ Source: /path/to/Files
๐ Target Page: My Knowledge Base
๐ Syncing directory: Files
โจ Creating: ๐ 01-Introduction
๐ Syncing directory: 01-Introduction
โจ Creating: ๐ 01-overview.md
โญ๏ธ Skipping existing: 02-concepts.md
โจ Creating: ๐ฏ 03-quickstart.md
==================================================
โ
Sync Complete!
==================================================
โฑ๏ธ Duration: 45.2s
๐ Statistics:
โข Files processed: 35
โข Files created: 25
โข Files skipped: 10
โข Folders created: 5
โข Errors: 0
==================================================File Structure
banana-sync-to-notion/
โโโ SKILL.md
โโโ .env (user created)
โโโ package.json
โโโ scripts/
โ โโโ sync-notion.js # Main sync logic
โ โโโ clean-notion.js # Cleanup utility
โโโ Files/ (default source directory)Troubleshooting
Image support: Current version focuses on text/Markdown. Images require hosted URLs (image hosting) to display in Notion. Local image upload requires more complex authentication.
Missing icons: Files that don't match any icon pattern use the default ๐ emoji. Add custom patterns in scripts/sync-notion.js.
Rate limits: The script includes automatic retry logic for Notion API rate limits. Large syncs (>100 files) may take several minutes.
Relative links not working: Ensure the linked Markdown file was also synced. Links only work to pages that exist in Notion.