Description
n8n-nodes-md2notion





A custom n8n node that converts markdown content to Notion page blocks with advanced chunking, comprehensive error handling, and support for large documents.
🎯 Why This Node?
Existing n8n community nodes for markdown-to-Notion conversion have critical limitations: they fail with large documents, provide poor error messages, and don’t handle complex content properly. This node solves these problems by:
- ✅ Automatic chunking for large documents (handles 100+ blocks seamlessly)
- ✅ Advanced error handling with detailed, actionable error messages
- ✅ Preserving math formulas exactly as written (inline and block)
- ✅ Supporting 16+ Notion block types including todos, callouts, tables, toggles, and more
- ✅ Content validation with automatic truncation for oversized content
- ✅ Progress tracking showing chunks processed and blocks added
- ✅ Production-ready quality with TypeScript strict mode and comprehensive tests
🚀 Quick Start
Installation
Option 1: Install via n8n Community Nodes (Recommended)
1. Open your n8n instance
2. Go to Settings → Community Nodes
3. Enter package name: n8n-nodes-md2notion
4. Click Install
Option 2: Install via npm
npm install -g n8n-nodes-md2notion
Setup
1. Create Notion Integration
– Go to Notion Integrations
– Create a new integration and copy the API key
2. Configure n8n Credentials
– In n8n, create new Notion API credentials
– Paste your API key
3. Share Notion Page
– Open your target Notion page
– Click Share → Invite → Add your integration
Usage
1. Add the Markdown to Notion node to your workflow
2. Select Append to Page operation
3. Enter your Page ID (from the Notion page URL)
4. Input your markdown content
5. Configure options as needed
📋 Features
🚀 NEW in v1.6.0: Toggle Headings Feature
Previous Updates
v1.5.2: Critical Link & Formula Fixes
v1.5.1: Enhanced Heading & Formula Support
heading_4 (previously incorrectly converted to H3)v1.4.0: Large Document Support
chunksProcessed, totalBlocks, and blocksAdded for monitoringSupported Markdown Elements
| Element | Notion Block Type | Syntax | Status |
|———|——————|——–|——–|
| Text & Formatting | | | |
| Headings (H1-H4) | heading_1/2/3/4 | # ## ### #### | ✅ |
| Headings (H5-H6) | Bold paragraphs | ##### ###### | ✅ |
| Paragraphs | paragraph | Regular text | ✅ |
| Bold and italic | Rich text formatting | bold italic italic | ✅ |
| ~~Strikethrough~~ | Strikethrough annotation | ~~text~~ | ✅ |
| Inline code | Code annotation | ` code | ✅ |text
| Links | Rich text with links | | ✅ |bulletedlistitem
| Lists & Tasks | | | |
| - Bulleted lists | | – item | ✅ |numberedlistitem
| 1. Numbered lists | | 1. item | ✅ |to_do
| - [ ] Todo items | | – [ ] task | ✅ |to_do
| - [x] Completed todos | | – [x] done | ✅ |code
| Content Blocks | | | |
| Code blocks | | ` `language ` | ✅ |quote
| > Blockquotes | | > quote | ✅ |callout
| > [!note] Callouts | | > [!note] text | ✅ |image
| Media & Links | | | |
| !Images | | !alt | ✅ |bookmark
| Bookmarks | | https://example.com | ✅ |divider
| Structure | | | |
| Dividers | | — or * | ✅ |table
| Tables | + table_row | Markdown tables | ✅ |toggle
| Toggle blocks | |
| ✅ |
| Math | | | |
| Inline formulas | Preserved text | $E = mc^2$ | ✅ |
| Block equations | equation | $$formula$$ | ✅ |
Callout Types Supported
| Syntax | Icon | Description |
|--------|------|-------------|
|
> [!note] | 📝 | General notes and information |
| > [!warning] | ⚠️ | Important warnings |
| > [!tip] | 💡 | Helpful tips and suggestions |
| > [!info] | ℹ️ | Additional information |
| > [!important] | ❗ | Critical information |
| > [!caution] | ⚠️ | Cautionary notes |
Configuration Options
Preserve Math Formulas: Keep $formula$ syntax intact (default: enabled)
Math Formula Delimiter: Customize the delimiter character (default: $)
Toggle Headings: Convert all headings to collapsible toggle blocks (default: disabled)
- When enabled: H1-H4 headings become expandable/collapsible sections
- Visual hierarchy: Different colors for each heading level
- Better organization: Large documents become more navigable
Response Data
The node returns comprehensive information about the conversion:
{
"success": true,
"pageId": "your-page-id",
"blocksAdded": 150,
"chunksProcessed": 2,
"totalBlocks": 150,
"responses": [...]
}
blocksAdded: Total number of blocks successfully added to Notion
chunksProcessed: Number of API calls made (for large documents)
totalBlocks: Total blocks generated from markdown
responses: Array of Notion API responses for each chunk
🧮 Math Formula Handling
The Problem: Other nodes convert
$E = mc^2$ incorrectly, breaking Notion rendering.
Our Solution: Smart formula preservation algorithm that intelligently distinguishes between math formulas and currency symbols:
Input: "This equation $E = mc^2$ is famous, but $10 is just money."
Output: Math formula preserved as equation block, dollar sign kept as textBlock equation:
$$
int_{-infty}^{infty} e^{-x^2} dx = sqrt{pi}
$$
v1.5.1 Improvements:
Better detection of price patterns (e.g., $50, $100 美元)
Context-aware formula recognition (LaTeX commands, math symbols)
Prevents false positives like $25 和公式 being treated as math
📖 Examples
🆕 Large Document Example
This node can handle large documents that would fail with other nodes:
Comprehensive Analysis Report (342 lines)
Executive Summary
This report contains extensive analysis with multiple sections...
Section 1: Market Analysis
| Metric | Q1 | Q2 | Q3 | Q4 |
|--------|----|----|----|----|
| Revenue | $1M | $1.2M | $1.5M | $1.8M |
| Growth | 20% | 25% | 30% | 35% |
Mathematical Models
The probability calculation: $P(success) = frac{favorable}{total}$
python
def calculate_probability(data):
return sum(data.favorable) / sum(data.total)
> [!important] Key Finding
> The model shows 85% confidence in the prediction.Section 2: Technical Implementation
Algorithm Details
Core Algorithm
The system processes data using:$$
f(x) = sum{i=1}^{n} wi cdot x_i + b
$$
Where:
$w_i$ represents weights
$x_i$ represents input features
$b$ is the bias term
| Math | | | |
| Inline formulas | Preserved text |
| Block equations |
Callout Types Supported
| Syntax | Icon | Description |
|--------|------|-------------|
|
|
|
|
|
|
Configuration Options
- When enabled: H1-H4 headings become expandable/collapsible sections
- Visual hierarchy: Different colors for each heading level
- Better organization: Large documents become more navigable
Response Data
The node returns comprehensive information about the conversion:
{
"success": true,
"pageId": "your-page-id",
"blocksAdded": 150,
"chunksProcessed": 2,
"totalBlocks": 150,
"responses": [...]
}
🧮 Math Formula Handling
The Problem: Other nodes convert
Our Solution: Smart formula preservation algorithm that intelligently distinguishes between math formulas and currency symbols:
Input: "This equation $E = mc^2$ is famous, but $10 is just money."
Output: Math formula preserved as equation block, dollar sign kept as textBlock equation:
$$
int_{-infty}^{infty} e^{-x^2} dx = sqrt{pi}
$$
v1.5.1 Improvements:
📖 Examples
🆕 Large Document Example
This node can handle large documents that would fail with other nodes:
Comprehensive Analysis Report (342 lines)
Executive Summary
This report contains extensive analysis with multiple sections...
Section 1: Market Analysis
| Metric | Q1 | Q2 | Q3 | Q4 |
|--------|----|----|----|----|
| Revenue | $1M | $1.2M | $1.5M | $1.8M |
| Growth | 20% | 25% | 30% | 35% |
Mathematical Models
The probability calculation: $P(success) = frac{favorable}{total}$
python
def calculate_probability(data):
return sum(data.favorable) / sum(data.total)
> [!important] Key Finding
> The model shows 85% confidence in the prediction.Section 2: Technical Implementation
Algorithm Details
Core Algorithm
The system processes data using:$$
f(x) = sum{i=1}^{n} wi cdot x_i + b
$$
Where:
$w_i$ represents weights
$x_i$ represents input features
$b$ is the bias term ... [continues for 300+ more lines]
Result: Automatically chunked into 2 API calls, all content preserved, detailed progress tracking.
Comprehensive Example
This example showcases all supported block types:
Project Documentation
This is a regular paragraph with bold and italic text, plus ~~strikethrough~~ and inline math: $E = mc^2$.
#### H4 Heading Example
Now properly rendered as heading_4 in Notion!
##### H5 Heading Example
Converted to a bold paragraph (Notion API only supports up to H4).
Task List
[ ] Review the codebase
[x] Write comprehensive tests
[ ] Calculate the integral $int x^2 dx$ Important Notes
> [!warning] Critical Issue
> The server will be down for maintenance.
> [!tip] Pro Tip
> Use keyboard shortcuts to speed up your workflow.
> This is a regular blockquote for general information.
Code Example
javascript
const energy = mass * Math.pow(speedOfLight, 2);
console.log(Energy: ${energy});
codeExpandable Sections
Advanced Configuration
Database Settings
Connection timeout: 30 seconds Max pool size: 10 Enable SSL: true Performance Tuning
The system can handle up to $10^6$ requests per second with proper configuration.
Troubleshooting Guide
If you encounter issues, check the following:1. Verify API credentials 2. Check network connectivity 3. Review error logs
Data Table
| Name | Formula | Value | |------|---------|-------| | Energy | $E = mc^2$ | Variable | | Force | $F = ma$ | Variable |
---
Mathematical Proof
The fundamental theorem of calculus:
$$ int_a^b f'(x) dx = f(b) - f(a) $$
For more information, visit: https://en.wikipedia.org/wiki/Calculus
Final paragraph with mixed content: bold, italic,
, and $f(x) = x^2$ formula.
Basic Usage
special relativityMy Research Notes
This document contains the famous equation $E = mc^2$ discovered by Einstein.
Key Points
Energy and mass are equivalent The speed of light is constant This applies to
javascript
const energy = mass * Math.pow(speedOfLight, 2);
> This formula revolutionized physics.
Advanced Example
Mathematical Concepts
Calculus
The derivative of $f(x) = x^2$ is $f'(x) = 2x$.Statistics
The normal distribution: $f(x) = frac{1}{sigmasqrt{2pi}} e^{-frac{1}{2}(frac{x-mu}{sigma})^2}$Pricing Information
But remember, a coffee costs $5 at the local café, and lunch is around $15.
The product pricing is $100 美元 for the basic plan.
🔧 Development
Prerequisites
Setup
Clone the repository
git clone https://github.com/shawnli1874/n8n-nodes-markdown-to-notion.git
cd n8n-nodes-markdown-to-notionInstall dependencies
npm installBuild the project
npm run buildRun tests
npm test
Testing
Run core functionality tests
npm testTest manually with n8n
cp -r dist/* ~/.n8n/custom/
Restart n8n and test in the UI
🐛 Troubleshooting
Common Issues
"Bad request - please check your parameters" (FIXED in v1.4.0)
Node not appearing in n8n
"Unauthorized" error
"Page not found" error
"Rate limited" error
Math formulas not preserved
Error Messages Guide
The node provides specific error messages with solutions:
| Error Code | Meaning | Solution |
|------------|---------|----------|
| validation_error | Invalid request parameters | Check Page ID format and content |unauthorized
| | Invalid API token | Verify Notion API credentials |forbidden
| | No page access | Share page with integration |objectnotfound
| | Page doesn't exist | Check Page ID and page status |rate_limited
| | Too many requests | Wait and retry |
Performance Tips
Page not found
Debug Mode
Enable debug logging in n8n to see detailed error messages and API responses.
🤝 Contributing
We welcome contributions! Please see CONTRIBUTING.md for guidelines.
Quick Contribution Guide
1. Fork the repository
2. Create a feature branch: git checkout -b feature/amazing-featurenpm test
3. Make your changes and add tests
4. Ensure tests pass: git commit -m ‘Add amazing feature’
5. Commit your changes: git push origin feature/amazing-feature`
6. Push to the branch:
7. Open a Pull Request
📄 License
This project is licensed under the MIT License – see the LICENSE file for details.
🙏 Acknowledgments
📊 Project Stats
🔗 Links
—
Made with ❤️ for the n8n community
If this node solved your formula conversion problems, please ⭐ star the repository!